Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Datagrid & TemplateColumn

 
 
David
Guest
Posts: n/a
 
      10-08-2006
I have the following:

[AjaxMethod]
public string Test()
{
DataSet ds = ...;
DataGrid dg = new DataGrid();
dg.AutoGenerateColumns = false;
TemplateColumn tc = new TemplateColumn();
tc.HeaderText = "Serial Number";
tc.ItemTemplate = new TemplateColumnSN(ListItemType.Item);
dg.Columns.Add(tc);
dg.DataSource = ds;
dg.DataBind();
StringBuilder sb = new StringBuilder();
StringWriter stWriter = new StringWriter(sb);
HtmlTextWriter htmlWriter = new HtmlTextWriter(stWriter);
dg.RenderControl(htmlWriter);
return sb.ToString();
}

My datasource have one column named "code", I want to place an html
button in that template column, and I want to set his value property
with the "code" value of my datasource, I need to know how can I do
it.
TempalteColumnSN inherit from ITemplate and implements the
InstantiateIn method.
thanks.

 
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
Formatting a TemplateColumn of a datagrid dana lees ASP .Net 3 09-07-2004 09:47 AM
Added TemplateColumn is not showing in DataGrid after PostBack Jade Seguin ASP .Net 2 08-02-2004 09:53 AM
TemplateColumn of DataGrid =?Utf-8?B?U3RldmUgUg==?= ASP .Net 2 03-03-2004 07:30 AM
Image TemplateColumn DataGrid Viewstate =?Utf-8?B?U3RldmUgUg==?= ASP .Net 0 02-26-2004 06:46 PM
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