473,411 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Help with ASP.NET UpdatePanel control!!!

Ok, I'm having a little difficulty with the ASP.net updatepanel control. I have it all hooked up and it is posting back to the server correctly, but the problem I am having is it will not update the innerHTML of a div tag. I'm thinking I have seen this done before.

Here is the client-side code:

Expand|Select|Wrap|Line Numbers
  1. <asp:UpdatePanel runat="server" ID="UpdatePanel2" EnableViewState="true" UpdateMode="Conditional" >
  2.         <ContentTemplate>
  3.             <p>Please verify your information is correct, then click the <br />"Confirm" button continue with your enrollment."</p>
  4.             <div id="message" runat="server" style="color:Red;"></div>
  5.             <table>
  6.                 <tr>
  7.                     <td>Name:</td>
  8.                     <td><asp:Label ID="fullNameLabel" runat="server"></asp:Label></td>
  9.                 </tr>
  10.                 <tr>
  11.                     <td>SSN:</td>
  12.                     <td><asp:Label ID="ssnLabel" runat="server"></asp:Label></td>
  13.                 </tr>
  14.                 <tr>
  15.                     <td>Gender:</td>
  16.                     <td><asp:Label ID="genderLabel" runat="server"></asp:Label></td>
  17.                 </tr>
  18.                 <tr>
  19.                     <td>DOB:</td>
  20.                     <td><asp:Label ID="dobLabel" runat="server"></asp:Label></td>
  21.                 </tr>
  22.                 <tr>
  23.                     <td>Birth State:</td>
  24.                     <td><asp:Label ID="birthStateLabel" runat="server"></asp:Label></td>
  25.                 </tr>
  26.                 <tr>
  27.                     <td>Marital Status:</td>
  28.                     <td><asp:Label ID="maritalStatusLabel" runat="server"></asp:Label></td>
  29.                 </tr>
  30.                 <tr>
  31.                     <td>Address:</td>
  32.                     <td>
  33.                         <asp:Textbox ID="address1Label" runat="server" MaxLength="50"></asp:Textbox>
  34.                     </td>
  35.                 </tr>
  36.                 <tr>
  37.                     <td>&nbsp;</td>
  38.                     <td>
  39.                         <asp:Textbox ID="address2Label" runat="server" MaxLength="50"></asp:Textbox>
  40.                     </td>
  41.                 </tr>
  42.                 <tr>
  43.                     <td>City:</td>
  44.                     <td>
  45.                         <asp:Textbox ID="cityLabel" runat="server" MaxLength="50"></asp:Textbox>
  46.                     </td>
  47.                 </tr>
  48.                 <tr>
  49.                     <td>State:</td>
  50.                     <td><asp:Label ID="stateLabel" runat="server"></asp:Label></td>
  51.                 </tr>
  52.                 <tr>
  53.                     <td>Zip:</td>
  54.                     <td>
  55.                         <asp:Textbox ID="zipLabel" runat="server" MaxLength="10"></asp:Textbox>
  56.                     </td>
  57.                 </tr>
  58.                 <tr>
  59.                     <td>Country:</td>
  60.                     <td><asp:Label ID="countryLabel" runat="server"></asp:Label></td>
  61.                 </tr>
  62.                 <tr>
  63.                     <td>Home Phone:</td>
  64.                     <td>
  65.                         <asp:Textbox ID="homePhoneLabel" runat="server" MaxLength="10"></asp:Textbox>
  66.                     </td>
  67.                 </tr>
  68.                 <tr>
  69.                     <td>Cell Phone:</td>
  70.                     <td>
  71.                         <asp:Textbox ID="cellPhoneLabel" runat="server" MaxLength="10"></asp:Textbox>
  72.                     </td>
  73.                 </tr>
  74.                 <tr>
  75.                     <td>Work Phone:</td>
  76.                     <td>
  77.                         <asp:Textbox ID="workPhoneLabel" runat="server" MaxLength="10"></asp:Textbox>
  78.                     </td>
  79.                 </tr>
  80.                 <tr>
  81.                     <td>Work Phone Ext:</td>
  82.                     <td>
  83.                         <asp:Textbox ID="workPhoneExtLabel" runat="server" MaxLength="5"></asp:Textbox>
  84.                     </td>
  85.                 </tr>
  86.                 <tr>
  87.                 <tr>
  88.                     <td>Email Address:</td>
  89.                     <td>
  90.                         <asp:Textbox ID="emailAddressLabel" runat="server" MaxLength="150"></asp:Textbox>
  91.                     </td>
  92.                 </tr>
  93.                 <tr>
  94.                     <td colspan="2" style="text-align:right;">
  95.                         <asp:Button ID="confirmButton" runat="server" Text="Confirm" CssClass="button" />
  96.                     </td>
  97.                 </tr>
  98.             </table>
  99.         </ContentTemplate>
  100.         <Triggers>
  101.             <asp:AsyncPostBackTrigger ControlID="enrollNowButton" EventName="Click" />
  102.         </Triggers>
  103.     </asp:UpdatePanel>
  104.  
Here is the server-side code:

Expand|Select|Wrap|Line Numbers
  1.  Protected Sub confirmButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles confirmButton.Click
  2.         If String.IsNullOrEmpty(Me.address1Label.Text) Then
  3.             message.InnerHtml = "Address is required! Please enter your address."
  4.             message.Style("display") = ""
  5.             'UpdatePanel2.Update()
  6.         End If
  7.         If String.IsNullOrEmpty(Me.cityLabel.Text) Then
  8.             message.InnerHtml = "Address is required! Please enter your address."
  9.             message.Style("display") = ""
  10.             'UpdatePanel2.Update()
  11.         End If
  12.         If String.IsNullOrEmpty(Me.zipLabel.Text) Then
  13.             message.InnerHtml = "Address is required! Please enter your address."
  14.             message.Style("display") = ""
  15.             'UpdatePanel2.Update()
  16.         End If
  17.         If String.IsNullOrEmpty(workPhoneLabel.Text) Then
  18.             message.InnerHtml = "Address is required! Please enter your address."
  19.             message.Style("display") = ""
  20.             'UpdatePanel2.Update()
  21.         End If
  22.  
  23.     End Sub
  24.  
Any help with this would be appreciated.
Jan 14 '11 #1
0 1033

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sachin_M | last post by:
Hi Friends, I've developed an activeX control (.ocx) with VB 6.0 it has two Public functions, which chages some values of text boxes in the control. Fun1(int a) Fun2() How to use this control...
1
by: Mad Scientist Jr | last post by:
I don't know how this is happening, but a dropdown control I have is resetting to the 2nd value on the list anytime a postback occurs. I have no initiation code outside of If Not (IsPostBack) ...
3
by: Sky Sigal | last post by:
I coming unglued... really need some help. 3 days chasing my tail all over MSDN's documentation ...and I'm getting nowhere. I have a problem with TypeConverters and storage of expandableobjects...
2
by: Sachin_M | last post by:
Hi Friends, I've developed an activeX control (.ocx) with VB 6.0 it has two Public functions, which chages some values of text boxes in the control. Fun1(int a) Fun2() How to use this control...
8
by: Bob | last post by:
This is a bug that affects all controls, not just the ones that it's screwing up in my app. I really need a workaround. Anyone? Please? Before I regret letting my MSDN subscription run out and pay...
0
by: =?Utf-8?B?S29uc3RhbnRpbg==?= | last post by:
I have a need to have a repeater inside update panel control which should update dynamically when "Update" button is clicked. I have repeater inside update panel control which takes custom...
3
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, "And the link to Microsoft's site on that blog says: "The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an...
1
by: Guramrit Singh | last post by:
Hi Everybody, I have a problem with UpdatePanelAnimationExtender. I have multiple update panels each with a UpdatePanelAnimationExtender associated with it. I want all my update panels mode to...
0
by: Dwight Johnson | last post by:
I am just starting to use AJAX, and I've run into a problem that I cannot resolve. I have a text box, the third of three controls in an UpdatePanel. Here's the scenario: 1. I create all the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.