S
sunil
I have a button named Button1, and I wrote an event handler for the
OnClick event.
protected void Button1_Click(object sender, System.EventArgs e)
{
this.Response.Redirect("Default.aspx?q=" + this.TextBox1.Text+ " ");
}
The TextBox1 is a text box that takes user input.
I get the text box content by extracting the query parameters as
follows:
protected string Q
{
get
{
string query = this.Request.Params["q"];
if (query == String.Empty)
return null;
return query;
}
}
The Page_Load event handler is as follows:
protected void Page_Load(object sender, System.EventArgs e)
{
// Press Button1 on enter
Page.RegisterHiddenField("__EVENTTARGET", "Button1");
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
if (!IsPostBack)
{
if (this.Q != null)
{
// I call my own method
findResults();
}
DataBind();
}
}
The problem is if I enter the term "c# language", the value of the
TextBox1.Text is "c# language" which is as I expect. But as soon as the
response is redirected and the control goes to the Page_Load(), then
"this.Q" value is being set to "c".
How do I send the correct value?
Thanks in advance.
OnClick event.
protected void Button1_Click(object sender, System.EventArgs e)
{
this.Response.Redirect("Default.aspx?q=" + this.TextBox1.Text+ " ");
}
The TextBox1 is a text box that takes user input.
I get the text box content by extracting the query parameters as
follows:
protected string Q
{
get
{
string query = this.Request.Params["q"];
if (query == String.Empty)
return null;
return query;
}
}
The Page_Load event handler is as follows:
protected void Page_Load(object sender, System.EventArgs e)
{
// Press Button1 on enter
Page.RegisterHiddenField("__EVENTTARGET", "Button1");
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
if (!IsPostBack)
{
if (this.Q != null)
{
// I call my own method
findResults();
}
DataBind();
}
}
The problem is if I enter the term "c# language", the value of the
TextBox1.Text is "c# language" which is as I expect. But as soon as the
response is redirected and the control goes to the Page_Load(), then
"this.Q" value is being set to "c".
How do I send the correct value?
Thanks in advance.