473,385 Members | 1,925 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.

GridView dynamiclly adding TemplateField

Hi,
I need to add controls to the TemplateField of GridView dynamiclly at
runtime (beacuse my GridView handle faw different DataSets, so I cannot do
it in aspx file).
The BoundFields I create like below:

//GridView gv;
BoundField gg_typ = new BoundField();
gg_id.DataField = "wm_id";
gg_id.HeaderText = "wm_id";
gv.Columns.Add(gg_id);

I want add TemplateField to my GridView similiar.
Can anyone tell me how to do it?
Feb 26 '06 #1
3 4313
Look at followinh URL:

http://msdn2.microsoft.com/en-us/library/ms228046.aspx

HTH

Elton Wang

"lupina" wrote:
Hi,
I need to add controls to the TemplateField of GridView dynamiclly at
runtime (beacuse my GridView handle faw different DataSets, so I cannot do
it in aspx file).
The BoundFields I create like below:

//GridView gv;
BoundField gg_typ = new BoundField();
gg_id.DataField = "wm_id";
gg_id.HeaderText = "wm_id";
gv.Columns.Add(gg_id);

I want add TemplateField to my GridView similiar.
Can anyone tell me how to do it?

Feb 26 '06 #2
But I need to do it in .cs file not in .aspx (dynamiclly).
Feb 27 '06 #3
You need create your own Template class that inherits from Itemplate, and
implements InstantiateIn method.
Although following URL is not exact for GridView, it gives some idea:

http://msdn.microsoft.com/library/de...ridcontrol.asp

HTH

"lupina" wrote:
But I need to do it in .cs file not in .aspx (dynamiclly).

Mar 1 '06 #4

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

Similar topics

3
by: washoetech | last post by:
I have a gridview control. In this grid view there is a column for the price of an item. Some of the prices have a dollar sign in front of it and some dont. How do I get rid of the dollar sign...
0
by: Mike P | last post by:
Where exactly are the updateparameters of a gridview picked up from? I have created 2 very similar gridviews and given the updateparameters the same names as in my edititemtemplates. Yet this...
0
by: Innova | last post by:
Hi, We are working on a gridview inside the gridview (parent-child) scenario. The data of child grid will depend on the data of parent. Objectives: 1.Add new row in parent grid after each row...
0
by: sunny076 | last post by:
Hi, I am having problem with a derived class from GridView in which I added an empty image in the itemTemplate. Basically what I am trying to do is adding an image column with an arrow...
4
by: bryan | last post by:
Hi all, I am working on a .net 2.0 web app. On page load I display a gridview with a drop down list (Employees), when the user selects from the drop down list, the grid view is filled with...
0
by: Mike P | last post by:
I am trying to edit a gridview while using paging, but whenever I try to edit a row on a page other than page 1, I get an error. Here is my gridview and my code : <asp:GridView ID="GridView1"...
2
by: Tony Hedge | last post by:
This seems more diffciult than it should be, can someone provide any insight? Platform is VB 2005, gridview on a web page. I have this code in the aspx file of a GridView control: ...
0
by: ganesh22 | last post by:
Hi... Iam using GridView in asp.net(2.0) .My requirement is user can add,update,delete in gridview I written the code for add & update but can u help adding rows in grid view My code: ...
1
by: mghihor | last post by:
Dear GridView Experts! I have problems with GridView when adding a column using TemplateField. I fill GridView1 from a stored procedure. It has a Select statement and returns 14 columns,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.