473,406 Members | 2,439 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,406 software developers and data experts.

sorting datagrid columns with variable names

I have a datagrid within a datagrid which is filled with data from an
SQL Server db. Each inner datagrid is populated by an sql statement
which contains a variable column name. Output looks something like
this:

Dept no_valid no_invalid
a 4 1
b 7 2
c 3 5

Team no_valid no_invalid
a1 2 1
a2 1 0
b1 3 0
The 2nd and 3rd column titles are always the same, the first column
title is taken from the variable column name in the SQL statement
(stored procedure). This is then passed to a string, and I do

<code>
e.Item.Cells(0).Text = str_header_name
</code>

in the subroutine that handles each line of the inner datagrid.

When I run the page, the second and third columns appear as hyperlinks
and allow me to sort. The first doesn't, cos it's name's a variable.

Is there any way for me to get this to appear as a hyperlink, and have
standard sort functionality?

Any help would be greatly appreciated, but please go easy on me, cos
I'm a total noob to asp.

Cheers.

Feb 28 '07 #1
2 1140
On 28 Feb, 11:46, davey.phill...@gmail.com wrote:
I have a datagrid within a datagrid which is filled with data from an
SQL Server db. Each inner datagrid is populated by an sql statement
which contains a variable column name. Output looks something like
this:

Dept no_valid no_invalid
a 4 1
b 7 2
c 3 5

Team no_valid no_invalid
a1 2 1
a2 1 0
b1 3 0

The 2nd and 3rd column titles are always the same, the first column
title is taken from the variable column name in the SQL statement
(stored procedure). This is then passed to a string, and I do

<code>
e.Item.Cells(0).Text = str_header_name
</code>

in the subroutine that handles each line of the inner datagrid.

When I run the page, the second and third columns appear as hyperlinks
and allow me to sort. The first doesn't, cos it's name's a variable.

Is there any way for me to get this to appear as a hyperlink, and have
standard sort functionality?

Any help would be greatly appreciated, but please go easy on me, cos
I'm a total noob to asp.

Cheers.
<<bump>>

Mar 1 '07 #2
Sorted.

I did a regex to replace the datagrid.HeaderText.

Problem solved.
Mar 2 '07 #3

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

Similar topics

12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
3
by: PeterZ | last post by:
Hi, In a running C# app with a datagrid control I select all rows in the dataGrid using CTRL-A, I then paste into some other app like notepad or Word but the column headings get left off. Is...
0
by: Robert Brinson | last post by:
Hello all! I'm running .NET Framework 1.1 using VS.NET 2003. I've got a mystery with a DataGrid. Below is the definition of the DataGrid from my aspx page: </asp:datagrid><asp:datagrid...
11
by: rkbnair | last post by:
I have created a datagrid in my aspx with the 'AllowSorting' property to true. When clicking on the column header, the page refreshes. However the sorting is not done. Am I missing anything? I...
0
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then...
4
by: cooltech77 | last post by:
Hi, I am trying to build the following functionality in the datagrid. I have a lot of columns in the datagrid which are being populated from the database and the user needs to scroll...
2
by: gane | last post by:
Hi I have a datagrid with bound columns generated in code behind with allowsorting set to true and OnSortCommand set to a sort function. I can see the sorted results only if i remove the...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
1
by: Ahmed Yasser | last post by:
Hi all, i have a problem with the datagridview sorting, the problem is a bit complicated so i hope i can describe in the following steps: 1. i have a datagridview with two columns...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.