By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,077 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

Sortable/pagable datagrid with hyperlink column

P: n/a
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable
datagrid that works.

I want to change one of the columns to a hyperlink. The examples I find use
a bound column. I can get this to work; however, the column header on the
datagrid is not a link/sortable.

What am I missing?

Thanks in advance.
Dec 29 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

Welcome to ASPNET newsgroup.
As for the GridView sorting problem you mentioned, I think it is possibly
caused by the sortExpression setting of the HyperLink column you created.
For GridView sorting, it require that each column(which want to be
sortable) provide the SortExpression in its column setting. So when you
manually create a HyperLink column, by default its SortExpression is empty,
have you manually assigned the SortExpression of it to the correct
DataBound field? e.g:

<asp:HyperLinkField DataTextField="CategoryName" HeaderText="Click"
NavigateUrl="CategoryName"
SortExpression="CategoryName" Text="Click" />
</Columns>
</asp:GridView>

You can also set the SortExpression through Design-time User Interface....

#DataControlField.SortExpression Property
http://msdn2.microsoft.com/en-us/lib...rols.datacontr
olfield.sortexpression.aspx
Hope this helps. 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.)
--------------------
| Thread-Topic: Sortable/pagable datagrid with hyperlink column
| thread-index: AcYMsFzwNmOJUPWtS6SAHezmSZPZrg==
| X-WBNR-Posting-Host: 151.143.62.45
| From: "=?Utf-8?B?VFBoZWxwcw==?=" <Un***********@newsgroups.nospam>
| Subject: Sortable/pagable datagrid with hyperlink column
| Date: Thu, 29 Dec 2005 11:45:03 -0800
| Lines: 10
| Message-ID: <4A**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:367603
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I have a sample of an unbound (autogeneratecolumns is true)
sortable/pagable
| datagrid that works.
|
| I want to change one of the columns to a hyperlink. The examples I find
use
| a bound column. I can get this to work; however, the column header on
the
| datagrid is not a link/sortable.
|
| What am I missing?
|
| Thanks in advance.
|

Dec 30 '05 #2

P: n/a
That was it; however, I have another problem now.

There is a graphic (up or down arrow) displayed next to the bound column I
added. Each time I click on that column (at run time) a new graphic is added
to the column heading! i.e. if I click to repeatly sort on it (ascending,
descending, ...) 5 times, I get an up arrow, down arrow, up arrow, down
arrow, up arrow graphics next to the header text.

I tried looking at the header image property but it currently has no value.

Any suggestions?

Thanks in advance...

"Steven Cheng[MSFT]" wrote:
Hi,

Welcome to ASPNET newsgroup.
As for the GridView sorting problem you mentioned, I think it is possibly
caused by the sortExpression setting of the HyperLink column you created.
For GridView sorting, it require that each column(which want to be
sortable) provide the SortExpression in its column setting. So when you
manually create a HyperLink column, by default its SortExpression is empty,
have you manually assigned the SortExpression of it to the correct
DataBound field? e.g:

<asp:HyperLinkField DataTextField="CategoryName" HeaderText="Click"
NavigateUrl="CategoryName"
SortExpression="CategoryName" Text="Click" />
</Columns>
</asp:GridView>

You can also set the SortExpression through Design-time User Interface....

#DataControlField.SortExpression Property
http://msdn2.microsoft.com/en-us/lib...rols.datacontr
olfield.sortexpression.aspx
Hope this helps. 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.)
--------------------
| Thread-Topic: Sortable/pagable datagrid with hyperlink column
| thread-index: AcYMsFzwNmOJUPWtS6SAHezmSZPZrg==
| X-WBNR-Posting-Host: 151.143.62.45
| From: "=?Utf-8?B?VFBoZWxwcw==?=" <Un***********@newsgroups.nospam>
| Subject: Sortable/pagable datagrid with hyperlink column
| Date: Thu, 29 Dec 2005 11:45:03 -0800
| Lines: 10
| Message-ID: <4A**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:367603
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I have a sample of an unbound (autogeneratecolumns is true)
sortable/pagable
| datagrid that works.
|
| I want to change one of the columns to a hyperlink. The examples I find
use
| a bound column. I can get this to work; however, the column header on
the
| datagrid is not a link/sortable.
|
| What am I missing?
|
| Thanks in advance.
|

Dec 30 '05 #3

P: n/a
Thanks for your response,

Seems strange behavior. I think it should be code logic specific, are you
dynamically adding the image in that column's header section? Would you
provide some further code snippet on that column and the related code so
that we can have a look?

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.)
--------------------
| Thread-Topic: Sortable/pagable datagrid with hyperlink column
| thread-index: AcYNj3UsCK4A2RGETIiVDJNS6MEqTQ==
| X-WBNR-Posting-Host: 151.143.62.45
| From: "=?Utf-8?B?VFBoZWxwcw==?=" <Un***********@newsgroups.nospam>
| References: <4A**********************************@microsoft.co m>
<J#**************@TK2MSFTNGXA02.phx.gbl>
| Subject: RE: Sortable/pagable datagrid with hyperlink column
| Date: Fri, 30 Dec 2005 14:22:02 -0800
| Lines: 91
| Message-ID: <97**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:367823
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| That was it; however, I have another problem now.
|
| There is a graphic (up or down arrow) displayed next to the bound column
I
| added. Each time I click on that column (at run time) a new graphic is
added
| to the column heading! i.e. if I click to repeatly sort on it
(ascending,
| descending, ...) 5 times, I get an up arrow, down arrow, up arrow, down
| arrow, up arrow graphics next to the header text.
|
| I tried looking at the header image property but it currently has no
value.
|
| Any suggestions?
|
| Thanks in advance...
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi,
| >
| > Welcome to ASPNET newsgroup.
| > As for the GridView sorting problem you mentioned, I think it is
possibly
| > caused by the sortExpression setting of the HyperLink column you
created.
| > For GridView sorting, it require that each column(which want to be
| > sortable) provide the SortExpression in its column setting. So when you
| > manually create a HyperLink column, by default its SortExpression is
empty,
| > have you manually assigned the SortExpression of it to the correct
| > DataBound field? e.g:
| >
| > <asp:HyperLinkField DataTextField="CategoryName" HeaderText="Click"
| > NavigateUrl="CategoryName"
| > SortExpression="CategoryName" Text="Click" />
| > </Columns>
| > </asp:GridView>
| >
| > You can also set the SortExpression through Design-time User
Interface....
| >
| > #DataControlField.SortExpression Property
| >
http://msdn2.microsoft.com/en-us/lib...rols.datacontr
| > olfield.sortexpression.aspx
| >
| >
| > Hope this helps. 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.)
| >
| >
| > --------------------
| > | Thread-Topic: Sortable/pagable datagrid with hyperlink column
| > | thread-index: AcYMsFzwNmOJUPWtS6SAHezmSZPZrg==
| > | X-WBNR-Posting-Host: 151.143.62.45
| > | From: "=?Utf-8?B?VFBoZWxwcw==?=" <Un***********@newsgroups.nospam>
| > | Subject: Sortable/pagable datagrid with hyperlink column
| > | Date: Thu, 29 Dec 2005 11:45:03 -0800
| > | Lines: 10
| > | Message-ID: <4A**********************************@microsoft.co m>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:367603
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | I have a sample of an unbound (autogeneratecolumns is true)
| > sortable/pagable
| > | datagrid that works.
| > |
| > | I want to change one of the columns to a hyperlink. The examples I
find
| > use
| > | a bound column. I can get this to work; however, the column header
on
| > the
| > | datagrid is not a link/sortable.
| > |
| > | What am I missing?
| > |
| > | Thanks in advance.
| > |
| >
| >
|

Jan 3 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.