GroupName issue

2 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    376 posts
    Member since:
    Aug 2008

    Posted 01 Apr 2013 Link to this post


    I'm not sure if this is a problem as I cant find anything simialr so it must be me, but here goes-

    I have this on my page to create a radio button list from my data, I'n doing it this way because I want to assign javascript to each node on load that I cant seem to do with a radiobuttonlist.

    <asp:DataList ID="test"  runat="server" RepeatDirection="Vertical">
             <telerik:RadButton ID="RadButton1" runat="server"   EnableEmbeddedSkins="false" Skin="Activity" ButtonType="ToggleButton" ToggleType="Radio" GroupName="Refer" Text='<%#Eval("Name") %>'></telerik:RadButton>

    The radio buttons whilst being rendered dont behave like radio buttons, ie I can select them all. this is what is being rendered:

    <a id="rpbOutcomes_i1_test_ctl05_RadButton1" class="RadButton RadButton_Activity rbToggleButton" href="javascript:void(0)"><span class="rbPrimaryIcon rbToggleRadio"></span><span class="rbText">test244</span><input id="rpbOutcomes_i1_test_ctl05_RadButton1_ClientState" name="rpbOutcomes_i1_test_ctl05_RadButton1_ClientState" type="hidden" /></a>

    the groupname isn't being written out.

    Now this control is inside a RadPanelBar which is causing me other problems, but should this work or have I midssed something?


  2. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 02 Apr 2013 Link to this post

    Hi Andy,

    The GroupName of the RadButtons is different for each instance of the ItemTemplate of the databound control. This behavior is expected and can be observed with other controls like ASP Radiobutton.

    What I can suggest you is try the following:
    • Instead of putting the RadButton into an ItemTemplate of a databound control, you can iterate through the values of a particular field from the datasource. Then you and create a RadButton with the desired configuration, on each iteration.
    • OR you can keep up with the current approach and use the following workaround:
    <script type="text/javascript">
       Telerik.Web.UI.RadButton.prototype.get_uniqueGroupName = function () {
       return this.get_groupName();
    In order the workaround to take effect it should be put at the end of your page. Note also that Grouping radio RadButtons from different templates instances is not a supported scenario and therefore it could lead to an unexpected behavior in some cases.

    Danail Vasilev
    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.

Back to Top