RegisterStartupScript doesn't work with ScriptManager,Updatepanel. Why is that?

前端 未结 4 1589
不知归路
不知归路 2020-11-29 03:31
protected void timer1_Tick(object sender, EventArgs e)
    {
        foreach (RepeaterItem item in rpChat.Items)
        {
            TextBox txt = item.FindControl         


        
4条回答
  •  天涯浪人
    2020-11-29 03:46

    In my case ScriptManager.RegisterStartupScript didn't work too.

    Not work:

    ScriptManager.RegisterStartupScript(Me, 
      Me.GetType(), 
      String.Format("Data{0}", Me.ID), 
      "", 
      False)
    

    Work:

    ScriptManager.RegisterStartupScript(Me.Page, 
      Me.GetType(), 
      String.Format("Data{0}", Me.ID), 
      "", 
      False)
    

    Me in the example is my custom control inherited from System.Web.UI.WebControls.WebParts.WebPart

提交回复
热议问题