Show hide div using codebehind

前端 未结 8 2075
难免孤独
难免孤独 2020-12-30 00:29

I have a DropDownList for which I am trying to show a div OnSelectedIndexChanged but it says OBJECT REQUIRED.

I a

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 01:17

    I was having a problem where setting element.Visible = true in my code behind wasn't having any effect on the actual screen. The solution for me was to wrap the area of my page where I wanted to show the div in an ASP UpdatePanel, which is used to cause partial screen updates.

    http://msdn.microsoft.com/en-us/library/bb399001.aspx

    Having the element runat=server gave me access to it from the codebehind, and placing it in the UpdatePanel let it actually be updated on the screen.

提交回复
热议问题