Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > TemplateColumn

Reply
Thread Tools

TemplateColumn

 
 
Dave
Guest
Posts: n/a
 
      10-02-2004
Hello.
Can anybody explain me how to use TemplateColumn?


 
Reply With Quote
 
 
 
 
Greg Burns
Guest
Posts: n/a
 
      10-02-2004
Basically you remove your <Asp:BoundColumn> columns and replace them with
<Asp:TemplateColumn> columns. A template column defines explicity what is
shown when in Item mode (not in edit mode) and when in Edit mode.

Normally every TemplateColumn has at the minimum an ItemTemplate and an
EditItemTemplate. If you ommit the EditItemTemplate you can make a column
read-only when in edit mode.

Here is a quick sample:

<ASPataGrid runat=server ... >
<COLUMNS>
<ASP:TEMPLATECOLUMN>
<ITEMTEMPLATE>
<asp:label id="lblItemCharge" Runat="server" CssClass="ChargeItem"><%#
Server.HtmlEncode(Container.DataItem("Charge")) %></asp:label>
</ITEMTEMPLATE>

<EDITITEMTEMPLATE>
<asp:TextBox id=txtEditCharge Runat="server" CssClass="ChargeInput"
Text='<%# Container.DataItem("charge") %>' MaxLength="10"></asp:TextBox>
</EDITITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN>
repeat blah blah
</ASP:TEMPLATECOLUMN>
</COLUMNS>
</AspataGrid>

HTH,
Greg

"Dave" <> wrote in message
news:...
> Hello.
> Can anybody explain me how to use TemplateColumn?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandArgument in TemplateColumn Solomon Shaffer ASP .Net 0 01-16-2004 02:38 PM
TemplateColumn with multiple parameters Maziar Aflatoun ASP .Net 1 01-03-2004 05:57 PM
TemplateColumn Width Edward ASP .Net 1 11-21-2003 03:15 PM
TemplateColumn CheckBox Nus Pieds ASP .Net 0 07-16-2003 02:16 AM
Make DataGrid TemplateColumn read-only in code Bob ASP .Net 0 07-09-2003 05:56 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57