开发者

Insert Javascript in ASP.net

I am using visual basic for coding. In my form I have a delete button for deleting a record. Now I want to show a Confirm msgbox using javascript instead of 开发者_运维百科using visual basic.

What is the javascipt code for the msgbox & Where do I insert this code?


try this..

<asp:Button runat="server" ID="btnDelete" Text="Delete" OnClientClick="return confirm(&quot;Are you sure you want to delete&quot;)" />

If you want in code behind

imgbtn.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to delete ?');");


<asp:LinkButton 
    ID="LinkButton1" 
    runat="server" 
    OnClick="LinkButton_Click"
    OnClientClick ="return confirm('Are you sure to delete ?')"
    Text="Delete" 
/>


Try this:

<asp:Button ID="btnDelete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜