2011-02-02 7 views
0

は、私はちょうど私が、その後<asp:UpdatePanel ...を削除する場合、私は、警告メッセージが表示されますことに気づいた何の警告メッセージがないよりはコードビハインドからのメッセージを警告するためにどのように私は `<ASPがある場合:UpdatePanelの...` poup

protected void gv_RowCommand(object sender, GridViewCommandEventArgs e) 
{ 
    if (e.CommandName == CRUID.Delete.ToString()) 
    { 

    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('Deleted successfully!');", true); 

or 

// Define the name and type of the client scripts on the page. 
     String csname1 = "PopupScript"; 
     Type cstype = this.GetType(); 

     // Get a ClientScriptManager reference from the Page class. 
     ClientScriptManager cs = Page.ClientScript; 

     // Check to see if the startup script is already registered. 
     if (!cs.IsStartupScriptRegistered(cstype, csname1)) 
     { 
      StringBuilder cstext1 = new StringBuilder(); 
      cstext1.Append("<script type=text/javascript> alert('Hello World!') </"); 
      cstext1.Append("script>"); 

      cs.RegisterStartupScript(cstype, csname1, cstext1.ToString()); 
     } 
    } 
} 

protected override void Page_Load(object sender, EventArgs e) 
{ 
    gv.DataSourceID = "gvDataSource"; 
} 

PS:IAM私のGridViewコントロールをバインドするにObjectDataSourceを使用して

+0

デバッグ時にgv_RowCommandにブレークポイントを設定すると、そこに到達できますか? – JumpingJezza

+0

はい、そこにはありますがポップアップアラートは表示されません –

答えて

0

のtry変更:

と私のコードで以下、私はいくつかの方法を試してみましたが、私は警告メッセージを取得することはありません
関連する問題