Validator in Footer Causing Javascript Error (with ShowFooter)


Chris S

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:

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

Code Behind snippet:

protected void BindGrid()
//Set each grid's datasource and bind to it

//If we are showing a custom version of the form, then allow
editing/adding/deleting of values
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
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

Any ideas?


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