Saturday, March 31, 2012

table run at server

I want to have an table like this
<table>
if session("userid") <> "" then
<tr><td><droplist></td></tr>
else
<tr><td><hiddeninput></td></tr>
end If

Anybody know how to solve that in .NET and codebehind?Hi,

HTML
=====


<TABLE id="Table1" border="0">
<TR>
<TD>
<asp:DropDownList id="DropDownList1" runat="server">
<asp:ListItem Value="BlahBlah">BlahBlah</asp:ListItem>
</asp:DropDownList>
</TD>
</TR>
</TABLE>

code-behind
===========


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Session("userid") <> "" Then
DropDownList1.Visible = True
Else
DropDownList1.Visible = False
End If

End Sub

HTH
Thanks, but i asked for the tablerow, cause I have labels and so on that don't is supposed to been shown either.

I solved it surfing around like. (My Row that is going to be hidden is Row #3.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Session("userid") <> "" Then
Table1.Rows(3).Visible = True
Else
Table1.Rows(3)..Visible = False
End If
End Sub

0 comments:

Post a Comment