Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

Issue with AJAX Update PANEL  - PLEASE HELP!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vishal - 21 May 2008 12:09 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.