I am using asp:Panel. In the panel i have a textbox. This panel i am using for insert and update for both Purpose. When i insert it is fine, but when i update value is showing in the text box, but when i click on update button, at that time requiredfield
validator fired. I don't know what's the problem. Please suggest me...
i insert it is fine, but when i update value is showing in the text box, but when i click on update button, at that time requiredfield validator fired. I don't know what's the problem. Please suggest me...
Remove autoPostBack true in u r TextBox...fro reason at this time page one more time postback ...so this time u r textbox is get empty value.So fire requiered field validator....
Any use OnTextChanged="txtName_TextChanged" in u r aplication?...
i think u r code edite time some value bind u r text box.but this time u r OnTextChanged="txtName_TextChanged" is fired ..So this time u r textbox not get any value...
Please remove OnTextChanged="txtName_TextChanged" in textbox...
Galvin
Member
80 Points
107 Posts
requiredfieldvalidator and Regularexpression Validator
Apr 02, 2012 09:48 AM|LINK
Hi
I am using asp:Panel. In the panel i have a textbox. This panel i am using for insert and update for both Purpose. When i insert it is fine, but when i update value is showing in the text box, but when i click on update button, at that time requiredfield validator fired. I don't know what's the problem. Please suggest me...
Here is my code:
<asp:Panel ID="panelADD" runat="server" Style="display: none" Width="600px">
<asp:UpdatePanel ID="UpdatepanelAdd" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div>
<asp:TextBox ID="txtName" runat="server" TabIndex="1" Width="145px" AutoPostBack="True"
OnTextChanged="txtName_TextChanged">
</asp:TextBox>
<asp:Label ID="lblCompanyName" runat="server" ForeColor="Red"></asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
ControlToValidate="txtName" InitialValue ="indrajeet"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtName"
Display="Dynamic" runat="server" ErrorMessage="Special characters not allowed"
ValidationExpression="^[0-9a-zA-Z ]+$" ></asp:RegularExpressionValidator>
</div>
<asp:Button ID="btnSaveProfile" CssClass="buttonblue" runat="server" CausesValidation="true"
Text="Save" TabIndex="9" OnClick="btnSaveProfile_Click" />
sriramabi
Contributor
4351 Points
1277 Posts
Re: requiredfieldvalidator and Regularexpression Validator
Apr 02, 2012 09:54 AM|LINK
Hi
set Validation Group in u r validation control property and button Control property
for
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" ValidationGroup="Name" runat="server" ErrorMessage="*"
ControlToValidate="txtName" InitialValue ="indrajeet"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtName"
Display="Dynamic" runat="server" ValidationGroup="Name" ErrorMessage="Special characters not allowed"
ValidationExpression="^[0-9a-zA-Z ]+$" ></asp:RegularExpressionValidator>
<asp:Button ID="btnSaveProfile" CssClass="buttonblue" runat="server" ValidationGroup="Name" CausesValidation="true"
Text="Save" TabIndex="9" OnClick="btnSaveProfile_Click" />
thank u
sriramabi
Contributor
4351 Points
1277 Posts
Re: requiredfieldvalidator and Regularexpression Validator
Apr 02, 2012 09:58 AM|LINK
Remove autoPostBack true in u r TextBox...fro reason at this time page one more time postback ...so this time u r textbox is get empty value.So fire requiered field validator....
change and try try this
<asp:TextBox ID="txtName" runat="server" TabIndex="1" Width="145px"
OnTextChanged="txtName_TextChanged">
thank u
thank u
Galvin
Member
80 Points
107 Posts
Re: requiredfieldvalidator and Regularexpression Validator
Apr 02, 2012 11:32 AM|LINK
I tried your suggestion but it is not working.
sriramabi
Contributor
4351 Points
1277 Posts
Re: requiredfieldvalidator and Regularexpression Validator
Apr 02, 2012 11:37 AM|LINK
k
Any use OnTextChanged="txtName_TextChanged" in u r aplication?...
i think u r code edite time some value bind u r text box.but this time u r OnTextChanged="txtName_TextChanged" is fired ..So this time u r textbox not get any value...
Please remove OnTextChanged="txtName_TextChanged" in textbox...
then check...
<asp:TextBox ID="txtName" runat="server" TabIndex="1" Width="145px" >
thank u
Zhongqing Ta...
Star
10512 Points
1354 Posts
Re: requiredfieldvalidator and Regularexpression Validator
Apr 06, 2012 07:12 AM|LINK
Hi Galvin,
If this issue persists, can you please post the code-behind. I'm trying to reproduce this issue.
Regards
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework