error: does not contain definition
I have a input box and an image button:
<
td><formrunat="server">Search
<asp:TextBoxID="SearchTextBox"runat="server"Height="15px"Width="150px"></asp:TextBox><asp:ImageButtonID="SearchImageButton"runat="server"ImageAlign="Middle"ImageUrl="~/images/go.gif"OnClick="SearchImageButton_Click"/></form></td>I'm using the onclick event handler to pass the value from the textbox in a querystring:
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);}
When I run the application I get the following error message:
ASP.mainmaster.master does not contain a definition for 'SearchImageButton_Click'
Where did I go wrong?
[3437 byte] By [
-D-] at [2008-2-24]
I think so.
I am assuming the SearchImageButton is an image button (looks like it)
are you able to double click on the button to make an event for it? can you see the event being created?
I'm just learning asp.net, so I apologize for any novice answer here.
It is an image button.
I double clicked on the image button from the designer view and it created the following code between the script tags in source view:
protected
void SearchImageButton_Click(object sender, ImageClickEventArgs e){
}
I moved the event handler to the code-behind file and added the additional code:
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);}
I'm using Visual Web Developer 2005 Express Edition
-D- at 2007-8-30 >
