Hi,
I have a base page inheriting from System.Web.UI.Page and the rest of my pages inherit from this base page so I can manage security etc. in one place. What I wanted to know was whether I can place a FormDecorator on the base page so as to automatically control skins on all descendants from one place?
It does not seem to work currently and I get errors as soon as I drop FormDecorator on the base page, something about "unable to cast RadformDecorator to ISkinnableControl".
If this is not possible, any other ideas on how to achieve central control of skins would be great.
I have a base page inheriting from System.Web.UI.Page and the rest of my pages inherit from this base page so I can manage security etc. in one place. What I wanted to know was whether I can place a FormDecorator on the base page so as to automatically control skins on all descendants from one place?
It does not seem to work currently and I get errors as soon as I drop FormDecorator on the base page, something about "unable to cast RadformDecorator to ISkinnableControl".
If this is not possible, any other ideas on how to achieve central control of skins would be great.
4 Answers, 1 is accepted
0
Hello Al,
You should be able to have a form decorator instance in your base page if you ensure that it is properly added:
- the form decorator must be added after the ASP.NET AJAX script manager control.
- both the script manager and the form decorator should be in the page form.
You can try adding the decorator (and script manager) to the ASP.NET form (Page.Form property) in the onload event of your base page class. If that does not work, please post some sample code from your base class so we can test it.
Sincerely yours,
Lini
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You should be able to have a form decorator instance in your base page if you ensure that it is properly added:
- the form decorator must be added after the ASP.NET AJAX script manager control.
- both the script manager and the form decorator should be in the page form.
You can try adding the decorator (and script manager) to the ASP.NET form (Page.Form property) in the onload event of your base page class. If that does not work, please post some sample code from your base class so we can test it.
Sincerely yours,
Lini
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Al
Top achievements
Rank 1
Iron
Iron
Iron
answered on 18 May 2010, 11:41 AM
Thanks Lini,
It seems that I had a versioning issue, after completely removing all versions of rad and re-installing Q1 2010 SP1 I can now add the form decorator just fine (I didn't have the net 4.0 binaries).
I still have a question on the inheritance bit:
1. - If I use a master page and place a scriptmanager and form decorator on the master, all child pages get decorated as expected - all ok.
2. - If I do not use a master page and place a scriptmanager and form decorator on my custom page base class, no pages that inherit from this base class get decorated (in fact the form decorator is not visible in the base class at all). This kind of makes sense to me because the controls are in the body of the base class, not the inheriated class. Could you maybe give me an example of what you mean by "You can try adding the decorator (and script manager) to the ASP.NET form (Page.Form property) in the onload event of your base page class"?
Do you think there is a better way to have one FormDecorator operating on multiple pages without using Master pages?
It seems that I had a versioning issue, after completely removing all versions of rad and re-installing Q1 2010 SP1 I can now add the form decorator just fine (I didn't have the net 4.0 binaries).
I still have a question on the inheritance bit:
1. - If I use a master page and place a scriptmanager and form decorator on the master, all child pages get decorated as expected - all ok.
2. - If I do not use a master page and place a scriptmanager and form decorator on my custom page base class, no pages that inherit from this base class get decorated (in fact the form decorator is not visible in the base class at all). This kind of makes sense to me because the controls are in the body of the base class, not the inheriated class. Could you maybe give me an example of what you mean by "You can try adding the decorator (and script manager) to the ASP.NET form (Page.Form property) in the onload event of your base page class"?
Do you think there is a better way to have one FormDecorator operating on multiple pages without using Master pages?
0
Accepted
Hi Al,
Here is an example of a base page class with an overridden OnLoad method:
I don't think there is a better way to add a form decorator to all your pages other than the two already mentioned (master page, base page class).
All the best,
Lini
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Here is an example of a base page class with an overridden OnLoad method:
public
class
BasePage : System.Web.UI.Page
{
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
var sm = System.Web.UI.ScriptManager.GetCurrent(Page);
if
(sm ==
null
)
{
sm =
new
System.Web.UI.ScriptManager();
Form.Controls.Add(sm);
}
var fd =
new
Telerik.Web.UI.RadFormDecorator();
fd.ID =
"rfd1"
;
fd.Skin =
"Black"
;
Form.Controls.Add(fd);
}
}
I don't think there is a better way to add a form decorator to all your pages other than the two already mentioned (master page, base page class).
All the best,
Lini
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Al
Top achievements
Rank 1
Iron
Iron
Iron
answered on 24 May 2010, 03:06 PM
Thanks Lini, that worked perfectly.
It is strange that it didn't work when dragging the form decorator from the toolbaox like all the other controls, perhaps there is a bug here?
It is strange that it didn't work when dragging the form decorator from the toolbaox like all the other controls, perhaps there is a bug here?