简体   繁体   English

从C#后面的代码设置Jquery模态弹出div的宽度

[英]Setting up width for Jquery modal pop up div from code behind c#

I am calling jQuery Modal Pop up with some dynamic information, How I can set width of modal popup div from my c# Code. 我正在用一些动态信息调用jQuery Modal Popup,如何通过c#代码设置模式弹出div的宽度。

Here is my current call from c# 这是我目前从C#拨打的电话

string jqmsg = " Dear Applicant,</br> <p>Your enquiry registered, The Email verification link has been sent to you registred Email ID " + txtEmail.Text + " and your registration reference ID is <Strong> " + Session["REGID"].ToString() + " </Strong></p>";
                                        ClientScript.RegisterStartupScript(this.GetType(),"Popup", "ShowPopup('" + jqmsg + "');", true);

Thanks in advance. 提前致谢。

I thought I would answer the comment I made above with an answer so I could more easily show code. 我以为我会回答上面的评论,这样我可以更轻松地显示代码。 This is what I mean: 这就是我的意思:

c# C#

var width = 400;
string jqmsg = " Dear Applicant,</br> <p>Your enquiry registered, The Email verification link has been sent to you registred Email ID " + txtEmail.Text + " and your registration reference ID is <Strong> " + Session["REGID"].ToString() + " </Strong></p>";
                                    ClientScript.RegisterStartupScript(this.GetType(),"Popup", "ShowPopup('" + jqmsg + "', " + width + ");", true);

javascript JavaScript的

function ShowPopup(message, width) {
    // other ShowPopupCode
    document.getElementById("modalDivId").style.width = width + 'px';
}

Would that work for you? 那对你有用吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM