Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

simple onclick event handler question

Posted on 2006-07-14
2
Medium Priority
?
270 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-
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
mogun earned 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

618 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