Sortable/pagable datagrid with hyperlink column

G

Guest

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.
 
S

Steven Cheng[MSFT]

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/library/system.web.ui.webcontrols.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==?=" <[email protected]>
| Subject: Sortable/pagable datagrid with hyperlink column
| Date: Thu, 29 Dec 2005 11:45:03 -0800
| Lines: 10
| Message-ID: <[email protected]>
| 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.
|
 
G

Guest

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...
 
S

Steven Cheng[MSFT]

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==?=" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
| Subject: RE: Sortable/pagable datagrid with hyperlink column
| Date: Fri, 30 Dec 2005 14:22:02 -0800
| Lines: 91
| Message-ID: <[email protected]>
| 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/library/system.web.ui.webcontrols.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==?=" <[email protected]>
| > | Subject: Sortable/pagable datagrid with hyperlink column
| > | Date: Thu, 29 Dec 2005 11:45:03 -0800
| > | Lines: 10
| > | Message-ID: <[email protected]>
| > | 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.
| > |
| >
| >
|
 

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

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top