in my project there’s a submit button
<input type="submit" value="submit form" onclick="window.form1.submit();" id="subBut">
after some more work on the project and while adding few ImageButton controls, it was standing out as un related button .
i tested an imageButton with onClick event .
the code of onClick is still empty
<asp:ImageButton ID="ImgBut_Submt" ImageUrl="~/images/sendreq.jpg"
runat="server" OnClick="Submit_Click" style="width: 28px" />
code behind
protected void Submit_Click(object sender, ImageClickEventArgs e)
{
}
though seems that is doing same thing . is it ok to leave it as it is as a substitute
to a submit button .. am i missing somthing here ?
input type=submitwill anway submit the form, i dont think you need to do an onclick action.In ASP.Net world, though the events are fired using postbacks, the information is sent to server as a “Form Submit” only, the main difference i see in your content is you are trying to mix native html controls and asp.net web controls, thats where the whole confusion is.
ASP.NET web controls though provide the same functionality as native html controls, it offers extra event handling mechanism and state information, its only a wrapper upon native html controls as browser can understand only them.
in ASP.NET world you would not set the action attribute to form aswel as it is internally taken care by your ASP.NET framework.
As Kapil mentioned you can have a submit button with css which can contain an image, similar to what ASP.NET does.