473,382 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

LinkButton requires two UI clicks to change cssclass property

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.IsAuthenticate d
&& 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

Aug 16 '08 #1
0 2029

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: clintonG | last post by:
Any folklore regarding the benefits of using one or the other of these controls? <%= Clinton Gallagher METROmilwaukee (sm) "A Regional Information Service" NET csgallagher AT...
1
by: Sandy | last post by:
I have a repeater which shows Group names. (Skip this part if you want rather irrelevant) The groups are ordered and formatted: Parent ---Child ------Grand Child (okay start reading again...
2
by: Jensen bredal | last post by:
I'am trying to change the style of my LinkButton control . I have a set of five control and i need to hilight the selected one. I want to achive this by setting MyLinkButton.CssClass="newStyle"...
0
by: Solomon Shaffer | last post by:
This is very interesting - and odd. I have a number of LinkButtons that are created in a custom data grid that I created. The purpose of the LinkButtons is to provide alphabetical filtering...
3
by: tshad | last post by:
I have a page where I want to set my linkbutton text using a class and cannot seem to get it to work using CSSClass, but it works fine using "ForeColor". Why is that? Here is the code:...
3
by: John | last post by:
Hi I have been trying to change the css class of a linkbutton without succes ( I dont want to change the cssclass property). Maybe somebody knowshow to do this?? th.John <%@ Page...
13
by: rn5a | last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to show him 5 LinkButtons (one for each order) so that when he clicks the first LinkButton, he would be shown the details of his...
4
by: Jeff | last post by:
Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the ASP.NET GridView with paging and sorting. One of the columns of this Gridview is a template column (LinkButton). The data being...
0
by: jeenajos | last post by:
Hi all, I dono wat happen to my code. It was working quite fine. But now link button click event is not firing. This linkbutton was used for navigation; first,next,previous,last. Can anyone...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.