|
Hi,
in my project, if i enter ' < > like charecters in a text field(multiple) itis giving eror like ""
please provide me solution. this is asp.net with C#. sql server is the database.
example: Incorrect syntax near '<'. Unclosed quotation mark before the character string ' , 0, 0)'.
like this.
|
|
|
I can't give an answer without seeing some source code. Can you copy the particular statement that is giving you this error?
|
|
|
|
|
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" name="TextBox1" style="Z-INDEX: 101; LEFT: 304px; POSITION: absolute; TOP: 72px"
TextMode="MultiLine" Height="136px" Runat=server> </asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 360px; POSITION: absolute; TOP: 256px" runat="server"
Text="Button"></asp:Button>
</form>
and .cs is
-----------
private void Button1_Click(object sender, System.EventArgs e)
{
string psgpost1 = (TextBox1.Text);
string psgpostText1 = psgpost1.Replace("'", "'");
Response.Write(psgpost1);
string psgpost2 = psgpostText1;
string psgpostText2 = psgpost2.Replace("<", "<");
Response.Write(psgpostText2);
string psgpost3 = psgpostText2;
string psgpostText = psgpost3.Replace(">", ">");
Response.Write(psgpostText);
}
how to remove html quotes?
regards,
eshwar_gp
<Added>
string psgpostText1 = psgpost1.Replace("'", "'");
string psgpostText2 = psgpost2.Replace("<", "<");
string psgpostText = psgpost3.Replace(">", ">");
in these 3 places in replace function 2nd arguement i used related number like ' for "'"....
please reply.
eshwar_gp
|
|
|
I would like to help, but don't understand the question, or what you're trying to do.
If you want the user to be able to enter HTML escaped values, you need to add:
ValidateRequest="false"
to your Page Directive.
If you want to display those entries on the webform, you have to use the proper escape sequences:
string psgpostText2 = psgpost2.Replace("<", "<");
|
|
You could also use HttpUtility.HtmlEncode(string) for this.
Replacing a character with the SAME character, as you're doing, is a meaningless operation.
<Added>
I see what's going on. The forum is parsing things for us.
string psgpostText2 = psgpost2.Replace("<", "& lt ;");
The second angle bracket should be the HTML escape code for less-than: ampersand-l-t-semicolon
I've tested it and it works fine.
|
|
|
|
|
Hi:
what you ever you explained is good.
i am able to get proper output for
this is eshwar_gp's testing. < still he is trying >.
< he has to get properputput>yaa.
but,
if i use
this is eshwar_gp's testing. <still he is trying >.
< he has to get properputput>yaa.
note: between < and still there is no space. then it is giving error.
like
A potentially dangerous Request.Form value was detected from the client (TextBox1="... testing. <still he is trying ...").
please solve my problem
regards,
eshwar_gp
|
|
|
From my previous post:
If you want the user to be able to enter HTML escaped values, you need to add:
ValidateRequest="false"
to your Page Directive.
Like this:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplicationX.WebForm1" ValidateRequest="false"%>
|
|
|
|
|
Thank you site expert.
Thank you for your co-operation to solve this issue.
Regards,
eshwar_gp
|
|
|
|
|
Hi site-expert,
And, I am facing one more problem with textfiled-multiple.
I am not able to get entered data in the givien format.
i am missing paragraphs, alignments and others.
If I enter data like
--------------------
private void Button1_Click(object sender, System.EventArgs e)
{
string psgpost1 = (TextBox1.Text);
string psgpostText1 = psgpost1.Replace("'", "'");
Response.Write(psgpost1);
string psgpost2 = psgpostText1;
string psgpostText2 = psgpost2.Replace("<", "<");
Response.Write(psgpostText2);
string psgpost3 = psgpostText2;
string psgpostText = psgpost3.Replace(">", ">");
Response.Write(psgpostText);
}
i am getting like this in my grid
---------------------------------
private void Button1_Click(object sender, System.EventArgs e)
{string psgpost1 = (TextBox1.Text);string psgpostText1 = psgpost1.Replace("'", "'");Response.Write(psgpost1);string psgpost2 = psgpostText1;string psgpostText2 = psgpost2.Replace("<", "<");Response.Write(psgpostText2) ;string psgpost3 = psgpostText2;string psgpostText = psgpost3.Replace(">", ">");Response.Write(psgpostText);}
Plz solve my problem.
Regards,
eshwar_gp
|
|
|
You can just call me "Tom".
Response.Write() merely appends data to the Response Stream. It does not format the data. You have to format the data.
So if you want your data to contain line ending characters, you have to add the HTML tag for producing a line, which is "<br>".
Likewise, if you want to produce a paragraph, you must emit the "<p>" and "</p>" tags in the correct places.
|
|
|
|
|
Hi,
I can put all those. But end user doesnot know like he has to do all these html codes.
In this discission forum also u r able to display data which we entered in this text multiple as we typed.
Let me know how it is working .. Plz..
and, i am displaying data in a grid.
as u said, Response.Write() merely appends data to the Response Stream. It does not format the data. You have to format the data.
Letme know how to format it?
Regards,
eshwar_gp
|
|
|
Please help
I also have the same problem please help
|
|
|
|
|
|
|
Chanel Store has been pushed out many new bags, which are walking in the forefront of world. Delicate bows and pleats and vivid Chanel Handbags make the flamboyant yet feminine. Its soft curved shape is enhanced with an eye-catching studded golden brass twist lock. Natural cowhide leather trimmings and shoulder strap, it is carried on the shoulder with its adjustable shoulder strap. Chanel Purses are makes of 100% leather with it is weightless materials and roman drapes. Chanel Accessories page where owns sunglasses, scarf, ring, bangle and earring and so on. Cool sunglasses designer is one of the only designer brands that cater specifically for man. This means that their designs are well tailored to the male facial structure and look and fit superbly. The designs are contemporary and dynamic. Buy Chanel where Chanel Watches that you can enjoy a best price during the discount time.
|
|
|