Advertisement

07.23.2008 at 04:19PM PDT, ID: 23590546
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

AJAX ValidatorCalloutExtender causes "Error on Page" message when extended control is hidden

Asked by tatton777 in Asynchronous Javascript and XML (AJAX), C# Programming Language, Programming for ASP.NET

I have an ASP.NET project that throws that neat little " ! Error on Page " icon in the lower left corner of the browser under certain conditions.

If a TextBox has a ValidatorCalloutExtender attached to it AND
The TextBox is hidden AND
The TextBox would cause the Validator to fire on postback
THEN
That little Error on Page shows up

I'm pretty new to AJAX, can someone tell me how to handle this. It doesn't hurt functionallity, but it hurts the trust level my clients have in my app. I've attach a sample ASP.NET page that throws the error conditionally. ASP.NET is listed first in the snipped, then the C# code behind.

Thanks.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
 
          <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr runat="server" id="tr_field1">
                  <td>
                    #1&nbsp;&nbsp;
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                  </td>
                </tr>
                <tr runat="server" id="tr_field2">
                  <td>
                    #2&nbsp;&nbsp;
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <asp:Button ID="btnPostBack" runat="server" Text="Cause Postback" 
                      onclick="btnPostBack_Click" />
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnHide1" runat="server" Text="Hide 1" 
                      onclick="btnHide1_Click" CausesValidation="false"/>
                    <asp:Button ID="btnHide2" runat="server" Text="Hide 2" 
                      onclick="btnHide2_Click" CausesValidation="false"/>
                    <asp:Button ID="btnShowAll" runat="server" Text="Show All" 
                      CausesValidation="false" onclick="btnShowAll_Click"/>
                  </td>
                </tr>
              </table>
            
              <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                  Wait up you pushy bastard
                </ProgressTemplate>
              </asp:UpdateProgress>
              
              <asp:RequiredFieldValidator ID="rfTextBox1" 
                runat="server" 
                ErrorMessage="<b>Required Field</b><br />Please Provide a Value" 
                Display="None"
                ControlToValidate="TextBox1" />
              <ajaxToolkit:ValidatorCalloutExtender ID="rfTextBox1E" runat="server" 
                TargetControlID="rfTextBox1"
                HighlightCssClass="validatorCalloutHighlight" />
                
              <asp:RequiredFieldValidator ID="rfTextBox2" 
                runat="server" 
                ErrorMessage="<b>Required Field</b><br />Please Provide a Value" 
                Display="None"
                ControlToValidate="TextBox2" />
              <ajaxToolkit:ValidatorCalloutExtender ID="rfTextBox2E" runat="server" 
                TargetControlID="rfTextBox2"
                HighlightCssClass="validatorCalloutHighlight" />
              
            </ContentTemplate>          
          </asp:UpdatePanel>
 
        </div>
    </form>
</body>
</html>
 
 
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
 
public partial class _Default : System.Web.UI.Page
{
  //=========================================================
  // Page_Load()
  //=========================================================
  protected void Page_Load(object sender, EventArgs e)
  {
 
  }
 
  //=========================================================
  // btnPostBack_Click()
  //=========================================================
  protected void btnPostBack_Click(object sender, EventArgs e)
  {
 
  }
 
  //=========================================================
  // btnHide1_Click()
  //=========================================================
  protected void btnHide1_Click(object sender, EventArgs e)
  {
    tr_field1.Visible = false;
  }
 
  //=========================================================
  // btnHide2_Click()
  //=========================================================
  protected void btnHide2_Click(object sender, EventArgs e)
  {
    tr_field2.Visible = false;
  }
 
  //=========================================================
  // btnShowAll_Click()
  //=========================================================
  protected void btnShowAll_Click(object sender, EventArgs e)
  {
    tr_field1.Visible = true;
    tr_field2.Visible = true;
  }
}
[+][-]07.23.2008 at 11:57PM PDT, ID: 22076613

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Asynchronous Javascript and XML (AJAX), C# Programming Language, Programming for ASP.NET
Sign Up Now!
Solution Provided By: NazoUK
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10.03.2008 at 11:27AM PDT, ID: 22636615

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628