Page 1 of 1

How to replace rows in List view?

Posted: Thu Sep 19, 2024 6:43 pm
by rsbr

Hi,

I am no an experienced coder, but I managed to make a few good simple apps with ASP.NET MAKER. however, in my most recent project, I need to display results of a table valued function or a stored procedure that takes a parameter to construct the list. I tried to have a view with a default parameter value to return 0 records so that ASP.NET can build the page. But how can I run my procedure and fill in the list with the resulting rows?

Any help would be much appreciated.


Re: Need advice: Replace rows in List view

Posted: Fri Sep 20, 2024 7:36 am
by MichaelG

To use stored procedure, please read:
viewtopic.php?f=7&t=50935


Re: Need advice: Replace rows in List view

Posted: Fri Sep 20, 2024 7:42 pm
by rsbr

Hi MichaelG,
This somehow explains how to make it in a Custom Page. What I did is as follows:

  • Created a view that results in 0 records
  • Synched ASP.NET MAKER to generate all the code for it (My concern is the LIST PAGE)
  • I don't need ADD, EDIT, VIEW, just need LIST

What I am trying to achieve is to run SQL in any form:
1- sql = "SELECT * FROM dbo.myfunction(@Parameter)"
2- Stored Procedure that has the sql from (1)

and before the page is loaded with 0 records from the original Recordset I want to load the records from the SQL I ran.

I think I need to do something like

// Get the value of @parameter from Session Variable or anyother means

if CurrentPageID = "list" && CurrentPageName = "myPageName"
{
	CurrentPage.sqlSelect =  "SELECT * FROM dbo.myfunction(@Parameter)" 
}

and let ASP.NET MAKER do the rest as I want to add some ListOptions etc....

Can you provide some guidance how to do this?
Your advice is highly appreciated.
R.S


Re: Need advice: Replace rows in List view

Posted: Sat Sep 21, 2024 7:38 am
by MichaelG

You can probably make use of the server events in the list page to do this.