admin管理员组文章数量:1023263
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
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
本文标签: cHow to close a simple modal dialog on a button clickStack Overflow
版权声明:本文标题:c# - How to close a simple modal dialog on a button click? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745593263a2158012.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论