In Asp control
button clicking the event showing message box from Client side with display the
message box Ok or cancel button. While Clicking Ok button to move to server side
calling to method otherwise cancel means close the message box.
Asp Control:
<asp:Button ID="btn_Add" runat="server" Text="Submit" OnClick="btnAdd_Click" OnClientClick="javaScript:return btnClick();" />
Server Side method:
protected void btnAdd_Click(object sender,EventArgs e)
{
}
Client Side method:
Confirm Box:
<script type="text/javascript">
function btnClick() {
var r = confirm("Are sure you want to Add...");
if (r == true) {
return true;
}
else {
return false;
}
}
</script>
Prompt Box:
<script type="text/javascript">
function btnClick() {
var x;
var person = prompt("Please enter your name", "ID");
alert(person);
if (person != null) {
document.getElementById("hdn_demo").innerHTML = person;
}
}
</script>
0 comments:
Post a Comment