Solved

simple onclick event handler question

Posted on 2006-07-14
2
237 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 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