H
HillBilly
MasterPages again. Three LinkButtons are being used as styled tabs in the
content page that will load a different ListView when a tab is selected:
TabA, TabB or TabC. The LinkButtons are declared in the apsx and the
LinkButtons are being found in their MasterPage container template(s).
Enabling and disabling the SkinId and CssClass properties for each
LinkButton is being handled in the PreInit of a GlobalBaseClass that
inherits from System.Web.UI.Page.
When a tab is selected a feedbackLabel is updated to indicate which tab was
selected confirming which LinkButton event handler changed the text property
of the feedbackLabel --but-- the style properties are not being updated in
the page until one of any of the three tabs are clicked a second time. The
code which changes the style properties is and must be written into PrInit.
I am using the LinkButton as a command button declared using OnCommand.
However, I must still determine how to resolve the need to click tabs twice
to ensure the displayed tabbed style is consistent with the state of the
rest of the page.
Secondly, what should I consider in the code to evaluate how it has been
written for this type of task? I don't know how to debug this circumstance.
// typical LinkButton declaration
<asp:LinkButton ID="TabA"
SkinID="Tab-On"
EnableViewState="false"
CausesValidation="false"
OnCommand="TabA_OnCommand"
Text="TabA" runat="server"/>
// TabA Event handler
protected void TabA_OnCommand(object sender,
EventArgs e)
{
Session["selectedTab"] = "TabA";
// To be replaced with ListView
Label feedbackLabel =
Master...FindControl("feedbackLabel")
as Label;
feedbackLabel.Text =
string)Session["selectedTab"];
}
//PreInit
string thisPage =
Path.GetFileName(Request.PhysicalPath);
if (IsPostBack)
{
if (!HttpContext.Current.User.Identity.IsAuthenticated
&& thisPage == "BigPainInTheAss.aspx")
{
LinkButton TabA = Master...FindControl("TabA")
as LinkButton;
LinkButton TabB = Master...FindControl("TabB")
as LinkButton;
LinkButton TabC = Master...FindControl("TabC")
as LinkButton;
string selectedTab = (string)Session["selectedTab"];
if (!String.IsNullOrEmpty(selectedTab))
{
switch (selectedTab)
{
case "TabA":
TabA.SkinID = "...";
TabA.CssClass = "...";
...
...
break;
case "TabB":
TabB.SkinID = "...";
TabB.CssClass = "...";
...
...
break;
case "TabC":
TabC.SkinID = "...";
TabC.CssClass = "...";
...
...
break;
default:
...
break;
}//switch
}//if selectedTab
}//if IsAuthenticated
}// if IsPostBack
content page that will load a different ListView when a tab is selected:
TabA, TabB or TabC. The LinkButtons are declared in the apsx and the
LinkButtons are being found in their MasterPage container template(s).
Enabling and disabling the SkinId and CssClass properties for each
LinkButton is being handled in the PreInit of a GlobalBaseClass that
inherits from System.Web.UI.Page.
When a tab is selected a feedbackLabel is updated to indicate which tab was
selected confirming which LinkButton event handler changed the text property
of the feedbackLabel --but-- the style properties are not being updated in
the page until one of any of the three tabs are clicked a second time. The
code which changes the style properties is and must be written into PrInit.
I am using the LinkButton as a command button declared using OnCommand.
However, I must still determine how to resolve the need to click tabs twice
to ensure the displayed tabbed style is consistent with the state of the
rest of the page.
Secondly, what should I consider in the code to evaluate how it has been
written for this type of task? I don't know how to debug this circumstance.
// typical LinkButton declaration
<asp:LinkButton ID="TabA"
SkinID="Tab-On"
EnableViewState="false"
CausesValidation="false"
OnCommand="TabA_OnCommand"
Text="TabA" runat="server"/>
// TabA Event handler
protected void TabA_OnCommand(object sender,
EventArgs e)
{
Session["selectedTab"] = "TabA";
// To be replaced with ListView
Label feedbackLabel =
Master...FindControl("feedbackLabel")
as Label;
feedbackLabel.Text =
string)Session["selectedTab"];
}
//PreInit
string thisPage =
Path.GetFileName(Request.PhysicalPath);
if (IsPostBack)
{
if (!HttpContext.Current.User.Identity.IsAuthenticated
&& thisPage == "BigPainInTheAss.aspx")
{
LinkButton TabA = Master...FindControl("TabA")
as LinkButton;
LinkButton TabB = Master...FindControl("TabB")
as LinkButton;
LinkButton TabC = Master...FindControl("TabC")
as LinkButton;
string selectedTab = (string)Session["selectedTab"];
if (!String.IsNullOrEmpty(selectedTab))
{
switch (selectedTab)
{
case "TabA":
TabA.SkinID = "...";
TabA.CssClass = "...";
...
...
break;
case "TabB":
TabB.SkinID = "...";
TabB.CssClass = "...";
...
...
break;
case "TabC":
TabC.SkinID = "...";
TabC.CssClass = "...";
...
...
break;
default:
...
break;
}//switch
}//if selectedTab
}//if IsAuthenticated
}// if IsPostBack