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.P age.
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:LinkButt on ID="TabA"
SkinID="Tab-On"
EnableViewState ="false"
CausesValidatio n="false"
OnCommand="TabA _OnCommand"
Text="TabA" runat="server"/>
// TabA Event handler
protected void TabA_OnCommand( object sender,
EventArgs e)
{
Session["selectedTa b"] = "TabA";
// To be replaced with ListView
Label feedbackLabel =
Master...FindCo ntrol("feedback Label")
as Label;
feedbackLabel.T ext =
string)Session["selectedTa b"];
}
//PreInit
string thisPage =
Path.GetFileNam e(Request.Physi calPath);
if (IsPostBack)
{
if (!HttpContext.C urrent.User.Ide ntity.IsAuthent icated
&& thisPage == "BigPainInTheAs s.aspx")
{
LinkButton TabA = Master...FindCo ntrol("TabA")
as LinkButton;
LinkButton TabB = Master...FindCo ntrol("TabB")
as LinkButton;
LinkButton TabC = Master...FindCo ntrol("TabC")
as LinkButton;
string selectedTab = (string)Session["selectedTa b"];
if (!String.IsNull OrEmpty(selecte dTab))
{
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.P age.
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:LinkButt on ID="TabA"
SkinID="Tab-On"
EnableViewState ="false"
CausesValidatio n="false"
OnCommand="TabA _OnCommand"
Text="TabA" runat="server"/>
// TabA Event handler
protected void TabA_OnCommand( object sender,
EventArgs e)
{
Session["selectedTa b"] = "TabA";
// To be replaced with ListView
Label feedbackLabel =
Master...FindCo ntrol("feedback Label")
as Label;
feedbackLabel.T ext =
string)Session["selectedTa b"];
}
//PreInit
string thisPage =
Path.GetFileNam e(Request.Physi calPath);
if (IsPostBack)
{
if (!HttpContext.C urrent.User.Ide ntity.IsAuthent icated
&& thisPage == "BigPainInTheAs s.aspx")
{
LinkButton TabA = Master...FindCo ntrol("TabA")
as LinkButton;
LinkButton TabB = Master...FindCo ntrol("TabB")
as LinkButton;
LinkButton TabC = Master...FindCo ntrol("TabC")
as LinkButton;
string selectedTab = (string)Session["selectedTa b"];
if (!String.IsNull OrEmpty(selecte dTab))
{
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