473,385 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Datagrid & TemplateColumn

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.

Oct 8 '06 #1
0 973

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Derek | last post by:
I have an aspx page where I use a reversebind and templates to edit the entire datagrid at one time. I added a textbox and button to change the parameter criteria and then rerun the databind2...
0
by: shamila | last post by:
</asp:label><asp:datagrid id="DataGrid3" runat="server" cssclass="DataGrid" showfooter="True" onupdatecommand="DataGrid3_Update"ondeletecommand="DataGrid3_Delete" oneditcommand="DataGrid3_Edit"...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
4
by: Kristoffer Arfvidson | last post by:
Im trying to get access to a table in codebehind, because the information in this table is different depending on what it says in the database... So, either I have to access it from codebehind,...
0
by: Steve Kallal | last post by:
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
0
by: csgraham74 | last post by:
Hi there, i have creted a datagrid control to display images using the following code. <asp:DataGrid id="dg_Properties" runat="server" HorizontalAlign="Center" Width="450px"...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
3
by: rn5a | last post by:
A DataGrid has the following TemplateColumn: <asp:DataGrid ID="dgCart"...OnSortCommand="SortGrid" AllowSorting="true"....> <Column> <asp:TemplateColumn HeaderImageUrl="Images\Up.gif"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.