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

Choosing a datagrid column

I want to display a column in a datagrid such that each item/row in
that column acts as a hyperlink. Further, when I click on the
hyperlink, it doesn't redirect to another page or even to itself.
Rather it "POSTS" pack to itself, and fetches the values in the entire
row into the textboxes displayed on the same page outside of the data
grid.
From my understanding of this, I believe I have two courses I could

follow.

1. To take a ButtomColumn for the column under question. When the
button column is clicked, I get the row as DataGridEventArgs.Item in
the OnItemCommand handler I define.

This would've worked all well for me had I not made the DataSource of
the grid my own defined class that derives from DictionaryBase. The
class, let's call it Group, is a strongly types collection of a class
GroupMember. GroupMember, let's assume, has three properties, ID,
MemberName and Email. The column I need to make a hyperlink is the
MemberName column.

Since the datasource of the grid is a collection and not a dataset, I
cannot use the DataTextField property like so:

<asp:ButtonColumn
HeaderText = "Member Name"
DataTextField = "MemberName" />

because the collection does not have a property called MemberName.
Instead, it has a key property and a Value property. The value property
is the GroupMember Object that has a MemberName property. However, I
cannot even do this:
<asp:ButtonColumn
HeaderText = "Member Name"
DataTextField = "Value.MemberName" />

The grid won't bind the DataBind() call.

Neither can I use the DataBinder single-value binding on the
ButtonColumn event like so:
<asp:ButtonColumn
HeaderText = "Member Name"
DataTextField = '<%# DataBinder.Eval(Container.DataItem,
"Value.MemberName")%>' />
because the ButtonColumn class does not support the DataBinding event.

2. Use the TemplateColumn. If I use the TemplateColumn like so,

<asp:TemplateColumn HeaderText="Member Name">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Value.MemberName")
%> </ItemTemplate>
</asp:TemplateColumn>

It works fine but I do not have hyperlinks, so the main purpose is not
solved.

Can you please suggest me a solution to my problem? How do I get a
hyperlinked column into the grid that reads values from the datasource
of the grid, which is of type System.Collections.DictionaryBase, and
such that clicking on the links post back to the same page?

Nov 19 '05 #1
0 1106

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

Similar topics

5
by: Jean Carlo | last post by:
Hello guys I`m developing a windows form that contain one Datagrid. In this datagrid I insert a checkBox Column. I need to get all rows where checkbox is checked by user. How do I get this...
0
by: Pietje de kort | last post by:
Hello, why is the System.Windows.Forms.DataGrid so un-customizable? I am trying to build a DataGrid that will resize it's last column when there is room left over (make it fill the total...
2
by: Julie | last post by:
I have the following need for a custom control. Two columns, n rows. Column 1 is simple text (non-editable). Column 2 is drop-down combo boxes (1 for each row). Needs to be sortable (with...
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: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
4
by: Anthony | last post by:
Hi Folks, I'm adding some columns to my datagrid which are of Combo Box type. I'm inheriting DataGridTextBoxColumn and doing all the usual stuff to get them populated. This is working fine. I...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
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
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
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...
0
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...
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.