button evet ---- server side - client side ???

  • Thread starter Thread starter yaya coco
  • Start date Start date
Y

yaya coco

I want to use button. My question is that
How can use server side and client site event at the same time.
That is:

I want to use button :
when The user click the button first of all, client side ask question "Are U
sure"
If yes then send server side function ?

Button Like this
<asp:button id="btnDelete" onclick="delFunction" runat="server">

How can I do that?
 
run this code and you will get the answer

<%@ page Language="C#" debug=true %>
<script language="C#" runat=server>
void Page_Load()
{
bt1.Attributes["onClick"]="javascript:return confirm('are u sure')";


}
public void abc(Object o,EventArgs e)
{
l.Text="Server Side Function called";
}
</script>
<form id=frm1 runat=server>
<asp:Button id=bt1 runat=server onClick="abc" Text="Submit" />
<asp:Label id=l runat=server/>
</form>

hope it helps
Rajesh
 
Back
Top