开发者

Setting control visibility is UpdatePanel Load event

开发者 https://www.devze.com 2023-03-30 16:53 出处:网络
I have a question: in my web application I have an UpdatePanel. In this UpdatePanel I have some controls and I want to set their visibility in UpdatePanel Load event.

I have a question: in my web application I have an UpdatePanel. In this UpdatePanel I have some controls and I want to set their visibility in UpdatePanel Load event.

I do it in the following way:

Default.开发者_运维问答aspx:

<asp:UpdatePanel ID="UpdatePanel" runat="server" ChildrenAsTriggers="false" OnLoad="Sub_UpdatePanel_OnLoad" UpdateMode="Conditional">

Default.aspx.vb

Protected Sub Sub_UpdatePanel_OnLoad()

    LinkButton1.Visible = True
    LinkButton2.Visible = False

End Sub

And that doesn't work. I tried to add UpdatePanel.Update() in code behind, that helped but completelly crashed my jQuery code.

Can you help me with it? I'm sure that the solution is quite simple!

Thanks!


Just set the controls visiblity on Page_Load instead.

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
         Button1.Visible = false;
    }
}
0

精彩评论

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