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

GroupName issue

1 Answer 145 Views
Button
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 2
Andy Green asked on 01 Apr 2013, 05:55 PM
Hi

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">
     <ItemTemplate>
 
         <telerik:RadButton ID="RadButton1" runat="server"   EnableEmbeddedSkins="false" Skin="Activity" ButtonType="ToggleButton" ToggleType="Radio" GroupName="Refer" Text='<%#Eval("Name") %>'></telerik:RadButton>
 
     </ItemTemplate>
 </asp:DataList>

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


<td>
 
<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>
 
 
</td>


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?

Andy





1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 02 Apr 2013, 12:21 PM
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();
}
</script>
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.

Regards,
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.


Tags
Button
Asked by
Andy Green
Top achievements
Rank 2
Answers by
Danail Vasilev
Telerik team
Share this question
or