Validate form  
Author Message
iomosaic





PostPosted: Sat Nov 13 02:01:36 CST 2004 Top

ASP.Net >> Validate form

Hello,

I am learning asp.net and i have experience in asp. I am using VS.NET for
developing dotNET pages.
Its login form. I placed two asp:textbox s for userid and password. and one
button(html server control) and one asp:label

How to vallidate whether the user has entered userid and password or not. If
not display an error message in the label. And also placed a button(html
server control) to redirect to my home page.
I wrote the code response.redirect("default.htm")
But its not redirecting. In the submit button also i wrote the code

private sub button2_serverClick(ByVal sender as System.object,ByVal e as
System.EventArgs)
if txtUID.value="" then
errlbl.text="Enter User ID"
end if
end sub

Can u explain me how to do this. I tried with requiredfieldvalidator control
also. If i click home button also its checking for errors and not performing
actual action(redirect to home page).


Thanx in advance

Web Programming131  
 
 
Patrick





PostPosted: Sat Nov 13 02:01:36 CST 2004 Top

ASP.Net >> Validate form Make sure u have CausesValidation="False" in ur button
Btw go to :- http://samples.gotdotnet.com/quickstart/aspplus/
And read through :- Server Control Form Validation
Hope this helps!!






> Hello,
>
> I am learning asp.net and i have experience in asp. I am using VS.NET
for
> developing dotNET pages.
> Its login form. I placed two asp:textbox s for userid and password. and
one
> button(html server control) and one asp:label
>
> How to vallidate whether the user has entered userid and password or not.
If
> not display an error message in the label. And also placed a button(html
> server control) to redirect to my home page.
> I wrote the code response.redirect("default.htm")
> But its not redirecting. In the submit button also i wrote the code
>
> private sub button2_serverClick(ByVal sender as System.object,ByVal e as
> System.EventArgs)
> if txtUID.value="" then
> errlbl.text="Enter User ID"
> end if
> end sub
>
> Can u explain me how to do this. I tried with requiredfieldvalidator
control
> also. If i click home button also its checking for errors and not
performing
> actual action(redirect to home page).
>
>
> Thanx in advance