473,396 Members | 1,773 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,396 software developers and data experts.

Validation in User Controls used with Master Pages

Hi,
In my ASP.NET 2.0 web app, I have a user control, ucBinEdges, with several
text boxes. The user control has several validation controls validating the
Text of these text boxes - CompareValidator, RangeValidator,
RequiredFieldValidator, and a ValidationSummary. The page using ucBinEdges
is a content page working in conjunction with a master page. The master page
defines two ContentPlaceHolders: cphLeftNav and cphReportContent. ucBinEdges
is placed in cphLeftNav. The other content area, cphReportContent, contains
a bunch of other ASP.NET controls.

There are several problems:

1. After adding the validation controls to ucBinEdges, the contents of
cphReportContent do not render to the browser. However, if I add
EnableClientScript="false" to each of the validation controls, everything
displays correctly. Of course, now the validation does not occur
client-side, but only on a postback.

2. Living with only server-side validation for the moment, the validation
occurs *after* the user control Page_Load and TextBox TextChanged event
handlers are fired. This means that code which depends on valid values blows
up. For example, the following line raises an exception if the the Text
property is "abc":
AmountBinMin = Convert.ToInt32(txtMin.Text)

3. OK, so I wrapped the potentially offending lines in a try block, an
inelegant hack at best. Now the validation works fine. Except I am back to
the problem where the contents of cphReportContent do not display when the
page posts back.

4. Finally, if the user corrects the invalid value in the text box and
clicks on a button in cphLeftNav, the following exception is raised:
Invalid postback or callback argument. ... blah blah blah ... use the
ClientScriptManager.RegistserForEventValidation method in order to register
the postback or callback for data validation.

Anybody know what is going on here? It seems the best solution would be to
get the client-side validation working. Failing that, I will probably have
to remove the validation controls entirely and do the data validation myself.

Thanks for any suggestions.

Dan
Sep 8 '06 #1
0 1689

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

Similar topics

10
by: George G. | last post by:
Hi there, I am busy writing a new asp.net application and I am reusing some of my existing asp functions and methods in a user control. I need access to session, request and response in some of...
4
by: AIM48 | last post by:
Hi. We have a framework that we work with for our project. So far we have had very good success – basically the frame work wraps many day to day tasks so that they are all included in the...
20
by: Alan Silver | last post by:
Hello, In classic ASP, I used to use two include files on each page, one before and one after the main content, to provide a consistent layout across a web site. That way I could just change the...
3
by: ilockett | last post by:
The background: I have a web app with a simple master page that contains just one content placeholder. I have created a web form that then uses this master page. Within the content...
1
by: Rob R. Ainscough | last post by:
I'm running into a problem with Master Pages. I have some "absolute" controls (labels, textboxes) that I position on the page using: ControlObject.Style.Add("Top", "250") or ...
1
by: | last post by:
Hey all! I'm new to 2.0. I use user controls, and since 99% of browsers have css now, I use absolute positioning to place my user controls.(Top banners, menus on the left side etc). In my case,...
9
by: J055 | last post by:
Hi I have a standard asp page which uses a MasterPage. The MasterPage contains a User control. How can I access a public method in the User control from my WebForm page? I can't move the method...
0
by: robgallen | last post by:
I have 2 user controls within a master page, and I would like one of them to call a function in the other. All the examples I have seen involve a page communicating with the Master page, or with...
10
by: Cirene | last post by:
I know that sometimes referring to controls deep in a page using a Master Page can be funky. For a website using a standard header/footer/nav, do you prefer using User Controls for the common...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
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...

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.