Solved

Datagrid Template column instantiate with a custom control

Posted on 2004-08-22
4
557 Views
Last Modified: 2012-06-27
Hi Experts,

I want to load a custom control in my template column. Is it possible ?

I do like this, but doesn't work:

public class TemplateColumn : ITemplate
{
    public void InstantiateIn(System.Web.UI.Control container)
    {
               public void InstantiateIn(System.Web.UI.Control container)
               {
                 MyTemplate=(MyTemplate)LoadControl("UserControls/MyTemplate.ascx");
                 container.Controls.Add(MyTemplate);
                }
}

Thanks in advance for any help.
0
Comment
Question by:noulouk
  • 3
4 Comments
 
LVL 17

Accepted Solution

by:
AerosSaga earned 500 total points
ID: 11865539
This should help:

http://www.dotnetbips.com/displayarticle.aspx?id=84

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11865545
0
 
LVL 9

Author Comment

by:noulouk
ID: 11897331
Thanks AerosSaga,

I'm sorry for answering so late. Your answers help me to create the template column with my usercontrol, but I don't know how to rebuild my usercontrol in itemcreated event of my datagrid.

Thanks in advance for helping me about this particular problem.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11897522
You will have to readd them programatically if I'm understanding this second question. see below:

http://www.c-sharpcorner.com/Database/PlayingWithDataGridTA.asp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now