Retrieve GridView column header text on sort

N

Necqui Teja

How do I programmatically retrieve GridView column header text on a
BoundField when the user click on the header sort button?

I know about the GridView columns collection, but how do I get the column id
that corresponds with the sort button that the user clicked on?

Thanks in advance,

Necqui
 
S

Steven Cheng[MSFT]

Hi Necqui,

Welcome to ASPNET newsgroup.
As for the retrieving and setting a certain BoundField's Header text in
GridView, based on my research, since the GridView's Columns collection
only support index accessor, I'm afraid currently we have to loop through
the Columns collection and compare each Field's SortExpression with the
current sorting column and get the correct sorting column we want. and the
GridView's sorting event is the proper place to put the code. Also, if it
is possible that we hard code a function which help mapping sortexpression
string to an int index, that'll be much better for performance
consideration. (But for dynamically peform such task, we have to loop the
columns collection).

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)






--------------------
| From: "Necqui Teja" <[email protected]>
| Subject: Retrieve GridView column header text on sort
| Date: Thu, 10 Nov 2005 11:51:30 -0800
| Lines: 11
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: 216.57.203.121
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:31064
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| How do I programmatically retrieve GridView column header text on a
| BoundField when the user click on the header sort button?
|
| I know about the GridView columns collection, but how do I get the column
id
| that corresponds with the sort button that the user clicked on?
|
| Thanks in advance,
|
| Necqui
|
|
|
 
S

Steven Cheng[MSFT]

Hi Necqui,

Any further progress on this issue? Just post to see whether there're
anything else we can help.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 78665377
| References: <#[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Fri, 11 Nov 2005 04:18:53 GMT
| Subject: RE: Retrieve GridView column header text on sort
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Lines: 52
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:31077
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Necqui,
|
| Welcome to ASPNET newsgroup.
| As for the retrieving and setting a certain BoundField's Header text in
| GridView, based on my research, since the GridView's Columns collection
| only support index accessor, I'm afraid currently we have to loop through
| the Columns collection and compare each Field's SortExpression with the
| current sorting column and get the correct sorting column we want. and
the
| GridView's sorting event is the proper place to put the code. Also, if
it
| is possible that we hard code a function which help mapping
sortexpression
| string to an int index, that'll be much better for performance
| consideration. (But for dynamically peform such task, we have to loop the
| columns collection).
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
|
|
| --------------------
| | From: "Necqui Teja" <[email protected]>
| | Subject: Retrieve GridView column header text on sort
| | Date: Thu, 10 Nov 2005 11:51:30 -0800
| | Lines: 11
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| | X-RFC2646: Format=Flowed; Original
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| | Message-ID: <#[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | NNTP-Posting-Host: 216.57.203.121
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:31064
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| |
| | How do I programmatically retrieve GridView column header text on a
| | BoundField when the user click on the header sort button?
| |
| | I know about the GridView columns collection, but how do I get the
column
| id
| | that corresponds with the sort button that the user clicked on?
| |
| | Thanks in advance,
| |
| | Necqui
| |
| |
| |
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top