0
我正在與多個頁面上的下拉列表控件,每個下拉列表中選擇指數的變化情況下我想表現的模式彈出一些消息,因此我顯示模式彈出與上一個標籤,並從背後JS函數調用的代碼動態改變的標籤值,價值得到改變,但沒有反映在網頁上。這裏是代碼片段:標籤文本通過JavaScript更新,但不會反映在網頁
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;
}