asp.net - Nested Repeaters and SqlDataSource Parameters -


I am using nested repairs to create a table to create a reason, which I do not discuss here I'm doing, but what I am doing is two data sources, one for the top level repeater, which will correspond to the rows, and return the cells in one line for the second level repeater.

What am I thinking, but if I can specify a parameter in the nested repeater's data source which can set a field in the result from the data source first?

Can I set a parameter for the value of data binding expression?

The reason I want to do this is that I have two stored procedures when the page is loaded, then I have a session parameter that I can use to run the first stored function, however, the second stored procedure For this, I need to associate a value from each instance of the top level repeater with the call for the second stored procedure, with a different parameter value. L. I think the best way to handle the itemDataBound event of the external is to repeat the internal data source control. Search and set a selectParameter for it.

  Zero MyOuterRepeater_ItemDataBound (Object Sender, Repeater Item Aventus E) {// Inner Datasource Control Search in this line. SqlDataSource s = (SqlDataSource) e.Item.FindControl ("InDerDataSource"); // Set up SelectParameter for this Datasource Control / Re-evaluate the area to be passed. S.SelectParameters ["MyParam"] DefaultValue = DataBinder.Eval (e.Item.DataItem, "MyFieldValueToPass"). ToString (); }  

To use the DataAlist, see ASP.NET Quick Photos

PS: Tony's answer below for the above important improvements To see the snippet in particular, it will be necessary to check the item type of the current repeater item. Alternatively, it is always a good practice to check the tap on everything.


Comments