【发布时间】:2017-03-02 17:37:02
【问题描述】:
我正在处理具有多个下拉控件的页面,在每个下拉选择的索引更改事件上,我想在模式弹出窗口中显示一些消息,因此我显示了带有标签的模式弹出窗口并动态更改了标签值从 JS 函数调用后面的代码中,值得到了改变,但没有反映在网页上。这是代码sn-p:
C#代码:
public void Page_Load(object sender, EventArgs e)
{
//builds page controls
this._BuildControls();
if (IsPostBack)
{
// get the target of the post-back, will be the name of the control
// that issued the post-back
string eTarget = Request.Params["__EVENTTARGET"].ToString();
//source database server dropdown changes event called
if (eTarget.Contains("SourceDatabaseServer"))
{
this._DisplayMessage = "Loading source database...";
}
else if (eTarget.Contains("SourceDatabaseName"))
{
this._DisplayMessage = "Loading source host name...";
}
else if (eTarget.Contains("DestinationDatabaseServer"))
{
this._DisplayMessage = "Loading destination database...";
}
else if (eTarget.Contains("DestinationDatabaseServer"))
{
this._DisplayMessage = "Loading destination host name...";
}
else
{
this._DisplayMessage = "Cloning portal...";
}
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "updateMessage('" + this._DisplayMessage + "');", true);
}
}
Javascript文件函数:
function updateMessage(message){
var text = document.getElementById('LoadAndSaveClonePortalDataModalModalPopup');
text.innerHTML=message;
}
【问题讨论】:
标签: javascript asp.net c#-4.0