Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 580
  • Last Modified:

Datagrid Template column instantiate with a custom control

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
noulouk
Asked:
noulouk
  • 3
1 Solution
 
AerosSagaCommented:
This should help:

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

Regards,

Aeros
0
 
nouloukAuthor Commented:
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
 
AerosSagaCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now