开发者

if i have `<asp:UpdatePanel ...` than there is no alert message poup

i just noticed that if i remove the <asp:UpdatePanel ... then i get the alert message

how to alert a message from code-behind and i have tried numbe开发者_如何学Gor of ways but i never get alert message, below is my code:

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 using objectdatasource to bind my gridview control


try change:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜