Issue with ListOptions events not being triggered

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
kirondedshem
User
Posts: 642

Issue with ListOptions events not being triggered

Post by kirondedshem »

ASP.NET maker 2018.0.1
Database: postresSql 9.6
WIndows: 10 pro 64 bit
.NET Core 2.0

Hi again, I am having an issue where I want to use ListOptions_Rendered() event to diable the edit listoption on page " vw_my_next_of_kin ", the background is when a record has been approved i want to hide the edit option while on this list page.this is also a detail table in vw_my_profile page.

BUT I first tried putting the code in visual studio to first test, but when i tried to put debug points on all events after page_data_rendered, none of them got called.

NOTE:for this example refer to " vw_my_next_of_kin "

SO the code i put code like

// ListOptions Rendered event
public void ListOptions_Rendered() {
//Example:
//ListOptions["new"].Body = "xxx";

//if its approved hide the edit button
            if (approval_status.CurrentValue == "Approved")
            {
                ListOptions["edit"].Visible = false;
            }

}

Issue 1: BUT when i check the code in "vw_my_next_of_kinlist.cs" and "vw_my_next_of_kingrid.cs", none of them have the following code in them when i scroll down to the respective event.

Issue 2: When i try to put a debug point on these fucnions the code never even reaches them, i tried to put debug points on fucntions above them ie ListOptions_Rendering, ListOptions_Load but they are also no hit, ie i dont hink the code calls them at all.


Webmaster
User
Posts: 9427

Post by Webmaster »

Note that setting the Visible property of an list option to false will hide the column, so you should use it only in ListOptions_Load (NOT ListOptions_Rendered).

To hide the list option, just set the Body to an empty string.


kirondedshem
User
Posts: 642

Post by kirondedshem »

To hide the list option, just set the Body to an empty string.
Noted I'll adjust accordingly,
But i still have an issue am concerned as to why after generation the grid page model does not contain any of my custom code for the ListOptions_Rendered() event, yet the list page has an override method with said code.

This is causing a problem as i am viewing the said page in master/detail view as detail so i need the custom code to also run in grid page as well


Webmaster
User
Posts: 9427

Post by Webmaster »

Currently there are no List Options (which are for the List page only) and ListOptions_* server events for the Grid page.


kirondedshem
User
Posts: 642

Post by kirondedshem »

I dont know if am clear on this. SO let explain it a bit more, just so i dont misunderatnd

If I have an editable view called "vw_my_next_of_kin" and I write some custom code in ListOptions_Rendered() event which will hide / disable agiven listoption eg edit for rows depending on a certain condition.
When i go to the list page eg vw_my_next_of_kinlist, I see that some edit listoptions are disabled as expected.

NOW I then connect it to a master/detail relationship as a detail page, I then go to table settings of vw_my_next_of_kin tick master/detail view as detail. When i browse the master/detail view page(which is what i want the most). The edit listoptions are not disabled as expected(ie the custom code i put in list page is not affecting it in anyway).

Currently there are no List Options (which are for the List page only) and ListOptions_* server events for the Grid page.

By grid page I dont mean like grid add,gird edit,inline add,inline edit. I said this coz i saw when I open a master/detail view page the debug point i put on page_load event in Models->vw_my_next_of_kingrid.cs page is hit AND THE debug point on Models->vw_my_next_of_kinlist.cs iS NOT HIT AT ALL (I dont know if this is expected behaviour but this is what led to my comment above)

Does this mean that there is no way for me to affect how list options are drawn if a list page is seen from master/detail view as a detail table even though it still gets to draw list options like view,edit,delete.

If the above is true then please advise me on how best to achive my desired result, coz i recall being able to do the above in phpmaker multiple times so i just underatnd why its not working as expected.


Webmaster
User
Posts: 9427

Post by Webmaster »

Note that <table>grid.cs/cshtml are Grid pages for Master/Detail-Add/Edit/View (as detail grid), <table>list.cs/cshtml are List pages (with or without Grid-Add/Edit), they are two different pages (NOT reusing the List pages as detail grid), even though they are generated from a shared template file. ListOptions_* server events are designed for the List pages and currently there are no similar server events for Grid pages, you can only either customize the template or the generated scripts yourself to add events.


Post Reply