0

In database table existing values are inserted like < br > for one line space, and I am using update functionality, but when I am clicking the update button then update button is not firing because textbox contain < br > values.

I have two buttons, one for update and another for canceling both are not working, if I will remove
from textboxes then both buttons are firing.

Design code:

<asp:TextBox ID="txt_Res" runat="server" TextMode="MultiLine" CssClass="textfield_new1"></asp:TextBox>

<asp:LinkButton ID="LinkButton2" CssClass="submitbtn" ValidationGroup="reg" runat="server" OnClick="LinkButton2_Click">Update</asp:LinkButton>

<asp:LinkButton ID="LinkButton4" CssClass="submitbtn"  runat="server" OnClick="LinkButton4_Click">Cancel</asp:LinkButton>

<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ErrorMessage="Enter Job Responsibilities" ControlToValidate="txt_Res" ForeColor="Red" ValidationGroup="reg"></asp:RequiredFieldValidator>"
Suprabhat Biswal
  • 3,033
  • 1
  • 21
  • 29
mastermind
  • 67
  • 9
  • Show us the generated html, The value of textbox might be breaking html – Adil Sep 18 '15 at 06:14
  • When i will remove < br > from text box then values updating and cancel button also working, the problem with < br >. Above is my html code. @Adil – mastermind Sep 18 '15 at 06:17
  • try putting
    instead of
    – Adil Sep 18 '15 at 06:18
  • Try adding AUtoPostBack=true to your buttons. –  Sep 18 '15 at 06:18
  • Similar discussion - I hope these might help: http://stackoverflow.com/questions/11673107/how-do-i-allow-html-tags-to-be-submitted-in-a-textbox-in-asp-net and this: http://stackoverflow.com/questions/4146309/in-a-text-box-in-asp-net-how-to-allow-it – JGV Sep 18 '15 at 06:18
  • No already values is inserted in database, so i m updating same values, that i can not change na because its user data, he was used break line according to there needs only i have to work with update. @Adil – mastermind Sep 18 '15 at 06:20
  • @mastermind, I just want to check the behavior of using
    – Adil Sep 18 '15 at 06:23
  • try adding <%@ Page ... ValidateRequest="false" %> in page directive. – Ratna Sep 18 '15 at 06:23
  • customer putting some text and he need some line gap between paragraph then he is using like < br >. @Adil – mastermind Sep 18 '15 at 06:25
  • I tried that also ratna, button is not working. @Ratna – mastermind Sep 18 '15 at 06:26

3 Answers3

0

use ValidateRequest="false" in <%@ Page tag of .aspx page

Rajesh
  • 208
  • 1
  • 4
  • I took the same code of your. But for me it worked after using this. please use EnableEventValidation="false" along with this. if its not working then plz share what error message u are getting. – Rajesh Sep 18 '15 at 06:38
  • Again button is not firing. @Rajesh – mastermind Sep 18 '15 at 06:41
0

I got result from my side, keep this into web.config file.

<httpRuntime requestValidationMode="2.0" />
mastermind
  • 67
  • 9
0

We can use another way for particular page given below.

 <location path="test.aspx">
<system.web>
  <httpRuntime requestValidationMode="2.0" />
</system.web>

mastermind
  • 67
  • 9