1
Answer

Insert new row and label/textbox in template field.

Angel Park

Angel Park

14y
3.6k
1
Hi Experts,

I have a gridview consists of template field.  I want to insert a new horizontally column between some of my gridview databound results and i did this, 

DataRow blankRow = dtPerformance.NewRow();
blankRow["performanceID"] = "";
dtPerformance.Rows.InsertAt(blankRow, 3);

how do i add a textbook/label in between the template field using the new blank row i created?

Hope you can help! Thanks.

Cheers,
Angel
Answers (1)
0
Amit Choudhary

Amit Choudhary

NA 27.7k 3m 14y
Hi friend,

See below example create the two template with <Item.. > and <Edit..> templates.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EmployeeID" DataSourceID="ObjectDataSource1">
 <Columns>
<asp:TemplateField HeaderText="Name" SortExpression="FirstName">
 <EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
</EditItemTemplate>
 <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label> <asp:Label ID="Label2" runat="server" Text='<%# Eval("LastName") %>'></asp:Label>
</ItemTemplate>

 </Columns> </asp:GridView>

Try it out hope this helps you..