Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
865
Setting a Dropdownlist's Selected Value Mucks Up HTML Content in UltraWebTab
posted

I'm using Infragistics NetAdvantage 2009.2, and have noticed something odd going on when I recently upgraded my application from Infragistics 5.3 to 9.2. 

I have an UltraWebTab, each containing a ContentTemplate node.  Each ContentTemplate contains a user control.  Some user controls contain dropdownlists whose selected value is set to a specific value.  For example, if I'm editing a record, and I have a dropdownlist containing different report types - 1,2,3,4 -- and the report type is 3, then the dropdownlist's selected value should be 3.  It appears that whenever I set the dropdownlist's selected value, the page content is all messed up.  Content from the first and second tab appear on the second tab.  When I click on any other tab, the previous content disappears, but the content that should appear never gets displayed.  When I remove the code for setting the selected value, everything appears fine.  Has anyone encountered this problem before?

  • 865
    Verified Answer
    posted

    OK, I found a solution.  I don't know if it's a bug, or one of those "behavior-by-design" things.  I don't know if it's a .Net thing or an Infragistics thing.  Anyhoo, I'm going to detail my findings and solution below.  I hope this will help some poor soul.

    In one of my routines, I was creating a new listitem object for a dropdownlist object.  Just your standard "Select One" listitem object, as follows:

    objItem = New ListItem("Select One","")

    I was adding the same listitem to a number of different dropdownlist objects, as follows:

    dropdownList1.items.insert(0,objItem)
    dropdownList2.items.insert(0,objItem)

    Finally, there were some dropdownlists that were being hidden based on certain conditions.

    Long story short, I found that if I created a new listitem for each dropdownlist, as follows:

    objItem = New ListItem("Select One","")
    dropdownList1.items.insert(0,objItem)
    objItem = New ListItem("Select One","")
    dropdownList2.items.insert(0,objItem)

    The problem I described -- the HTML output getting mucked up -- went away!

    So.  It appears that the solution is to create a new listitem for each dropdownlist object, not create one new listitem object and add it to all the dropdownlist objects.

    Yeah, I can already hear someone out there say "Oh, yeah, didn't you know that you're supposed to do it that way?  It's documented in MSDN and if you just Google it--"  OK, OK, fine, whatever.  All's I know is that this wasn't a problem in the 1.1 Framework, using Infragistics 6.3, but it all of a sudden becomes a problem in .Net 3.5/Infragistics 9.2.