asp.net - Seeking Advice: Updating a FormView Based on DropdownList Value -


Greetings!

I'm looking for some advice about an approach to displaying data in a FormView on the selection of a dropdown list within that form weave control, for example, I have a UserControl is:

  & lt; Asp: XmlDataSource id = "xdsMyXmlData" runat = "server" enabled caching = "incorrect" XPath = "root / subscription" /> & Lt; ASP: FormView id = "FVVMIFormview" runat = "server" datasource id = "xdmxml data" & gt; & Lt; ItemTemplate & gt; & Lt; Div & gt; & Lt; H2 & gt; & Lt;% # XPath ("Title")% & gt; & Lt; / H2 & gt; & Lt; Fieldset & gt; & Lt; Asp: DropDownList id = "ddlMemberTypes" runat = "server" DataSource = '& lt;% # Select XPath ("MenuItems / *")% & gt; & Gt; & Lt; / Asp: DropDownList & gt; & Lt; / Fieldset & gt; & Lt; Table & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; & Lt;% # XPath ("Columns / Names")% & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt;% # XPath ("Columns / Age")% & gt; & Lt; / Th & gt; & Lt; Th & gt; & Lt;% # XPath ("Column / Date Pair")% & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; Asp: Repeater ID = "rptMembershipInfo" runat = "server" DataSource = '& lt;% # Select the XPath ("Member / *")% & gt; & Gt; & Lt; ItemTemplate & gt; & Lt; TR & gt; & Lt; Th & gt; & Lt;% # XPath ("Data / Name")% & gt; & Lt; / Th & gt; & Lt; Td> & Lt;% # XPath ("Data / Age")% & gt; & Lt; / Td> & Lt; Td> & Lt;% # XPath ("Data / Date Added")% & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: FormView & gt;  

UserControl's OnLoad () looks like this:

  Safe override zero onload (EventEurge E) {base.OnLoad (e); String l_XmlData = MyControllerClass.GetMembershipTableXml (0); XdsMyXmlData.Data = l_XmlData; }  

I will be able to use the value of the selected items in DropDownList to retrieve the related XML to getMembershipTableXml () and then to use it to populate the values ​​of the FormView Want to What would be the best way to do this? Make a Response Redirect back to the current page using the selected DropDownList value as a query string variable? I hope there is a better way than what you think?

You can create an event on your DropDownList for the selected ITemChanged; When this happens, you can catch selected items, and call your GetMembershipTableXml function.

Finally, do not forget to call DataBind on your Form-Weave Control to update prices :)

I thinks this What is after you, hope it helps!


Comments