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 DataGridEventAr gs.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:ButtonColu mn
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:ButtonColu mn
HeaderText = "Member Name"
DataTextField = "Value.MemberNa me" />
The grid won't bind the DataBind() call.
Neither can I use the DataBinder single-value binding on the
ButtonColumn event like so:
<asp:ButtonColu mn
HeaderText = "Member Name"
DataTextField = '<%# DataBinder.Eval (Container.Data Item,
"Value.MemberNa me")%>' />
because the ButtonColumn class does not support the DataBinding event.
2. Use the TemplateColumn. If I use the TemplateColumn like so,
<asp:TemplateCo lumn HeaderText="Mem ber Name">
<ItemTemplate >
<%# DataBinder.Eval (Container.Data Item, "Value.MemberNa me")
%> </ItemTemplate>
</asp:TemplateCol umn>
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.Collecti ons.DictionaryB ase, and
such that clicking on the links post back to the same page?