Here i am trying to close a modal dialog on a button click but it is not closing the dialog.Here is my code
function closemodal() {
alert("true");
$.modal.close();
return false;
}
and
protected void btnOK_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "closemodal();", true);
}
i need to call a javascript function and after that i need to close that dialog..Any suggestion??
EDIT:
$(document).ready(function () {
$('#MainContent_uscRetailParameters_btnOK').click(function (e) {
closemodal();
return false;
});
function closemodal() {
$.modal.close();
}
});
EDIT 2:
$('#CusCatPOPUP .basic').click(function (e)
{
$('#CusCatPOPUP-content').modal();
return false;
}
);
Here i am trying to close a modal dialog on a button click but it is not closing the dialog.Here is my code
function closemodal() {
alert("true");
$.modal.close();
return false;
}
and
protected void btnOK_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "closemodal();", true);
}
i need to call a javascript function and after that i need to close that dialog..Any suggestion??
EDIT:
$(document).ready(function () {
$('#MainContent_uscRetailParameters_btnOK').click(function (e) {
closemodal();
return false;
});
function closemodal() {
$.modal.close();
}
});
EDIT 2:
$('#CusCatPOPUP .basic').click(function (e)
{
$('#CusCatPOPUP-content').modal();
return false;
}
);
Share
Improve this question
edited Apr 17, 2012 at 10:03
Rooney
asked Apr 17, 2012 at 7:17
RooneyRooney
8477 gold badges15 silver badges21 bronze badges
3
- Just add the function inside the click function? What modal are you using? – Marco Johannesen Commented Apr 17, 2012 at 7:20
- ericmmartin./projects/simplemodal – Rooney Commented Apr 17, 2012 at 7:39
- remember to accept your answers when answered. Can see you have dozen open, which are answered correctly. Else you can't create new threads, and people can't see if the question was answered. – Marco Johannesen Commented Apr 17, 2012 at 8:10
3 Answers
Reset to default 2Unless I'm missing the point:
$('#MainContent_uscRetailParameters_btnOK').click(function (e) {
MyFunctionCall(); //i.e. call you function here
$.modal.close();
return false;
});
Might be an error elsewhere, check your browser console.
Created an example: http://jsfiddle/eTnJF/
With code:
$(document).ready(function() {
$('.open').click( function() {
$('#modal').modal();
});
$('.close').click( function() {
closemodal();
return false;
});
function closemodal() {
alert("true");
$.modal.close();
}
});
Which works fine :)
If you want to simply close the modalpopup then the javascript code is.
var mpu = $find('ModalPopupExtender1');
mpu.hide();
Hope it helps.
thanks Kamran