Is it possible to create a
<RadStyleSheetManager> control programmatically just with a code behind in the cs class ? In other words, without declare something in the aspx page ? And if yes is it possible to put it in a content place of a master page if the page is linked to a master page ? tx and regards for your help.
4 Answers, 1 is accepted
0
Hi Ba,
You can use the following code (used on a normal page):
The only requirement for this to work in Master/Content page setups is that the control must be added in the Form.
I hope this helps.
Regards,
Simon
the Telerik team
You can use the following code (used on a normal page):
override
void
OnInit(EventArgs e) {
// Every page should have a script manager and style sheet manager
if
(Page.Form !=
null
) {
if
(RadStyleSheetManager.GetCurrent(Page) ==
null
) {
RadStyleSheetManager styleSheetManager =
new
RadStyleSheetManager();
//styleSheetManager.StyleSheets.Add(new StyleSheetReference(""));
Page.Form.Controls.AddAt(0, styleSheetManager);
}
}
base
.OnInit(e);
}
The only requirement for this to work in Master/Content page setups is that the control must be added in the Form.
I hope this helps.
Regards,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
ba
Top achievements
Rank 1
answered on 14 Sep 2011, 03:06 PM
Thanks Simon,
It's running perfect.
It's running perfect.
0
Somnath
Top achievements
Rank 1
answered on 15 Sep 2011, 10:47 AM
Hi Simon,
I am following the same approch to create a RadStyleSheetManager in code behind.
But here I am adding the control in Header and it is working perfect.
My question is then why it is required to add RadStyleSheetManager control in Form.
Thanks n Regards,
I am following the same approch to create a RadStyleSheetManager in code behind.
But here I am adding the control in Header and it is working perfect.
Page.Header.Controls.Add(objStyleSheetManager);
We are having the Master/Content page in application and the same code is working for them as well.My question is then why it is required to add RadStyleSheetManager control in Form.
Thanks n Regards,
0
Hi Ankit,
Actually it can also be added in the <head>. The 'requirement' I mentioned was more of a convention rather than a real requirement. Please excuse me for misleading you.
Best wishes,
Simon
the Telerik team
Actually it can also be added in the <head>. The 'requirement' I mentioned was more of a convention rather than a real requirement. Please excuse me for misleading you.
Best wishes,
Simon
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now