Datagrid versus Gridview

A

Arne Garvander

The code below works fine in a DataGrid.
<asp:TemplateColumn HeaderText="Select">
<ItemTemplate>
<%# GetLink(Container.DataItem) %>
</ItemTemplate>
</asp:TemplateColumn>
What is the corresponding syntax for Gridview?
 
K

Ken Cox - Microsoft MVP

It isn't clear to me what your sample is doing.

Here's a sample that might help:

<asp:gridview id="GridView1" runat="server"
onprerender="GridView1_PreRender">
<columns>
<asp:templatefield headertext="Artist" sortexpression="Artist">
<itemtemplate>
<asp:label id="Label1" runat="server" text='<%#
GetLink(Container.DataItem("Artist")) %>'></asp:label>
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
 
A

Arne Garvander

Ken,
Thanks for the tip. I had to make a change to get it to work.
<asp:label id="Label1" runat="server" text='<%#
MyEdits((DataRowView)Container.DataItem) %>'></asp:label>

--
Arne Garvander
(I program VB.Net for fun and C# to get paid.)


Ken Cox - Microsoft MVP said:
It isn't clear to me what your sample is doing.

Here's a sample that might help:

<asp:gridview id="GridView1" runat="server"
onprerender="GridView1_PreRender">
<columns>
<asp:templatefield headertext="Artist" sortexpression="Artist">
<itemtemplate>
<asp:label id="Label1" runat="server" text='<%#
GetLink(Container.DataItem("Artist")) %>'></asp:label>
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top