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

Choosing a datagrid column

P: n/a
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
From my understanding of this, I believe I have two courses I could


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:

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:
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:
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">
<%# DataBinder.Eval(Container.DataItem, "Value.MemberName")
%> </ItemTemplate>

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

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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.