Columns, Item Template ,Template Field in asp.net 3.5 grid view

Posted by Pdsofty under Regular Expressions on 12/27/2010 | Points: 10 | Views : 7169 | Status : [Member] | Replies : 2
How we can add Columns, Item Template ,Template Field in asp.net 3.5
grid view??
Can we add these using programatically or visualy like wizard control?
(Please give me the steps,Do not give me code)




Responses

Posted by: Karthikanbarasan on: 1/5/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
To add a template column

1. Set the GridView control's AutoGenerateColumns property to false.

<asp:GridView id="myGrid" runat="server"
autogeneratecolumns=false
...
>

2. Within the GridView declaration, declare a <Columns> element.
3. Within the Columns element, define the <asp:TemplateField> control, along with the required <ItemTemplate> element.
4. Within the ItemTemplate, define the HTML or server control that will contain the field value.

To display the value of a field in an item template, use DataBinding Expression Syntax.
5. Optionally set the <asp:TemplateField> control's other properties. For syntax, see GridView Control Syntax.

<columns>

<asp:templatefield>

<itemtemplate>
<img width=60 align="top"
src='<%# Eval ( "title_id", "../images/title-{0}.gif" ) %>' >
</itemtemplate>

</asp:templatefield>

...

</columns>



Thanks
Karthik
www.f5Debug.net

Pdsofty, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopalprasad88 on: 6/26/2013 [Member] Starter | Points: 25

Up
0
Down
can u please give some idea about how to add Templatefield and check box inside templatefield in grid view

Gopal Prasad

Pdsofty, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response