V
vishal
dFieldValidator ID="RequiredFieldValidator_topic" runat="server"
ControlToValidate="DropDownList_Topic"
ErrorMessage="Select a topic"
Display="Dynamic" Width="130px"></asp:RequiredFieldValidator><br />
</td>
<td style="height: 50px;" colspan=""><asp:Label
ID="Label_Param_Sat" Text='Sub-Topic :' runat="server" Height="19px"
Width="96px" /></td>
<td style="width: 233px; height: 50px;"
colspan=""><aspropDownList ID="DropDownList_SubTopic" runat="server"
Width="182px"></aspropDownList><br />
</td>
</tr>
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID ="DropDownList1" EventName
="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Here is the code in my page behind vb file
Public Sub DropDownList_Topic_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
DropDownList_Topic.SelectedIndexChanged
Dim dr As DbDataReader
Dim mySearchService As New DropDownService
Dim strTextField As String = ""
Dim strValueField As String = ""
If (strCategory = "") Then
strCategory = DropDownList_Search.SelectedItem.Value
End If
dr = mySearchService.GetsubtopicValues(strCategory,
DropDownList_Topic.SelectedItem.Value, strTextField, strValueField)
If (dr.HasRows()) Then
DropDownList_SubTopic.DataTextField = strTextField
DropDownList_SubTopic.DataValueField = strValueField
DropDownList_SubTopic.DataSource = dr
DropDownList_SubTopic.DataBind()
DropDownList_SubTopic.Items.Insert(0, New ListItem("",
""))
End If
End Sub
ControlToValidate="DropDownList_Topic"
ErrorMessage="Select a topic"
Display="Dynamic" Width="130px"></asp:RequiredFieldValidator><br />
</td>
<td style="height: 50px;" colspan=""><asp:Label
ID="Label_Param_Sat" Text='Sub-Topic :' runat="server" Height="19px"
Width="96px" /></td>
<td style="width: 233px; height: 50px;"
colspan=""><aspropDownList ID="DropDownList_SubTopic" runat="server"
Width="182px"></aspropDownList><br />
</td>
</tr>
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID ="DropDownList1" EventName
="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Here is the code in my page behind vb file
Public Sub DropDownList_Topic_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
DropDownList_Topic.SelectedIndexChanged
Dim dr As DbDataReader
Dim mySearchService As New DropDownService
Dim strTextField As String = ""
Dim strValueField As String = ""
If (strCategory = "") Then
strCategory = DropDownList_Search.SelectedItem.Value
End If
dr = mySearchService.GetsubtopicValues(strCategory,
DropDownList_Topic.SelectedItem.Value, strTextField, strValueField)
If (dr.HasRows()) Then
DropDownList_SubTopic.DataTextField = strTextField
DropDownList_SubTopic.DataValueField = strValueField
DropDownList_SubTopic.DataSource = dr
DropDownList_SubTopic.DataBind()
DropDownList_SubTopic.Items.Insert(0, New ListItem("",
""))
End If
End Sub