Newbie Question - Image Button & Code Behind

K

Krish

Sorry guys for basic question - just started with my asp.net & c sharp. I
have image button in my aspx page.

<asp:ImageButton id="submit" runat="server"
ImageUrl="../images/f_submit.gif"
onClick = "ImageButtonSubmit" />

onclick calling ImageButtonSubmit

In my code behind page.aspx.cs i have following code. Im not sure where iam
going wrong, but giving me this error

"'OnlineApp.RegistrationForm.ImageButtonSubmit(object,
System.Web.UI.ImageClickEventArgs)' is inaccessible due to its protection
level".
Any help gurus's

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace OnlineApp
{
/// <summary>
/// Summary description for RegistrationForm.
/// </summary>
public class RegistrationForm : System.Web.UI.Page
{
public System.Web.UI.WebControls.TextBox txtMsg;
public System.Web.UI.WebControls.ImageButton submit;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
// Display welcome message
txtMsg.Text = "Hello, this is Postback";
}
}
void ImageButtonSubmit ( object sender, ImageClickEventArgs e )
{
txtMsg.Text = "it worked";
}


#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top