473,387 Members | 3,750 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,387 software developers and data experts.

Hidden Validators Cause Javascript Error

I am going crazy trying to figure this out, and I am wondering if this is a
bug in the ASP.Net 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?
Apr 5 '06 #1
0 1168

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Christian H | last post by:
Based on the content in my database, I need to populate different form controls and validators, such as textbox, dropdownlist, requiredfieldvalidators , etc. Then I need to check if the form has...
1
by: cksj | last post by:
I have a button that will trigger validators. In one special case, I have to show a message box when the button is clicked. In the code behind, I added the following: ...
4
by: Ian Cox | last post by:
I have a web form that contains a Datagrid. This grid has a number of columns, one of which contains a text box and validator for that text box. Everything works fine, when I press the "Save"...
2
by: Axel Dahmen | last post by:
Hi, I've added a couple of validators to my page. Now I get a couple of Runtime Errors when I load the page (I have "Show client-script errors" enabled in IE6): "A Runtime Error has occurred....
2
by: Mike Surcouf | last post by:
Hi I have some regex validators on my page set to dynamic and like the way they appear after you tab out of a field and also when you try to postback the form. All OK so far When I register...
3
by: rgparkins | last post by:
Hi I am currently having problems with Validators in a user control. I am creating a wizard sign-up process which have the allocated step (hyperlinks" at the top of the page. A user can also...
4
by: reikoshea | last post by:
okay ive been working at this for probably 4 hours now, and I (not to mention my boss) am pretty upset. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head>...
8
by: ShaneFowlkes | last post by:
For some reason, my validator controls stopped working when a form posts. They seems to work on fields that lose focus but if I submit a form with all empty fields, not of the required validators...
2
by: Alec MacLean | last post by:
Hi, I have a page using AJAX. The page has three modal popups that work fine when I don't have field validators in place. As soon as I put a validator in place, the popup "form" the validator...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.