Alright, I've got an application with Items and SubItems (generic names). I want a user to be able to be able to select an Item in a dropdownlist, which then without posting back gives them an option to select a SubItem from another dropdownlist. To this point I've been filling the Item dropdownlist, dynamically creating a dropdownlist for each Item and filling it with SubItems, and using Javascript to show only the SubItem dropdownlist which contains SubItems for the currently selected Item. This works fine, accept for the fact that due to the nature of the application and my inability to create my dynamic controls in the OnInit I'm having to recreate my dropdownlists without viewstate in the PageLoad. The only problem with this is if the user navigates to another page and comes back via a Done button, the incorrect SubItem dropdownlist is shown. Here's the .NET code which adds the JavaScript to the window.onload.
What's really interesting is when I step through the code strShowSubItem (which shows the SubItem) says that it will show the correct SubItem dropdownlist, but when I look at the source of the page, it shows the dropdownlist of the last Item I was setting.
What I'm really looking for is a way to do this differently. Someone was telling me about using XML to do this but I haven't been able to find a way to do that. If anyone has any ideas, I would greatly appreciate it.
Code:
Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "windowLoad", strScriptHeader + strShowLabel + strHideDDLs + strShowSubItem + strScriptFooter);
What I'm really looking for is a way to do this differently. Someone was telling me about using XML to do this but I haven't been able to find a way to do that. If anyone has any ideas, I would greatly appreciate it.