This is a migrated thread and some comments may be shown as answers.

How to add telerik components through C# code?

3 Answers 215 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Saad
Top achievements
Rank 1
Saad asked on 30 Oct 2008, 09:28 AM
I want to add a telerik component in my page on pageload event....I tried to use page.Controls.Add(telerikComponent);
But this function needs ASP components to pass as a parameter in, not the telerik components.....what to do for it plz help me!

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 30 Oct 2008, 09:40 AM
Hello saadi,

All Telerik RadControls for ASP.NET and ASP.NET AJAX are ASP.NET components/controls.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Saad
Top achievements
Rank 1
answered on 30 Oct 2008, 11:40 AM

I am trying to do this.....

foreach

(string file in Directory.GetFiles("<path>"))
{
    System.Drawing.
Image img = System.Drawing.Image.FromFile(file);
    RadButtonElement imageItem = new RadButtonElement();
    imageItem.ToolTipText =
"Double click to resize";
    imageItem.Image = img;
    this.Items.Add(key,imageItem);  // i have tried everything to put in this key
}

but this.Items.Add(imageItem) isnt working....Excemption comes that is:
An entry with the same key already exists.

 

0
Nikolay
Telerik team
answered on 06 Nov 2008, 12:38 PM
Hi saadi,

I have reviewed you other tickets and therefore I suppose that you want to add a WinForms control to a ASP.NET web page. Please note that WinForms and ASP.NET are different branches of the .NET technology and therefore you cannot perform the desired operation.

Best regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Saad
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Saad
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or