A simple point of
To add an authentication script to a button, you can
<%@ Page language= "C #"%>
<script language= "JavaScript" >
function Getconfirm ()
{
if (Confirm ("Do you want to delete record?") ==true)
return true;
Else
return false;
}
</SCRIPT>
<script runat= "Server" >
public void Page_Load (Object sender, EventArgs E) {
BTNSUBMIT.ATTRIBUTES.ADD ("onclick", "return Getconfirm ();");
}
void btnSubmit_Click (object sender, EventArgs e) {
Message.Text = "You entered your name as:" + txtname.text;
}
</script>
<body>
<form runat= "Server" >
Name: <asp:textbox id= "txtname" runat= "Server"/>
<asp:button id= "btnsubmit" onclick= "btnSubmit_Click" runat= "Server" text= "Submit" ></asp:button><br/ >
<asp:label id= "message" runat= "Server"/>
</form>
</body>
Attention to key places BtnSubmit.Attributes.Add ("onclick", "return Fffkkk ();"); This sentence is equivalent to adding "onclick =" return Fffkkk () on the tab of static pages.
II) a bit more complicated
Sometimes we have to add authentication on the Delete column of the DataGrid, so you can
First build a DataGrid and then add a delete column to her
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service