Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 30, 2012 11:11 AM by Chen Yu - MSFT
Member
19 Points
168 Posts
Dec 24, 2012 08:44 AM|LINK
Hi friends
I have one requirment
In my webform two texbox are there with default values
I want to put validation while update the T1 exicting text change need to put update textbox t2 value also is validation message
Please help me
Participant
1836 Points
583 Posts
Dec 24, 2012 09:02 AM|LINK
And use InitialValue property of your validator control to specify the default value should be consider as empty
<asp:TextBox ID="TextBox1" runat="server" Text="Default Text"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter your text" InitialValue="Default Text" ControlToValidate="TextBox1" ValidationGroup="sub"></asp:RequiredFieldValidator> <br /> <br /> <asp:TextBox ID="TextBox2" runat="server" Text="Default Text"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Enter your text" InitialValue="Default Text" ControlToValidate="TextBox2"></asp:RequiredFieldValidator> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Submit" ValidationGroup="sub" />
Dec 24, 2012 09:12 AM|LINK
Thank you for your reply Rima
but i want this validation through javascript
Star
7554 Points
1466 Posts
Dec 24, 2012 09:17 AM|LINK
Please check :-
http://www.codeproject.com/Tips/404274/Client-Side-Validation-using-JavaScript
All-Star
15175 Points
2954 Posts
Dec 24, 2012 09:43 AM|LINK
ravikumar.t but i want this validation through javascript
Two things:
1> Check the Validation on either textchanged event of the textbox or control Lostfocus...
http://stackoverflow.com/questions/11217468/fire-ontextchanged-event-of-an-asptextbox-via-javascript
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.lostfocus%28v=vs.71%29.aspx
2> Use of Javascript Validation on Client Side:
http://www.aspsnippets.com/articles/textbox-validation-using-javascript.aspx
http://www.c-sharpcorner.com/UploadFile/purankaushal/103222006013805AM/1.aspx
Dec 24, 2012 11:15 AM|LINK
Thanks for your reply
I fallow this link but want to show pop up and focus on text box to id after the t2 id then only he will enter other fields
one more thing my texbox are under update panel
please
Help me
136 Points
59 Posts
Dec 24, 2012 12:38 PM|LINK
Initial value of validator
set
InitialValue="Default Text"
21829 Points
2513 Posts
Microsoft
Dec 30, 2012 11:11 AM|LINK
ravikumar.t one more thing my texbox are under update panel
Hi,
You could follow below thread which is use textbox ontextchanged method in updatepanel. It may help you.
Please see: http://stackoverflow.com/questions/3979316/update-panel-textbox-textchanged-event-is-interfering-with-the-dropdown-select
Thanks.
ravikumar.t
Member
19 Points
168 Posts
Validation Required on default value change on the textbox
Dec 24, 2012 08:44 AM|LINK
Hi friends
I have one requirment
In my webform two texbox are there with default values
I want to put validation while update the T1 exicting text change need to put update textbox t2 value also is validation message
Please help me
rimagandhi
Participant
1836 Points
583 Posts
Re: Validation Required on default value change on the textbox
Dec 24, 2012 09:02 AM|LINK
And use InitialValue property of your validator control to specify the default value should be consider as empty
<asp:TextBox ID="TextBox1" runat="server" Text="Default Text"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter your text" InitialValue="Default Text" ControlToValidate="TextBox1" ValidationGroup="sub"></asp:RequiredFieldValidator> <br /> <br /> <asp:TextBox ID="TextBox2" runat="server" Text="Default Text"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Enter your text" InitialValue="Default Text" ControlToValidate="TextBox2"></asp:RequiredFieldValidator> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Submit" ValidationGroup="sub" />Regards
Rima Gandhi.
Software Developer.
ravikumar.t
Member
19 Points
168 Posts
Re: Validation Required on default value change on the textbox
Dec 24, 2012 09:12 AM|LINK
Thank you for your reply Rima
but i want this validation through javascript
Please help me
sameer_khanj...
Star
7554 Points
1466 Posts
Re: Validation Required on default value change on the textbox
Dec 24, 2012 09:17 AM|LINK
Please check :-
http://www.codeproject.com/Tips/404274/Client-Side-Validation-using-JavaScript
sameer.khanjit@gmail.com
View Blog
Click "Mark as Answer" on the post that helped you.
geniusvishal
All-Star
15175 Points
2954 Posts
Re: Validation Required on default value change on the textbox
Dec 24, 2012 09:43 AM|LINK
Two things:
1> Check the Validation on either textchanged event of the textbox or control Lostfocus...
http://stackoverflow.com/questions/11217468/fire-ontextchanged-event-of-an-asptextbox-via-javascript
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.lostfocus%28v=vs.71%29.aspx
2> Use of Javascript Validation on Client Side:
http://www.aspsnippets.com/articles/textbox-validation-using-javascript.aspx
http://www.c-sharpcorner.com/UploadFile/purankaushal/103222006013805AM/1.aspx
My Website
www.dotnetvishal.com
ravikumar.t
Member
19 Points
168 Posts
Re: Validation Required on default value change on the textbox
Dec 24, 2012 11:15 AM|LINK
Thanks for your reply
http://stackoverflow.com/questions/11217468/fire-ontextchanged-event-of-an-asptextbox-via-javascript
I fallow this link but want to show pop up and focus on text box to id after the t2 id then only he will enter other fields
one more thing my texbox are under update panel
please
Help me
KiaranNafade
Member
136 Points
59 Posts
Re: Validation Required on default value change on the textbox
Dec 24, 2012 12:38 PM|LINK
setChen Yu - MS...
All-Star
21829 Points
2513 Posts
Microsoft
Re: Validation Required on default value change on the textbox
Dec 30, 2012 11:11 AM|LINK
Hi,
You could follow below thread which is use textbox ontextchanged method in updatepanel. It may help you.
Please see: http://stackoverflow.com/questions/3979316/update-panel-textbox-textchanged-event-is-interfering-with-the-dropdown-select
Thanks.
Feedback to us
Develop and promote your apps in Windows Store