I'm using an UltraWebTab control. In it are WebGroupBoxes with standard ASP.Net controls. I have a button that clears the contents of everything on the form (text boxes and drop down lists). Now, when I manually change the index of a dropdownlist all of the tabs mesh together. It only does it when a value is selected from the dropdownlist and then the clear button is pressed. I'm going to include the clear button code and a screen shot of the before / after. I'm including as an attachment before and after screen shots of the "Search" tab in zip file, as you can see from them, all of the other tabs get jumbled after line 66 is executed at some point in the loop (I've also tried setting the selected value of the dropdownlist by index with the same effect). Apologies for the shoddy photoshoping of the screen shots. :P
Also, I'm using the .Net Framework 3.5 with the 2008 NetAdvantage controls for the CLR 3.5.
53 Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnClear.Click
54 '******************************************************************************
55 ' Clear the search form
56 '******************************************************************************
57
58 ' Loop through the table and clear all input boxes
59 For Each Tr As TableRow In tblSearch.Rows
60 For Each Td As TableCell In Tr.Cells
61 For Each C As Control In DirectCast(Td, TableCell).Controls
62 If TypeOf C Is TextBox Then
63 DirectCast(C, TextBox).Text = ""
64 ElseIf TypeOf C Is DropDownList Then
65 ' for some reason this causes a bug with the infragistics tab. This is the line that is causing the bug whenever I change the value of the DropDownList.
66 DirectCast(C, DropDownList).Items.FindByValue("").Selected = True
67 End If
68 Next
69 Next
70 Next
71
72 UltraWebGrid1.Clear()
73 lblInfo.Text = "Form cleared succesfully"
74 End Sub
I figured out a work around but I'm still going to need to be able to change the selected index in a drop down for this project. Here's the workaround, I just added JavaScript onto the button to clear the form instead:
btnClear.Attributes.Add("onClick", "document.forms[0].reset();return false;")
It appears that when the dropdownlist selected is set to true the following Html comes back malformed on the drop down list (I checked the HTML before and after this line of code was run, it was fine before and missing an end > after), as you can see the option tag comes back missing a right bracket and the value. Seems like a bug to me in the rendering methods as all that I changed was the setting Selected = True on that control. Anybody have any thoughts on a work around?
<option selected="selected" value="">Not Specified</option> <option value="A">Value 1</option> <option </div>