Solved

simple onclick event handler question

Posted on 2006-07-14
2
216 Views
Last Modified: 2010-04-16
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(object 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?
0
Comment
Question by:-Dman100-
2 Comments
 
LVL 6

Accepted Solution

by:
mogun earned 500 total points
ID: 17111212
Response.Redirect("http://search.mysite.com:9000/cgi-bin/query?mss=search&op=x&i=mysite&9=" + this.SearchTextBox.Text
0
 

Author Comment

by:-Dman100-
ID: 17111336
I tried to run the page and got the following error message:

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:TextBox>
<asp:ImageButton ID="SearchImageButton" runat="server" ImageAlign="Middle" ImageUrl="~/images/go.gif" OnClick="SearchImageButton_Click" />
</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.WebParts;
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(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("http://search.compasslearning.com:9000/cgi-bin/query?mss=search&op=x&i=CompassLearning&9=" + this.SearchTextBox.Text);
    }
}

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now