?
Solved

simple onclick event handler question

Posted on 2006-07-14
2
Medium Priority
?
265 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

800 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