Hello,
I am trying to create a form dynamically. A very simple form with a textbox,
requiredvalidator and button.
Everything works fine on IE, but no server side validation occurs which
means the requiredfieldvalidator is ignored when using Netscape.
The code logic is:
'Declare a an html form i.e
Dim objForm As New HtmlForm
objForm.Attributes.Add("RunAt", "Server")
Create a table, tablerow and tablecell
Add a textbox and requirefieldvalidator to a cell
Add the cell to the row
Add the row to the table
Add a button to the table
Add the table to the form
Add the form to a placeholder control on the web page
Is there something I am missing? I tried adding the requiredfieldvalidator
control to the validators collection of the page, ie
Me.Validators.Add(validatorcontrol)
as described in http://forums.asp.net/577243/ShowPost.aspx but that makes no
difference.
I have switched off clientside validation and get the same result in IE.
Is there something simple I am missing or do I really need to take a serious
look at creating user controls in asp.net?
Best Regards,
Steve Bugden 5 1287
At which stage of the page's lifecycle are you adding your form? Dynamically
added controls need to be added during the Page.Init stage to maintian their
ViewState upon postback.
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Steve Bugden" wrote: Hello,
I am trying to create a form dynamically. A very simple form with a textbox, requiredvalidator and button.
Everything works fine on IE, but no server side validation occurs which means the requiredfieldvalidator is ignored when using Netscape.
The code logic is:
'Declare a an html form i.e Dim objForm As New HtmlForm objForm.Attributes.Add("RunAt", "Server")
Create a table, tablerow and tablecell
Add a textbox and requirefieldvalidator to a cell Add the cell to the row Add the row to the table Add a button to the table Add the table to the form Add the form to a placeholder control on the web page
Is there something I am missing? I tried adding the requiredfieldvalidator control to the validators collection of the page, ie Me.Validators.Add(validatorcontrol) as described in http://forums.asp.net/577243/ShowPost.aspx but that makes no difference.
I have switched off clientside validation and get the same result in IE.
Is there something simple I am missing or do I really need to take a serious look at creating user controls in asp.net?
Best Regards,
Steve Bugden
Hi Phillip,
Thanks for the reply.
I moved the dynamically added controls from teh page_load event to the
Page_Init event and it now works fine. ie the requiredfieldvvalidator kicks
in if a required field is missing.
But I would also like to display a simple user message (rather than the
form), if the form is valid. On the postback, in the Page_Init event after
calling Me.Page.Validate, Me.Page.IsValid is set true, (Although this works
correctly in the page_load event)
How can I stop the form displaying if the it is valid?
Best Regards,
Steve
"Phillip Williams" wrote: At which stage of the page's lifecycle are you adding your form? Dynamically added controls need to be added during the Page.Init stage to maintian their ViewState upon postback. -- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Steve Bugden" wrote:
Hello,
I am trying to create a form dynamically. A very simple form with a textbox, requiredvalidator and button.
Everything works fine on IE, but no server side validation occurs which means the requiredfieldvalidator is ignored when using Netscape.
The code logic is:
'Declare a an html form i.e Dim objForm As New HtmlForm objForm.Attributes.Add("RunAt", "Server")
Create a table, tablerow and tablecell
Add a textbox and requirefieldvalidator to a cell Add the cell to the row Add the row to the table Add a button to the table Add the table to the form Add the form to a placeholder control on the web page
Is there something I am missing? I tried adding the requiredfieldvalidator control to the validators collection of the page, ie Me.Validators.Add(validatorcontrol) as described in http://forums.asp.net/577243/ShowPost.aspx but that makes no difference.
I have switched off clientside validation and get the same result in IE.
Is there something simple I am missing or do I really need to take a serious look at creating user controls in asp.net?
Best Regards,
Steve Bugden
Hi Phillip,
Sorry for such a stupid question, I just cleared the placeholder in the
page_load event if the form is valid.
Thanks once again for you help,
Steve Bugden.
"Steve Bugden" wrote: Hi Phillip,
Thanks for the reply.
I moved the dynamically added controls from teh page_load event to the Page_Init event and it now works fine. ie the requiredfieldvvalidator kicks in if a required field is missing.
But I would also like to display a simple user message (rather than the form), if the form is valid. On the postback, in the Page_Init event after calling Me.Page.Validate, Me.Page.IsValid is set true, (Although this works correctly in the page_load event)
How can I stop the form displaying if the it is valid?
Best Regards,
Steve
"Phillip Williams" wrote:
At which stage of the page's lifecycle are you adding your form? Dynamically added controls need to be added during the Page.Init stage to maintian their ViewState upon postback. -- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Steve Bugden" wrote:
Hello,
I am trying to create a form dynamically. A very simple form with a textbox, requiredvalidator and button.
Everything works fine on IE, but no server side validation occurs which means the requiredfieldvalidator is ignored when using Netscape.
The code logic is:
'Declare a an html form i.e Dim objForm As New HtmlForm objForm.Attributes.Add("RunAt", "Server")
Create a table, tablerow and tablecell
Add a textbox and requirefieldvalidator to a cell Add the cell to the row Add the row to the table Add a button to the table Add the table to the form Add the form to a placeholder control on the web page
Is there something I am missing? I tried adding the requiredfieldvalidator control to the validators collection of the page, ie Me.Validators.Add(validatorcontrol) as described in http://forums.asp.net/577243/ShowPost.aspx but that makes no difference.
I have switched off clientside validation and get the same result in IE.
Is there something simple I am missing or do I really need to take a serious look at creating user controls in asp.net?
Best Regards,
Steve Bugden
You are welcome, Steve.
--
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Steve Bugden" wrote: Hi Phillip,
Sorry for such a stupid question, I just cleared the placeholder in the page_load event if the form is valid.
Thanks once again for you help,
Steve Bugden.
"Steve Bugden" wrote:
Hi Phillip,
Thanks for the reply.
I moved the dynamically added controls from teh page_load event to the Page_Init event and it now works fine. ie the requiredfieldvvalidator kicks in if a required field is missing.
But I would also like to display a simple user message (rather than the form), if the form is valid. On the postback, in the Page_Init event after calling Me.Page.Validate, Me.Page.IsValid is set true, (Although this works correctly in the page_load event)
How can I stop the form displaying if the it is valid?
Best Regards,
Steve
"Phillip Williams" wrote:
At which stage of the page's lifecycle are you adding your form? Dynamically added controls need to be added during the Page.Init stage to maintian their ViewState upon postback. -- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Steve Bugden" wrote:
> Hello, > > I am trying to create a form dynamically. A very simple form with a textbox, > requiredvalidator and button. > > Everything works fine on IE, but no server side validation occurs which > means the requiredfieldvalidator is ignored when using Netscape. > > The code logic is: > > 'Declare a an html form i.e > Dim objForm As New HtmlForm > objForm.Attributes.Add("RunAt", "Server") > > Create a table, tablerow and tablecell > > Add a textbox and requirefieldvalidator to a cell > Add the cell to the row > Add the row to the table > Add a button to the table > Add the table to the form > Add the form to a placeholder control on the web page > > Is there something I am missing? I tried adding the requiredfieldvalidator > control to the validators collection of the page, ie > Me.Validators.Add(validatorcontrol) > as described in http://forums.asp.net/577243/ShowPost.aspx but that makes no > difference. > > I have switched off clientside validation and get the same result in IE. > > Is there something simple I am missing or do I really need to take a serious > look at creating user controls in asp.net? > > Best Regards, > > Steve Bugden
Which version of the framework are you using?
Bye
Andrea This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Venus |
last post by:
Hello,
Thanks for your reply.
I understand that a control can be created dynamically in several ways:
1) using StringBuilder
2) using Controls.Add
3) using ASP PlaceHolder
But this is just...
|
by: Venus |
last post by:
Hello,
After trying some ways to do it I wanted to use something like the code
below but for some reason
is not working (I have to generate the entire form dynamically (not only the
controls)):...
|
by: Brian Shannon |
last post by:
I have 3 combo boxes and two date text boxes on a .aspx page. The user can
fill in any of the 5 controls or none to filter a datagrid. I was hoping
someone could explain how to efficiently build...
|
by: Abraham Luna |
last post by:
how do i stop the dynamic validators from breaking explorer
if i use a dynamic validator and move to a different control it breaks
explorer and i can type in the page when i'm not supposed to....
|
by: dawg1998 |
last post by:
I have a page that creates dynamic textboxes based on the number of
fields a user chooses to fill out.
This process worked great when the page was standalone. However, when I
move to a...
|
by: easoftware |
last post by:
I am using VS .Net 2003 and VB. I have an app with one parent and two
Mdi child forms. I need to validate data in the Mdi form. The
Form.Validating event works when I try to close a Mdi form,...
|
by: Chris |
last post by:
Hi,
I have a form for uploading documents and inserting the data into a mysql
db. I would like to validate the form. I have tried a couple of Javascript
form validation functions, but it...
|
by: gau.tai |
last post by:
I have a form in which I am generating dynamic fields. I can do this
fine, but when I go to validate them there are errors. The non-
dynamic fields validate correctly. Below is the html and js. ...
|
by: zacks |
last post by:
I have a .NET 2.0 MDI application where the child form has a Tab
Control. Each of the Tab in the Tab Control has a Validating event to
handle what it should do when the user changes tabs.
But...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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: 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...
| |