Monday, October 3, 2011

Two Databound Fields in Gridview column

Boundfields are great in the Gridview, but they do have their limitations.
One is that it only has room for one bound field. So, what do you do when you want two or data fields.
For example, First and Last names returned to the same column.
Turn the BoundField into a TemplateField, with a label in it:

<asp:templatefield>
 <itemtemplate>               
  <asp:label id="lblname" runat="server" text="<%# Eval("Lname") +, "" + Eval("Fname") %>" />            
 </itemtemplate>
</asp:templatefield>

Hire Me

Follow me on Facebook

Follow me

Do you find this Blog helpful?

Follow by Email

About Me

My Photo
Expert Senior Software Developer

Microsoft Business Card