Dovberman
asked on
How to set the table cell visible property in code.
I set the visible property of a table cell to false.
I can set the property to true in the Page_Load procedure.
The property is not set in any other procedure.
ASPX file
=======
<asp:TableCell ID="celMenu" Visible="False">
Code Behind
protected void Page_Load(object sender, EventArgs e)
{
celMenu.Visible = true; // celMenu becomes visible
if (!IsPostBack)
{
StockProLogin.Focus();
//mnuScoreStocks.Visible = false;
celMenu.Visible = true; // celMenu becomes visible
}
}
if (currentUser != null) // User is in database
// Determine user status
{
// Verify registration status
strUserName = currentUser.UserName;
strUserID = currentUser.ProviderUserKe y.ToString ();
e.Authenticated = (strUserName == "dovberman");
if (e.Authenticated==true)
{
strUserName = StockProLogin.UserName;
strUserID = currentUser.ProviderUserKe y.ToString ();
string strLoginText = "Hi " + StockProLogin.UserName + " You are logged in";
lblLoginMsg.Text = strLoginText;
// lblLoginMsg. Text displays as expected.
celMenu.Visible = true; // celMenu does not become visible
}
else // User is not in database
{
e.Authenticated = false;
StockProLogin.FailureText = StockProLogin.UserName + ". You were not found. Re-enter User Name and or Password.";
// StockProLogin.FailureText displays as expected.
celMenu.Visible = false;
}
}
Please help.
Thanks
I can set the property to true in the Page_Load procedure.
The property is not set in any other procedure.
ASPX file
=======
<asp:TableCell ID="celMenu" Visible="False">
Code Behind
protected void Page_Load(object sender, EventArgs e)
{
celMenu.Visible = true; // celMenu becomes visible
if (!IsPostBack)
{
StockProLogin.Focus();
//mnuScoreStocks.Visible = false;
celMenu.Visible = true; // celMenu becomes visible
}
}
if (currentUser != null) // User is in database
// Determine user status
{
// Verify registration status
strUserName = currentUser.UserName;
strUserID = currentUser.ProviderUserKe
e.Authenticated = (strUserName == "dovberman");
if (e.Authenticated==true)
{
strUserName = StockProLogin.UserName;
strUserID = currentUser.ProviderUserKe
string strLoginText = "Hi " + StockProLogin.UserName + " You are logged in";
lblLoginMsg.Text = strLoginText;
// lblLoginMsg. Text displays as expected.
celMenu.Visible = true; // celMenu does not become visible
}
else // User is not in database
{
e.Authenticated = false;
StockProLogin.FailureText = StockProLogin.UserName + ". You were not found. Re-enter User Name and or Password.";
// StockProLogin.FailureText displays as expected.
celMenu.Visible = false;
}
}
Please help.
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I appreciate your interest. Meanwhile, I resolved it. See my previous post.
ASKER
Page_Load
If Admin not logged in
Display message for Admin to log in and select the page again from the site.menu.
If Admin logged in
Open the page and display the table cell that contains the menu.
aspx:
<asp:Table ID="Table1" runat="server" Height="2.52in" Width="284px">
<asp:TableRow>
<asp:TableCell ID="celMenu" Visible="False" >
<ul>
<li><a id="mnuHiPerf" runat="server" href="~/Admin/FindPriceExc
<li><a id="mnuWatchList" runat="server" href="~/Admin/WatchListNew
<li><a id="mnuScoreStocks" runat="server" href="~/Contact" >Score Stocks</a></li>
Page_Load
if (User.Identity.IsAuthentic
{
strUserName = User.Identity.Name;
strUserID = currentUser.ProviderUserKe
if (strUserName == "AdminName")
{
celMenu.Visible = true; // Menu is now visible
}
conStockSelect.Close();
}
else
{
strUserName = "Guest";
}
// End If user authenticated