J
JP
ow do I get a HtmlInputImage to raise the ServerClick event
I have two inputs one is a submit button the other is a
image. The submit button works the input image does not.
Does anyone know why this would happen?
I would like to mention that I have overridden viewstate
and do not use server side forms.
Below is my code maybe I am missing something
<input type="image" src="~/img/btnPurchase.gif" width="90"
height="26" id="Purchase" runat="server">
<input type="submit" id="sbmt" runat="server"
value="submit">
and the code behind is as follows.
protected System.Web.UI.HtmlControls.HtmlInputImage
Purchase;
protected System.Web.UI.HtmlControls.HtmlInputButton sbmt;
private void InitializeComponent()
{
this.sbmt.ServerClick += new System.EventHandler
(this.Sbmt_Click);
this.Purchase.ServerClick += new
System.Web.UI.ImageClickEventHandler(this.Purchase_Click);
this.Load += new System.EventHandler
(this.Page_Load);
}
public void Purchase_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Response.Write("Purchase_Click Fired!!!");
Response.End();
}
private void Sbmt_Click(object sender, System.EventArgs e)
{
Response.Write("Purchase_Click Fired!!!");
Response.End();
}
I have two inputs one is a submit button the other is a
image. The submit button works the input image does not.
Does anyone know why this would happen?
I would like to mention that I have overridden viewstate
and do not use server side forms.
Below is my code maybe I am missing something
<input type="image" src="~/img/btnPurchase.gif" width="90"
height="26" id="Purchase" runat="server">
<input type="submit" id="sbmt" runat="server"
value="submit">
and the code behind is as follows.
protected System.Web.UI.HtmlControls.HtmlInputImage
Purchase;
protected System.Web.UI.HtmlControls.HtmlInputButton sbmt;
private void InitializeComponent()
{
this.sbmt.ServerClick += new System.EventHandler
(this.Sbmt_Click);
this.Purchase.ServerClick += new
System.Web.UI.ImageClickEventHandler(this.Purchase_Click);
this.Load += new System.EventHandler
(this.Page_Load);
}
public void Purchase_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Response.Write("Purchase_Click Fired!!!");
Response.End();
}
private void Sbmt_Click(object sender, System.EventArgs e)
{
Response.Write("Purchase_Click Fired!!!");
Response.End();
}