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=""><asp:DropDownList ID="DropDownList_SubTopic" runat="server"
Width="182px"></asp:DropDownList><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
vishal - 21 May 2008 13:12 GMT
> dFieldValidator ID="RequiredFieldValidator_topic" runat="server"
> ControlToValidate="DropDownList_Topic"
[quoted text clipped - 43 lines]
>
> End Sub
My apologies the original post didn't go through fine. I am having
issues with using ajax with an asp.net page. I have 2 drop downs topic
and subtopic and subtopic loads when I select a topic. I am using an
updatepanel to make sure the entire page doesn't refresh/reload but
this doesn't work. In my case the entire page ends up refreshing even
though I've used an update panel. The load in the aspx file is as
follows
<ajaxToolkit:ToolkitScriptManager
ID="ScriptManager1" EnablePartialRendering="true" runat="server"/>
<asp:UpdatePanel runat="server" ID="up1"
UpdateMode="Conditional">
<ContentTemplate>
<tr>
<td style="height: 50px;" colspan=""><asp:Label
ID="Label_Topic" Text='Topic :' runat="server" Height="22px"
Width="92px" /></td>
<td style="width: 277px; height: 50px;" colspan="">
<br />
<asp:DropDownList ID="DropDownList_Topic"
runat="server" Width="182px" AutoPostBack="True"></
asp:DropDownList><br />
<asp:RequiredFieldValidator
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=""><asp:DropDownList ID="DropDownList_SubTopic" runat="server"
Width="182px"></asp:DropDownList><br />
</td>
</tr>
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID ="DropDownList1" EventName
="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Thanks.
Joe - 21 May 2008 19:40 GMT
It seems your source is not complete. it is missing the Table Tag. I
was unable to make it work when the Table tag was outside the
UpdatePanel. When placed inside the contentTemplate it started
working.
-joe
vishal - 22 May 2008 08:18 GMT
> It seems your source is not complete. it is missing the Table Tag. I
> was unable to make it work when the Table tag was outside the
> UpdatePanel. When placed inside the contentTemplate it started
> working.
>
> -joe
Hi Joe,
I changed the source to the following
<ajaxToolkit:ToolkitScriptManager
ID="ScriptManager1" EnablePartialRendering="true" runat="server"/>
<asp:UpdatePanel runat="server" ID="up1"
UpdateMode="Conditional">
<ContentTemplate>
<table border="1">
<tr>
<td style="height: 50px;" colspan=""><asp:Label
ID="Label_Topic" Text='Topic :' runat="server" Height="22px"
Width="92px" /></td>
<td style="width: 277px; height: 50px;" colspan="">
<br />
<asp:DropDownList ID="DropDownList_Topic"
runat="server" Width="182px" AutoPostBack="True"></
asp:DropDownList><br />
<asp:RequiredFieldValidator
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=""><asp:DropDownList ID="DropDownList_SubTopic" runat="server"
Width="182px"></asp:DropDownList><br />
</td>
</tr>
</table>
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID ="DropDownList_Topic" EventName
="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Note the table tags but this is still not working. This entire code is
inside another table but the controls I don't want to refresh are
inside the table tag but it still doesn't work. Please help.