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

Access Fieldset Legend Text within a NestedViewTemplate from codebehind

1 Answer 156 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 30 Jan 2012, 12:45 PM
Hi,

I have a fieldset with legend text as an element on a nestedviewtemplate and I would like to be able to change the text dynamically from the codebehind. The usual methods don't seem to work -  I can't seem to cast an item as type legend so I'm unsure how to find the control. What is the best way of going about this?

Cheers,
Christian

Edit:

FWIW I have made my own workaround for this issue. I placed a label within the legend tags and then used casting and the FindControl method to locate and edit this element (this is the usual way). I would still be interested as to how one would access the legend element directly, however this is no longer a pressing issue. Thanks.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Feb 2012, 09:31 AM
Hi Christian,

You could set runat="server" to your fieldset. This will allow you access it on the server. Note that the type of the control will be HtmlGenericControl.
<fieldset id="MyFieldSet" runat="server">
    <legend>...</legend>
    ....
</fieldset>

Regards,
Daniel
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
Tags
Grid
Asked by
Christian
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or