Hi Dudes i need a javascript code for code behind using c#.When user click on delete button the popup dialog open Do you really want to delete Yes/No on Yes i want to put my Delete Method there.Pls help me.Thanks in advance.

The Button Control has two properties, OnClick="ServerSideMethod" OnClientClick="ClientSideMethod". So in the OnClick put your Delete Method and in the OnClientClick="return Confirm('Are you sure want to delete');" or call the javascript function...

You can use OnClientClick to call a script function at the java script tag of the asp.net

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script type="text/javascript">


function func1() {

    window.alert('Hello World !');
}

</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="Button1" runat="server" 
   OnClientClick= "return func1();" 
    Text="Button" />
    <p>
    </p>
</asp:Content>

The above source for aspx page for a web form has a button when clicked a java script window will appear

if you are using Update Panel then

ScriptManager.RegisterClientScriptBlock(this,getType(),"Key","alert('it is working')","true");

if not using update panel then

page.clientscript.registerstartupscript(getType(),,"Key","alert('it is working')","true");

hope that helps

commented: i like it, but should there be an empty space between two commas on the second example? +2

If you're using the AjaxControlToolkit you can use a ConfirmButtonExtender

Confirm Button Extender