Issue with AJAX Update PANEL - PLEASE HELP!!!

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=""><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
 
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=""><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


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.
 
J

Joe

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
 
V

vishal

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top