2017-03-02 7 views
0

複数のドロップダウンコントロールがあるページで作業していましたが、選択した各インデックスの変更イベントでモーダルポップアップにメッセージを表示したかったので、ラベルを付けてJS関数コールの背後にあるコードから動的にラベル値を変更すると、値は変更されますがウェブページには反映されません。ここでのコードスニペットは、次のとおりです。ラベルテキストはjavascriptで更新されましたがウェブページには反映されません

C#コード:

のJavascriptファイル機能
 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); 
     } 

    } 

:あなたのモーダルフォームでラベルを持っている必要があり

function updateMessage(message){ 
var text = document.getElementById('LoadAndSaveClonePortalDataModalModalPopup'); 
text.innerHTML=message; 
} 

答えて

0

function updateMessage(message) { 
    var $modal = $('#LoadAndSaveClonePortalDataModalModalPopup'), 
     $messagelbl = $modal.find('#lblMessage'); 
     $messagelbl.val(message); 
     $modal.modal("show"); 
} 

あなたはより多くの明確化が必要な場合は、モーダルコンテンツVarying modal content based on trigger buttonを変える方法を説明するセクションをお読み

関連する問題