.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

template field in gridview

Posted By: sridar1     Posted Date: February 17, 2011    Points:2   Category :ASP.Net
Hai,

I have some doubt in grid view.plz rectify it.
In gridview we are using the command field for edit,update,delete and bound field for entering column headers.But my doubt is that where we use the template field like item template,edititem template.

Responses
Author: shankey             
Posted Date: February 17, 2011     Points: 5   

hi,

following will clear your doubt
<asp:GridView ID="dgv" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
CssClass="GridViewStyle" GridLines="None" Width="100%" OnRowDataBound="dgv_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Name">
<HeaderTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<th align="left" width="60%">
<asp:Label runat="server" ID="Label1" Text='User Name'></asp:Label>
</th>
<th align="center" width="20%">
<asp:Label runat="server" ID="Label2" Text='Is Male?'></asp:Label>
</th>
<th align="center" width="20%">
<asp:Label runat="server" ID="Label3" Text='Is Active?'></asp:Label>
</th>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="60%">
<asp:Label runat="server" ID="lbluser" ></asp:Label>
</td>
<td align="center" width="20%">
<asp:CheckBox runat="server" ID="chk"></asp:CheckBox>
</td>
<td align="center" width="20%">
<asp:Image runat="server" ID="imgCtrl" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<EditRowStyle CssClass="EditRowStyle" />
<AlternatingRowStyle CssClass="AltRowStyle" />
</asp:GridView>



Shankey


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend