N
Nadav Popplewell
Hi there
I'm trying to use the Mobile Form CustomerAttributes dictionary to add some
custom attributes to the <body> tag generated (for Html devices).
I've set allowCustomAttributes="true" in the <mobileControls > tag in
web.config.
Then in the page code I've got code like this:
if (this.AllowCustomAttributes)
{
if (RTL)
{
this.ActiveForm.CustomAttributes.Add("dir", "RTL");
}
}
The 'dir' attribute IS added to the CustomAttributes dictionary.
But the 'dir' attribute does NOT appear in the generate HTML.
I've overriden the HtmlFormAdapter class and put a break point in the
RenderBodyTag() method.
When I inspect the attributes parameter passed to the RenderBodyTag() method
I see it is empty.
However, when I inspect the Page ActiveForm.CustomAttributes I see that it
has the 'dir' attribute I added.
It seems like the HtmlFormAdapter.RenderBodyTag() attributes parameter is
NOT populated from the ActiveForm.CustomAttributes dictionary (or that the
framework does not add the 'dir' attribute).
If I add the 'dir' attribute to the attributes dictionary in the
RenderBodyTag() method before calling base.RenderBodyTag() then the attribute
is added to the generated HTML.
However, The code that determines if this attribute need to be added is part
of the page class and I would prefer not to have to override the FormAdapter
and move this logic to it.
Am I doing something wrong here?
Does the RenderBodyTag() property get it's attribute parameter not from
ActiveForm.CustomAttributes but from some place else?
Thanks in advance
Nadav
I'm trying to use the Mobile Form CustomerAttributes dictionary to add some
custom attributes to the <body> tag generated (for Html devices).
I've set allowCustomAttributes="true" in the <mobileControls > tag in
web.config.
Then in the page code I've got code like this:
if (this.AllowCustomAttributes)
{
if (RTL)
{
this.ActiveForm.CustomAttributes.Add("dir", "RTL");
}
}
The 'dir' attribute IS added to the CustomAttributes dictionary.
But the 'dir' attribute does NOT appear in the generate HTML.
I've overriden the HtmlFormAdapter class and put a break point in the
RenderBodyTag() method.
When I inspect the attributes parameter passed to the RenderBodyTag() method
I see it is empty.
However, when I inspect the Page ActiveForm.CustomAttributes I see that it
has the 'dir' attribute I added.
It seems like the HtmlFormAdapter.RenderBodyTag() attributes parameter is
NOT populated from the ActiveForm.CustomAttributes dictionary (or that the
framework does not add the 'dir' attribute).
If I add the 'dir' attribute to the attributes dictionary in the
RenderBodyTag() method before calling base.RenderBodyTag() then the attribute
is added to the generated HTML.
However, The code that determines if this attribute need to be added is part
of the page class and I would prefer not to have to override the FormAdapter
and move this logic to it.
Am I doing something wrong here?
Does the RenderBodyTag() property get it's attribute parameter not from
ActiveForm.CustomAttributes but from some place else?
Thanks in advance
Nadav