Hi
I have an EditFormTemplate and in the FormTemplate I have 2 dropdowns (They are asp:dropdowns, not Rad ones) I can populate them with data from code behind but what I want to do is populate the second ddlist from a value from the first.
This is the first ddl markup
The problem is that the value for the second dropdownlist is always nothingm the findcontrol is failing.
I have also tried the following to find the control:
I have an EditFormTemplate and in the FormTemplate I have 2 dropdowns (They are asp:dropdowns, not Rad ones) I can populate them with data from code behind but what I want to do is populate the second ddlist from a value from the first.
This is the first ddl markup
<
asp:DropDownList ID="ddlSite" runat="server" AutoPostBack="true" SelectedIndexChanged="UpdateLocation"></asp:DropDownList>
On ther server I get the UpdateLocation event
Protected Sub UpdateLocation(ByVal sender As Object, ByVal e As System.EventArgs) |
Dim ddlLocation As DropDownList = DirectCast(FindControl("ddlLocation"), DropDownList) |
Dim mw As New CoreData |
Dim mw_dt As DataTable = mw.LocationByParent(sender.selectedvalue) |
If mw_dt.Rows.Count > 0 Then |
With ddlLocation |
.Items.Add(New ListItem("", 0)) |
.DataSource = mw_dt |
.DataValueField = "LocationId" |
.DataTextField = "LocationName" |
End With |
End If |
End Sub |
I have also tried the following to find the control:
Dim editedItem As GridEditableItem = CType(CType(sender, DropDownList).NamingContainer, GridEditableItem)
Dim ddlLocationt As DropDownList = CType(editedItem("ddlLocation").Controls(0), DropDownList)
How do I get a handle on the second DropdownList?
Andy