-Dman100-
asked on
simple onclick event handler question
I have a very simple question about event handlers.
I've created a very simple form page with a textbox and image button.
when the image button is clicked I want to pass the value in the text box in a querystring, redirecting to another URL:
Here is my event handler:
protected void SearchImageButton_Click(ob ject sender, ImageClickEventArgs e)
{
Response.Redirect("http://search.mysite.com:9000/cgi-bin/query?mss=search&op=x&i=mysite&9=" + the textbox value
}
The name of my textbox is SearchTextBox
How do I pass that value in my the querystring?
I've created a very simple form page with a textbox and image button.
when the image button is clicked I want to pass the value in the text box in a querystring, redirecting to another URL:
Here is my event handler:
protected void SearchImageButton_Click(ob
{
Response.Redirect("http://search.mysite.com:9000/cgi-bin/query?mss=search&op=x&i=mysite&9=" + the textbox value
}
The name of my textbox is SearchTextBox
How do I pass that value in my the querystring?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASP.mainmaster.master does not contain a definition for 'SearchImageButton_Click'
Here is the relevant section with the web controls on my masterpage:
<td>
<form runat="server">
Search <asp:TextBox ID="SearchTextBox" runat="server" Height="15px" Width="150px"></asp:TextBo
<asp:ImageButton ID="SearchImageButton" runat="server" ImageAlign="Middle" ImageUrl="~/images/go.gif"
</form>
</td>
And this is the master page code behind:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.
using System.Web.UI.HtmlControls
public partial class Template : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SearchImageButton_Click(ob
{
Response.Redirect("http://search.compasslearning.com:9000/cgi-bin/query?mss=search&op=x&i=CompassLearning&9=" + this.SearchTextBox.Text);
}
}