473,387 Members | 3,820 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.

Validating Dynamically Loaded User Controls

I have a ASPX page that loads a custom control. This first custom
control is made up of 2 textboxes and a Submit button. The user enters
data into the form, presses the Submit button and the ASPX page should
either load a new custom control during the postback or (if validation
fails) reload the first custom control. I've attached some validation
controls without a problem but the client-side validation doesn't seem
to be working...even in IE with Javascript enabled.

Does anyone have any suggestions? Thanks!

Nov 19 '05 #1
4 2016
ASP.NET pages expect you to create the same list of controls on post back
that you sent to the browser originally. This allows the post back code
distribute the data to those controls and fire their events (including
Click, TextChanged, and validation). It sounds like you aren't setting
things up the same on each pass.

I recommend this:
Load both UserControls. Change their Visibility. On the first pass,
UserControl 2 should be invisible. On the second pass, during the Click even
method, first test that validation was OK (Page.IsValid=true), then change
the visibility of these Usercontrols.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

<br********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a ASPX page that loads a custom control. This first custom
control is made up of 2 textboxes and a Submit button. The user enters
data into the form, presses the Submit button and the ASPX page should
either load a new custom control during the postback or (if validation
fails) reload the first custom control. I've attached some validation
controls without a problem but the client-side validation doesn't seem
to be working...even in IE with Javascript enabled.

Does anyone have any suggestions? Thanks!

Nov 19 '05 #2
I don't think that'd work out too well in this case as the first page
(or control view, really) displays a form that prompts the user for
input parameters (i.e., "Select a year", etc.). After postback and
validation, I'd like to use a second control to create a user-specific
report based on the input parameters.

I don't know...maybe I need to rethink the site architecture.

Nov 19 '05 #3
sam
I'd check the span tag or whatever html is created for the validators
and make sure their controltovalidate ID values match the textbox ID
values. If you are adding controls too late or and setting IDs on them
manually it could screw this up.

Bascially you can debug the validation javascript yourself and see
where its stopping. Its not that hard. Put a breakpoint in
Page_ClientValidate (in WebUIValidation.js in c:\Inetpub\...) and
follow it urself. Also make sure that the call to Page_ClientValidatie
is being executed in the submit button onclick handler or wherever it
is in the html page.

Sorry I don't have exact details but its kindof late :). You can debug
this yourself i've done it many times.

-Sam Robertson

Nov 19 '05 #4
I'll give it a shot. Thanks for the info!

Nov 19 '05 #5

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

Similar topics

7
by: Tim T | last post by:
Hi, I have the need to use dynamically loaded user controls in a webform page. I have the controls loading dynamically, and that part works fine. this is the code used in a webform to dynamically...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
1
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the...
1
by: Josh | last post by:
Hi Guys, I have been having a big problem with trying to pass parameters into a user control when the user control is dynamically loaded into a placholder. I am developing in c#. I have get...
3
by: Guadala Harry | last post by:
I have this scenario: ASPX Page dynamically loads userControl1 - which in turn dynamically loads userControl2. UserControl2 contains a TextBox Web Server control. When a user clicks a button in...
4
by: Harry | last post by:
Hello, I have a page with a RadioButtonList and a PlaceHolder control. The RadioButtonList's AutoPostBack attribute is set to TRUE and its SelectedIndexChanged event loads one of three...
0
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
2
by: A.Wussow | last post by:
Hi Everybody, i want to load dynamically content from some user controls (with forms, or some data-controls) using atlas. So i use an UpdatePanel for loading the user control into a placeholder....
1
by: Christian Resma Helle | last post by:
Hey guys, I'm working on an AJAX Enabled ASP.NET Web application. I have a TreeView web control and an PlaceHolder web control. My PlaceHolder is inside an UpdatePanel and AsyncPostBacks are...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.