473,703 Members | 3,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sortable/pagable datagrid with hyperlink column

I have a sample of an unbound (autogenerateco lumns 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
3 3541
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:HyperLinkF ield DataTextField=" CategoryName" HeaderText="Cli ck"
NavigateUrl="Ca tegoryName"
SortExpression= "CategoryNa me" Text="Click" />
</Columns>
</asp:GridView>

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

#DataControlFie ld.SortExpressi on Property
http://msdn2.microsoft.com/en-us/lib...rols.datacontr
olfield.sortexp ression.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: AcYMsFzwNmOJUPW tS6SAHezmSZPZrg ==
| X-WBNR-Posting-Host: 151.143.62.45
| From: "=?Utf-8?B?VFBoZWxwcw= =?=" <Un***********@ newsgroups.nosp am>
| Subject: Sortable/pagable datagrid with hyperlink column
| Date: Thu, 29 Dec 2005 11:45:03 -0800
| Lines: 10
| Message-ID: <4A************ *************** *******@microso ft.com>
| 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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3676 03
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| I have a sample of an unbound (autogenerateco lumns 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
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:HyperLinkF ield DataTextField=" CategoryName" HeaderText="Cli ck"
NavigateUrl="Ca tegoryName"
SortExpression= "CategoryNa me" Text="Click" />
</Columns>
</asp:GridView>

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

#DataControlFie ld.SortExpressi on Property
http://msdn2.microsoft.com/en-us/lib...rols.datacontr
olfield.sortexp ression.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: AcYMsFzwNmOJUPW tS6SAHezmSZPZrg ==
| X-WBNR-Posting-Host: 151.143.62.45
| From: "=?Utf-8?B?VFBoZWxwcw= =?=" <Un***********@ newsgroups.nosp am>
| Subject: Sortable/pagable datagrid with hyperlink column
| Date: Thu, 29 Dec 2005 11:45:03 -0800
| Lines: 10
| Message-ID: <4A************ *************** *******@microso ft.com>
| 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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3676 03
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| I have a sample of an unbound (autogenerateco lumns 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
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: AcYNj3UsCK4A2RG ETIiVDJNS6MEqTQ ==
| X-WBNR-Posting-Host: 151.143.62.45
| From: "=?Utf-8?B?VFBoZWxwcw= =?=" <Un***********@ newsgroups.nosp am>
| References: <4A************ *************** *******@microso ft.com>
<J#************ **@TK2MSFTNGXA0 2.phx.gbl>
| Subject: RE: Sortable/pagable datagrid with hyperlink column
| Date: Fri, 30 Dec 2005 14:22:02 -0800
| Lines: 91
| Message-ID: <97************ *************** *******@microso ft.com>
| 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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3678 23
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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:HyperLinkF ield DataTextField=" CategoryName" HeaderText="Cli ck"
| > NavigateUrl="Ca tegoryName"
| > SortExpression= "CategoryNa me" Text="Click" />
| > </Columns>
| > </asp:GridView>
| >
| > You can also set the SortExpression through Design-time User
Interface....
| >
| > #DataControlFie ld.SortExpressi on Property
| >
http://msdn2.microsoft.com/en-us/lib...rols.datacontr
| > olfield.sortexp ression.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: AcYMsFzwNmOJUPW tS6SAHezmSZPZrg ==
| > | X-WBNR-Posting-Host: 151.143.62.45
| > | From: "=?Utf-8?B?VFBoZWxwcw= =?=" <Un***********@ newsgroups.nosp am>
| > | Subject: Sortable/pagable datagrid with hyperlink column
| > | Date: Thu, 29 Dec 2005 11:45:03 -0800
| > | Lines: 10
| > | Message-ID: <4A************ *************** *******@microso ft.com>
| > | 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.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| > | Xref: TK2MSFTNGXA02.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:3676 03
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| > |
| > | I have a sample of an unbound (autogenerateco lumns 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3150
by: Ravikanth[MVP] | last post by:
Hi asp:DataGrid id="YourID" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="Sample Column"> <ItemTemplate> <asp:Hyperlink runat="server" Text='<% #Container.DataItem("TextVal")%>' NavigateUrl='<% # "page.aspx?Param1=" & Server.UrlEncode
2
2625
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four columns. Three are databound to a dataset and one is a template column. I need to be able to access each item in the template column (getting access to the hyperlink) then adding an attribute to call some client side code. Does anyone know...
9
15017
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring = datagrid.Items(rownumber).Cells.Item(column number).Text returns a blank string. It seems to work ok for the other columns that are just regular datagrid columns, not hyperlink types. Thanks. -- Paul G Software engineer.
4
2686
by: chuckdfoster | last post by:
I am needing to creat a Sign In/Out Board ASP.NET page. I was going to use a datagrid with everyone's name, in/out, location, and time in it. This data will be stored on a MS SQL Server. I need a person to be able to click the in/out column and have it sign them out or give them a page that will let them change their status of in or out (preferrably send them to another page). Can someone tell me how to make a "clickable" datagrid and...
4
4402
by: sakieboy | last post by:
I currently have a datagrid with several columns. The first column in the DataGrid is a HyperLinkColumn. When I select a row, I would like for this HyperlinkColumn to fire. I have the mouseover colors changing, and I have the routine, but I can't seem to get the HyperLinkColumn to fire.... Private Sub MyDataGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles...
2
1841
by: Fabrice | last post by:
Hello, First, thanks to felix for his answer. But :-( , I'm feeling newbie :! I' don't understand all the situation. The trouble : Always in the road whith my Datagrid and my ItemTemplate with a Control HyperLink. I would like to fix many properties of this Control Hyperlink in the Code
0
2620
by: cedoucette | last post by:
I just wrote code to support sortable columns in a datagrid. It seems to work fine; but, it doesn't look right. The problem is that I have a generic style for links and a different style for the header row - and they conflict. The sortable column apparently uses the generic style for <a> elements and the rest of the header uses "headerRow". Can anyone tell me how to get consistent styles for each column in my datagrid header?
17
7428
by: Mike Fellows | last post by:
im trying (unsucessfully) to add a checkbox column to my datagrid i basically have a datagrid that im populating from a dataset Me.DataGrid1.DataSource = ds.Tables(0) the datagrid then has 5 columns in it but i need to add a sixth column which will be my checkbox column - any help or pointers with this would be great
2
3440
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3 datagrida. I would like to set it so that if value of column 3 in datagrid 1 is < 100 set to red, if = 100 set to green if value of column 3 in datagrid 2 is < 90 set to red, if >= 90 set to green if value of column 3 in datagrid 3is < 80 set to red,...
0
8672
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9123
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9017
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8969
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7876
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5923
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2070
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.