Textbox server control problem

H

hanolo

Does anyone ever see this happen.

I build a form with couple of textbox server control. When user inputs
character ` in there, after form post back, the textbox become a line
of string such as <INPUT id=_txtName style="WIDTH: 70%" value=`
name=_txtName>.

I can filter out ` from the inputs, but it seems like a microsoft bug
to me.

Any ideas?
 
C

Craig Deelsnyder

Does anyone ever see this happen.

I build a form with couple of textbox server control. When user inputs
character ` in there, after form post back, the textbox become a line
of string such as <INPUT id=_txtName style="WIDTH: 70%" value=`
name=_txtName>.

I can filter out ` from the inputs, but it seems like a microsoft bug
to me.

Any ideas?

Hmm, doesn't do this for me (v 1.1). .NET will replace double-quotes with
&quot; if needed, to prevent problems in the HTML, otherwise single-quote
works fine, no problems displaying or setting the value.

Can you post the aspx code? For the textbox, and any other special code
you're using on the textbox, outside of just setting its .Text property.
Explain what you're doing in the UI as a user, etc.

Also make sure your HTML in the aspx is valid (all tags properly closed,
etc.)...
 
C

Craig Deelsnyder

It isn't not single-quote, it is `, the charactor under ~.

Sorry :) That one still works for me. I can type it in and in
server-code set another textbox.Text equal to it and works fine.
 
H

hanolo

I appreciated your help. I tried create a new form from scratch, and
just like you said, it works fine. So it gotta be something wrong with
my code. I'll post the aspx file and c# file below.

<%@ Page language="c#" Codebehind="Default.aspx.cs"
AutoEventWireup="false" Inherits="WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<title>Business Card Order Form</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<link href="Styles.css" rel="stylesheet" type="text/css">
</HEAD>
<body>
<form id="_frmHome" method="post" runat="server">
<table width="660" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td></td>
</tr>
<tr>
<td class="iboard">
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td colspan="2" height="3"></td>
</tr>
<tr>
<td width="70%" align="center">
<asp:Label id="_lblName" runat="server"
cssclass="iName"></asp:Label></td>
<td align="center">
<asp:Label id="_lblTitle" runat="server"
cssclass="iTNameBig"></asp:Label></td>
</tr>
<tr>
<td colspan="2" height="3"></td>
</tr>
<tr>
<td colspan="2" height="1" bgcolor="#9999ff"></td>
</tr>
<tr>
<td colspan="2" height="3"></td>
</tr>
<tr>
<td colspan="2">
<asp:placeHolder id="_phAction" runat="server"
EnableViewState="True" Visible="True">
<table width="80%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td>
<asp:RadioButtonList id="_rblAction" runat="server"
cssclass="iTab" AutoPostBack="True">
<asp:ListItem>To order Business Card for myself</asp:ListItem>
<asp:ListItem>To order Business Card for others</asp:ListItem>
</asp:RadioButtonList></td>
</tr>
</table>
</asp:placeHolder>
<asp:placeHolder id="_phSearch" runat="server"
EnableViewState="true" Visible="False">
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td>
<fieldset class="iboard"><legend class="iTab">Search</legend>
<table width="95%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td colspan="2" height="3"></td>
</tr>
<tr>
<td width="30%" align="right" class="iTab">Search By Last Name
&nbsp;</td>
<td>
<asp:TextBox id="_txtLName" runat="server"
Width="70%"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="iTab">Search By Login &nbsp;</td>
<td>
<asp:TextBox id="_txtLogin" runat="server"
Width="70%"></asp:TextBox>&nbsp;&nbsp;
<asp:Button id="_btnSearch" runat="server"
Text="Search"></asp:Button></td>
</tr>
<tr>
<td colspan="2" height="3"></td>
</tr>
</table>

</fieldset></td>
</tr>
<tr>
<td colspan="2" height="3"></td>
</tr>
</table>
</asp:placeHolder>
</td>
</tr>
<tr>
<td colspan="2" height="5"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
</form>
</body>
</HTML>




using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using FirmWide.DataAccessLayer;
using BizCard.BusinessLogic;
using FirmWide.BusinessLayer.DirectoryAccess;

public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlForm _frmHome;
protected System.Web.UI.WebControls.Label _lblName;
protected System.Web.UI.WebControls.Label _lblTitle;
protected System.Web.UI.WebControls.RadioButtonList _rblAction;
protected System.Web.UI.WebControls.PlaceHolder _phAction;
protected System.Web.UI.WebControls.PlaceHolder _phSearch;
protected System.Web.UI.WebControls.TextBox _txtLName;
protected System.Web.UI.WebControls.TextBox _txtLogin;
protected System.Web.UI.WebControls.Button _btnSearch;


private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
_phAction.Visible = true;
_phSearch.Visible = false;
}
this.SmartNavigation = true;
}

override protected void OnInit(EventArgs e)
{

InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this._rblAction.SelectedIndexChanged += new
System.EventHandler(this._rblAction_SelectedIndexChanged);
this._btnSearch.Click += new
System.EventHandler(this._btnSearch_Click);
this.Load += new System.EventHandler(this.Page_Load);
}

private void _rblAction_SelectedIndexChanged(object sender,
System.EventArgs e)
{
switch (_rblAction.SelectedIndex)
{
case 0:
{
break;
}
case 1:
{
_phAction.Visible = false;
_phSearch.Visible = true;
break;
}
}
}

private void _btnSearch_Click(object sender, System.EventArgs e)
{

}


}



Would you mind give it a try?

Thanks.
 
H

hanolo

After further investigation, I found that when enable smartnavigation
in the form, this problem start to happen. So it is a Bug from
Microsoft.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,269
Messages
2,571,098
Members
48,773
Latest member
Kaybee

Latest Threads

Top