473,545 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I set the CssClass for a GridView sorting link?

rob
Hi,

If I set "AllowSorting=t rue" on a GridView in ASP.NET 2.0, it adds a
hyperlink to the top of each column. How do I apply a CssClass directly
to that hyperlink? I've tried every property I can find.

Thanks,

Rob

Feb 10 '06 #1
1 1270
I wrote a function that iterates thru all the controls recursively in
any given control and returns all of a certain type. You can use this
to find all the linkbutton in ItemCreated and set the cssclass.

private static void FindControlRecu rsive(Type type, Control control,
ref ArrayList arrayListContro ls, bool recurse)
{
foreach (Control subcontrol in control.Control s)
{
if (recurse)
FindControlRecu rsive(type, subcontrol, ref arrayListContro ls,
true);

if (subcontrol.Get Type ().IsSubclassOf (type) || subcontrol.GetT ype
() == type)
arrayListContro ls.Add(subcontr ol);
}
}

Feb 10 '06 #2

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

Similar topics

0
2714
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update not the whole page, but a portion of the page. Strangely enough the URL below ...
0
1305
by: Dorte | last post by:
Hi, I use the gridview control to display data. I use a dataadapter to fill a datatable from an SQL server - the command is a stored procedure. Furthermore I have a couple of template columns (one with a "Lookup" function that displays customized data in the column). When using the gridview built in support for sorting, data should be...
0
924
by: sloan | last post by:
I'm working on a application where I have 1 page which shows a GridView. I have this page working...with sorting, with paging...and I'm caching the first resultset,... to avoid unnecessary db calls after the first db hit. ... The page needs to be called ... for 3 different reasons.
1
1198
by: Dave | last post by:
Maybe I'm missing something, but in the Sorting event of the Gridview, the GridViewSortEventArgs.SortDirection is always Ascending. I'm not sure why?
5
5964
by: Cindy Lee | last post by:
I'm getting my data from an XML file. The data binds fine, but I can't sort on it. Do I have to do anything special? I have enabled sorting on my grid view. Autogenerate columns is off, and I use bound fields. The sort expression is just the same datafield that binds the column, but when I try to sort with the post back, nothing works.
4
11130
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have a vb.net 2.0 app that is loading a GridView with a DataSource that is returned from a function. The definitions in the function are: Dim ReportDS As DataSet = New DataSet Dim ReportTable As System.Data.DataTable = New System.Data.DataTable("SendTo") The ReportTable is populated row by row by data gotten back from the
2
4549
by: MikeB | last post by:
Hello All, I just added sorting to my gridview and it messed up my headers. I do not want the test to display as blue and I can not seem to figure out what I need to do to get it back to my normal formatting. Here is what I current have the style set to, can any one help me get it back to my original style before I added sorting? TIA ...
4
11894
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 retrieved and showed in this GridView produce more than one page of data. A given user clicks on the first row hyper link on the Grid on the first...
1
2739
by: Jonathan Wood | last post by:
Greetings, On a GridView control, I want to show alternating colors. But instead of alternating on each row, I want to alternate each group. So several items would be one color and the next several items would be another color. I'm able to accomplish this by setting the CssClass property in the GridView's RowDataBound event handler. ...
0
7468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.