javascript - Display Bootstrap ModalPopup on Click on ASP Button without using Modalpopupextender -
i trying call javascript function on click event of asp button , function trying click html button invoke modal pop.
status: able file html button's click event , run alertbox in not modalpopup. able open modalpopup directly clicking html code.
code: //code
protected void button1_click(object sender, eventargs e) { button btn = (button)sender; repeateritem ri = (repeateritem)btn.parent; label id = (label)ri.findcontrol("payid"); add_account_head_1.headid_property = id.text; update1.update(); string script = "showpop();"; scriptmanager.registerstartupscript(this, gettype(), "servercontrolscript", script, true); }
in body section
$("#btn1").click(function () { // alert('this has been clicked'); $("#mymodal").modal('show'); });
in head section
function showpop() { var button = document.getelementbyid('btn1'); button.click(); };
you can invoke modal.show
directly server side. make sure #mymodal
correct selector. can verify id dev tools.
protected void button1_click(object sender, eventargs e) { button btn = (button)sender; repeateritem ri = (repeateritem)btn.parent; label id = (label)ri.findcontrol("payid"); add_account_head_1.headid_property = id.text; update1.update(); string script = "showpop();"; scriptmanager.registerstartupscript(this, gettype(), "servercontrolscript", "$('#mymodal').modal('show');", true); }
Comments
Post a Comment