Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Validator in Footer Causing Javascript Error (with ShowFooter)

Reply
Thread Tools

Validator in Footer Causing Javascript Error (with ShowFooter)

 
 
Chris S
Guest
Posts: n/a
 
      04-06-2006
I am going crazy trying to figure this out, and I am wondering if this is a
bug in the ASP.Net 1.1 implementation.

My situation:

I have an ASPX page with 2 different modes:

*Mode 1: Datagrid with no footer
*Mode 2: Datagrid with a footer template containing a textbox and an "Add
Record" command (also has an edit column)

Everything works fine until I put a RequiredFieldValidator in the
FooterTemplate. Doing so causes the following Javascript error:
'Page_Validators' is undefined. I believe this is happening because I am
dynamically showing / hiding the footer in my code-behind, depending on a
selected dropdown value within the page.

Is there a workaround / solution for this?

Footer Template snippet:

<FooterTemplate>
<asp:LinkButton CommandName="AddNewRecord" Text="Add Custom Threshold"
ID="lnkAddThreshold" Runat="server"/>
<asp:RequiredFieldValidator ID="reqDdThresholdUpperAddNew"
ControlToValidate="txtDdThresholdUpperAddNew" ErrorMessage="Please enter a
value" Display="Dynamic" Visible="True" Runat="server"/>
</FooterTemplate>

Code Behind snippet:

protected void BindGrid()
{
//Set each grid's datasource and bind to it
dgDDThresholdData.DataSource=DataAccess.clsCommonA ccess.getDBValues();
dgDDThresholdData.DataBind();

//If we are showing a custom version of the form, then allow
editing/adding/deleting of values
if(Convert.ToInt32(intThresholdTypeID)==2)
{
dgDDThresholdData.Columns[6].Visible=true; //show the edit column
dgDDThresholdData.Columns[7].Visible=true; //show the delete column
dgDDThresholdData.ShowFooter = true; //show the footer (add new
record)
}
else
{
dgDDThresholdData.Columns[6].Visible=false; //hide the edit column
dgDDThresholdData.Columns[7].Visible=false; //hide the delete column
dgDDThresholdData.ShowFooter = false; //hide the footer (add new
record)
}
}


Any ideas?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts Validator - creditCard validator smrimell@gmail.com Java 4 02-13-2007 08:32 PM
Any way to reorder how a datagrid is drawn (header/footer/items vs.header/items/footer)? Henrik ASP .Net Datagrid Control 1 07-06-2006 12:23 AM
W3C html validator flags error in javascript xyZed HTML 4 03-27-2006 04:54 PM
validator causing password prompt to popup =?Utf-8?B?SnVzdGlu?= ASP .Net 1 10-09-2004 03:37 AM
Button in footer of datagrid not causing itemcommand event? Utter Newbie ASP .Net 3 10-05-2004 08:32 PM



Advertisments
 



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