472,354 Members | 1,450 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Page Validation and Submit problems in ASP.NET

Hi,

I am creating a simple .aspx page to add some fields with validation.

I have used different .NET validations like REquiredFieldValidator,
RegularExpressionValidator and showed the summary in the bulleted list
on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons. One
for Submit, Reset and Exit.

If submit is pressed page should be validated and submit (insert into
DB) , Reset- page shoule be re-loaded, Exit - go to next page.

I have tried many options and i don't know which way is the best one.

a) when i submit the page .. all validatations are working perfect, but
how should i reset the page ? (again it is doing all the validations ).
I have used javascript too but for that i remove <%@ Page Language="vb"
AutoEventWireup="false" Codebehind="AddUsers.aspx.vb"%> then only it
works. But i have to use code behind and if remove this line for sake of
JS i cannot use code behind.

b) then i thought of using my own validations in function and for that i
believe if i use <asp:textbox and on click if of submit if i write
txtFullName.value does not work .. again i need to change every tag to
input type .. is this the only way.

Please suggest me the best way.

Code I am using is as follows :-
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="AddUsers.aspx.vb"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Sub SubmitBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Submit")
End Sub

Sub ResetBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Reset")

End Sub

</script>
<title>AddModSysUsers</title>
<link href="incStyles.css" rel="stylesheet">
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table border="1" cellpadding="0" cellspacing="4" width="100%"
align="center">
<tr>
<td colspan="2" class="clsFont" align="middle">
<asp:panel runat="server" id="ValidationPanel" visible="false">
<asp:ValidationSummary ID="validSummary" runat="server"
HeaderText="Check the following fields:" DisplayMode="BulletList" />
</asp:Panel>
</td>
</tr>
<tr>
<td colspan="2" align="middle" class="clsFont" height="30">
<font color="red">*</font>&nbsp;<B>Required</B>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>Full Name(last, first) :</B>
&nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtFullName" runat="server" Columns="30"
MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidateFullName"
ControlToValidate="txtFullName" ErrorMessage="Full Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>User Name (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtUserName" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="validateUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name Should be in
8-15 Characters." ValidationExpression=".{8,15}" Display="None"
runat="server"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Password (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtPassword" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidatePassword"
ControlToValidate="txtPassword" ErrorMessage="Password must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegPassword" runat="server"
ControlToValidate="txtPassword" ErrorMessage="Password Should be in 8-15
Characters." ValidationExpression=".{8,15}"
Display="None"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>User Level :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radUserLevel" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>General</asp:ListItem>
<asp:ListItem>Omega</asp:ListItem>
<asp:ListItem>Super</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateUserLevel" runat="server"
ControlToValidate="radUserLevel" ErrorMessage="User Level must be
selected. " Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Status :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radStatus" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>Active&nbsp;&nbsp;</asp:ListItem>
<asp:ListItem>Inactive</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateStatus" runat="server"
ControlToValidate="radStatus" ErrorMessage="Status must be selected. "
Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td align="middle" colspan="2">
&nbsp;&nbsp;
<asp:Button id="btnSubmit" Runat="server" text="Submit" OnClick =
"SubmitBtn_Click"></asp:Button>
&nbsp;&nbsp;
<asp:Button id="btnReset" runat="server" text="Reset" OnClick =
"ResetBtn_Click" ></asp:Button>
&nbsp;&nbsp;
<input type = "reset" id="Button1" runat="server" value="reset">
&nbsp;&nbsp;
<asp:Button id="btnExit" Runat="server" text="Exit Without
Saving"></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
3 2500
i had a similar issue when i was doing some stuff earlier.... i just moved
to server validation only...
but i know its not a perfect solution... here is what i am going to try
use registerclientscriptblock to register a javascript funcation say
'CancelMe( )'
all it does is history.back( )
and associate that function with onclick on the cancel button.
The problem is that we get so used to server side handling of events that we
forget the basic thing... ie client side validation is executed when you
post that form.... no matter what... ie if you want to cancel something...
dont try to submit the form... rather just bypass it...

hope this help....

HD

PS: Just gave it a try and it works... though instead of LinkButton you have
to settle for Hyperlink object

on aspx page
<td colspan="3">
<asp:LinkButton id="lnkUpdate"
runat="server">Update</asp:LinkButton>&nbsp;&nbsp;
<asp:HyperLink id="lnkCancel" onclick='CancelMe();' runat="server"
NavigateUrl="#">Cancel</asp:HyperLink>
</td>

in code behind .cs file within Page

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
// Form the script that is to be registered at client side.
String scriptString = "<script language=JavaScript> function CancelMe()
{";
scriptString += "window.history.back(); }</script>";

if(!this.IsClientScriptBlockRegistered("clientScri ptCancel"))
this.RegisterClientScriptBlock("clientScriptCancel ", scriptString);

if(!Page.IsPostBack)
...............
"Arun K" <ar**@devx.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I am creating a simple .aspx page to add some fields with validation.

I have used different .NET validations like REquiredFieldValidator,
RegularExpressionValidator and showed the summary in the bulleted list
on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons. One
for Submit, Reset and Exit.

If submit is pressed page should be validated and submit (insert into
DB) , Reset- page shoule be re-loaded, Exit - go to next page.

I have tried many options and i don't know which way is the best one.

a) when i submit the page .. all validatations are working perfect, but
how should i reset the page ? (again it is doing all the validations ).
I have used javascript too but for that i remove <%@ Page Language="vb"
AutoEventWireup="false" Codebehind="AddUsers.aspx.vb"%> then only it
works. But i have to use code behind and if remove this line for sake of
JS i cannot use code behind.

b) then i thought of using my own validations in function and for that i
believe if i use <asp:textbox and on click if of submit if i write
txtFullName.value does not work .. again i need to change every tag to
input type .. is this the only way.

Please suggest me the best way.

Code I am using is as follows :-
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="AddUsers.aspx.vb"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Sub SubmitBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Submit")
End Sub

Sub ResetBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Reset")

End Sub

</script>
<title>AddModSysUsers</title>
<link href="incStyles.css" rel="stylesheet">
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table border="1" cellpadding="0" cellspacing="4" width="100%"
align="center">
<tr>
<td colspan="2" class="clsFont" align="middle">
<asp:panel runat="server" id="ValidationPanel" visible="false">
<asp:ValidationSummary ID="validSummary" runat="server"
HeaderText="Check the following fields:" DisplayMode="BulletList" />
</asp:Panel>
</td>
</tr>
<tr>
<td colspan="2" align="middle" class="clsFont" height="30">
<font color="red">*</font>&nbsp;<B>Required</B>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>Full Name(last, first) :</B>
&nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtFullName" runat="server" Columns="30"
MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidateFullName"
ControlToValidate="txtFullName" ErrorMessage="Full Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>User Name (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtUserName" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="validateUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name Should be in
8-15 Characters." ValidationExpression=".{8,15}" Display="None"
runat="server"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Password (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtPassword" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidatePassword"
ControlToValidate="txtPassword" ErrorMessage="Password must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegPassword" runat="server"
ControlToValidate="txtPassword" ErrorMessage="Password Should be in 8-15
Characters." ValidationExpression=".{8,15}"
Display="None"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>User Level :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radUserLevel" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>General</asp:ListItem>
<asp:ListItem>Omega</asp:ListItem>
<asp:ListItem>Super</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateUserLevel" runat="server"
ControlToValidate="radUserLevel" ErrorMessage="User Level must be
selected. " Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Status :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radStatus" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>Active&nbsp;&nbsp;</asp:ListItem>
<asp:ListItem>Inactive</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateStatus" runat="server"
ControlToValidate="radStatus" ErrorMessage="Status must be selected. "
Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td align="middle" colspan="2">
&nbsp;&nbsp;
<asp:Button id="btnSubmit" Runat="server" text="Submit" OnClick =
"SubmitBtn_Click"></asp:Button>
&nbsp;&nbsp;
<asp:Button id="btnReset" runat="server" text="Reset" OnClick =
"ResetBtn_Click" ></asp:Button>
&nbsp;&nbsp;
<input type = "reset" id="Button1" runat="server" value="reset">
&nbsp;&nbsp;
<asp:Button id="btnExit" Runat="server" text="Exit Without
Saving"></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
If I understand you correctly, you are attempting to allow validation when
the Submit button is pressed but prevent it when Reset or Exit are pressed.
Buttons have a property called CausesValidation. Set it to false on the
Reset and Exit buttons.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com

"Arun K" <ar**@devx.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I am creating a simple .aspx page to add some fields with validation.

I have used different .NET validations like REquiredFieldValidator,
RegularExpressionValidator and showed the summary in the bulleted list
on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons. One
for Submit, Reset and Exit.

If submit is pressed page should be validated and submit (insert into
DB) , Reset- page shoule be re-loaded, Exit - go to next page.

I have tried many options and i don't know which way is the best one.

a) when i submit the page .. all validatations are working perfect, but
how should i reset the page ? (again it is doing all the validations ).
I have used javascript too but for that i remove <%@ Page Language="vb"
AutoEventWireup="false" Codebehind="AddUsers.aspx.vb"%> then only it
works. But i have to use code behind and if remove this line for sake of
JS i cannot use code behind.

b) then i thought of using my own validations in function and for that i
believe if i use <asp:textbox and on click if of submit if i write
txtFullName.value does not work .. again i need to change every tag to
input type .. is this the only way.

Please suggest me the best way.

Code I am using is as follows :-
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="AddUsers.aspx.vb"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Sub SubmitBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Submit")
End Sub

Sub ResetBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Reset")

End Sub

</script>
<title>AddModSysUsers</title>
<link href="incStyles.css" rel="stylesheet">
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table border="1" cellpadding="0" cellspacing="4" width="100%"
align="center">
<tr>
<td colspan="2" class="clsFont" align="middle">
<asp:panel runat="server" id="ValidationPanel" visible="false">
<asp:ValidationSummary ID="validSummary" runat="server"
HeaderText="Check the following fields:" DisplayMode="BulletList" />
</asp:Panel>
</td>
</tr>
<tr>
<td colspan="2" align="middle" class="clsFont" height="30">
<font color="red">*</font>&nbsp;<B>Required</B>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>Full Name(last, first) :</B>
&nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtFullName" runat="server" Columns="30"
MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidateFullName"
ControlToValidate="txtFullName" ErrorMessage="Full Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>User Name (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtUserName" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="validateUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name Should be in
8-15 Characters." ValidationExpression=".{8,15}" Display="None"
runat="server"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Password (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtPassword" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidatePassword"
ControlToValidate="txtPassword" ErrorMessage="Password must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegPassword" runat="server"
ControlToValidate="txtPassword" ErrorMessage="Password Should be in 8-15
Characters." ValidationExpression=".{8,15}"
Display="None"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>User Level :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radUserLevel" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>General</asp:ListItem>
<asp:ListItem>Omega</asp:ListItem>
<asp:ListItem>Super</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateUserLevel" runat="server"
ControlToValidate="radUserLevel" ErrorMessage="User Level must be
selected. " Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Status :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radStatus" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>Active&nbsp;&nbsp;</asp:ListItem>
<asp:ListItem>Inactive</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateStatus" runat="server"
ControlToValidate="radStatus" ErrorMessage="Status must be selected. "
Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td align="middle" colspan="2">
&nbsp;&nbsp;
<asp:Button id="btnSubmit" Runat="server" text="Submit" OnClick =
"SubmitBtn_Click"></asp:Button>
&nbsp;&nbsp;
<asp:Button id="btnReset" runat="server" text="Reset" OnClick =
"ResetBtn_Click" ></asp:Button>
&nbsp;&nbsp;
<input type = "reset" id="Button1" runat="server" value="reset">
&nbsp;&nbsp;
<asp:Button id="btnExit" Runat="server" text="Exit Without
Saving"></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3
Hello Peter,

Thanks.... very useful...

--
Regards,

HD

"Peter Blum" <PL****@Blum.info> wrote in message
news:u0**************@TK2MSFTNGP12.phx.gbl...
If I understand you correctly, you are attempting to allow validation when
the Submit button is pressed but prevent it when Reset or Exit are pressed. Buttons have a property called CausesValidation. Set it to false on the
Reset and Exit buttons.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com

"Arun K" <ar**@devx.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I am creating a simple .aspx page to add some fields with validation.

I have used different .NET validations like REquiredFieldValidator,
RegularExpressionValidator and showed the summary in the bulleted list
on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons. One
for Submit, Reset and Exit.

If submit is pressed page should be validated and submit (insert into
DB) , Reset- page shoule be re-loaded, Exit - go to next page.

I have tried many options and i don't know which way is the best one.

a) when i submit the page .. all validatations are working perfect, but
how should i reset the page ? (again it is doing all the validations ).
I have used javascript too but for that i remove <%@ Page Language="vb"
AutoEventWireup="false" Codebehind="AddUsers.aspx.vb"%> then only it
works. But i have to use code behind and if remove this line for sake of
JS i cannot use code behind.

b) then i thought of using my own validations in function and for that i
believe if i use <asp:textbox and on click if of submit if i write
txtFullName.value does not work .. again i need to change every tag to
input type .. is this the only way.

Please suggest me the best way.

Code I am using is as follows :-
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="AddUsers.aspx.vb"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Sub SubmitBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Submit")
End Sub

Sub ResetBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Reset")

End Sub

</script>
<title>AddModSysUsers</title>
<link href="incStyles.css" rel="stylesheet">
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table border="1" cellpadding="0" cellspacing="4" width="100%"
align="center">
<tr>
<td colspan="2" class="clsFont" align="middle">
<asp:panel runat="server" id="ValidationPanel" visible="false">
<asp:ValidationSummary ID="validSummary" runat="server"
HeaderText="Check the following fields:" DisplayMode="BulletList" />
</asp:Panel>
</td>
</tr>
<tr>
<td colspan="2" align="middle" class="clsFont" height="30">
<font color="red">*</font>&nbsp;<B>Required</B>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>Full Name(last, first) :</B>
&nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtFullName" runat="server" Columns="30"
MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidateFullName"
ControlToValidate="txtFullName" ErrorMessage="Full Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>User Name (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtUserName" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="validateUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name Should be in
8-15 Characters." ValidationExpression=".{8,15}" Display="None"
runat="server"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Password (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtPassword" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidatePassword"
ControlToValidate="txtPassword" ErrorMessage="Password must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegPassword" runat="server"
ControlToValidate="txtPassword" ErrorMessage="Password Should be in 8-15
Characters." ValidationExpression=".{8,15}"
Display="None"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>User Level :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radUserLevel" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>General</asp:ListItem>
<asp:ListItem>Omega</asp:ListItem>
<asp:ListItem>Super</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateUserLevel" runat="server"
ControlToValidate="radUserLevel" ErrorMessage="User Level must be
selected. " Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Status :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radStatus" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>Active&nbsp;&nbsp;</asp:ListItem>
<asp:ListItem>Inactive</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateStatus" runat="server"
ControlToValidate="radStatus" ErrorMessage="Status must be selected. "
Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td align="middle" colspan="2">
&nbsp;&nbsp;
<asp:Button id="btnSubmit" Runat="server" text="Submit" OnClick =
"SubmitBtn_Click"></asp:Button>
&nbsp;&nbsp;
<asp:Button id="btnReset" runat="server" text="Reset" OnClick =
"ResetBtn_Click" ></asp:Button>
&nbsp;&nbsp;
<input type = "reset" id="Button1" runat="server" value="reset">
&nbsp;&nbsp;
<asp:Button id="btnExit" Runat="server" text="Exit Without
Saving"></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #4

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

Similar topics

6
by: Abby Lee | last post by:
I have a for statement in my validation process I do a for loop becasue I don't know how many rows of items there are...I need to validate each item in each row. If I remove the...
10
by: Steve Benson | last post by:
Our regular programmer moved on. I'm almost clueless in Javascript/ASP and got the job of adapting existing code. In the page below, everything works until I added the function checkIt() to...
0
by: Niks | last post by:
Hi, I am creating a simple .aspx page to add some fields with validation. I have used different .NET validations like REquiredFieldValidator, RegularExpressionValidator and showed the summary...
7
by: ani | last post by:
I have two submit buttons in my form which need to validate two different controls on the page . How do I validate portions of the asp.net page. The two submit buttons should validate their...
1
by: Liz | last post by:
I have a page with several dropdownlists, several text boxes and several buttons which perform calculations. I need to validate one dropdownlist (not the whole page) with the click of one button. I...
4
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are...
3
by: aljodo | last post by:
ASP.Net v1.1 & vb.net Hi all, I have a simple survey form with first name/last name text boxes at the top. I have validators on these text boxes to ensure that something is entered in them. ...
2
by: William Buchanan | last post by:
Hi folks Why are master pages such a pain? I have put a search text box and link button on my master page because I want it on all pages on my site. After lots of juggling with the different...
3
by: Ken Shimizu | last post by:
I get an error when submitting an .ASPX page in Safari beta, MAC and PC document.getElementbyId(‘FolderBrowser’).submit(); After the server side code has executed without problems I get the...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

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.