Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Problem with data list and radio buttons

  Asked By: Alex    Date: Oct 17    Category: Asp.net    Views: 7181
  

I´m trying to use a data list control to display radio buttons inside the
template of the control but the data list control change the name of the radio buttons.

using this event works fine when bindng data into the radio buttons, but the data list still changing the name of the radios.

I tried to set the GroupName oh the radio buttons but nothing happens

they dont get grouped!!!


private void DlTarifas_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e) {

RadioButton Radio = (RadioButton)e.Item.FindControl("RATES");

Radio.GroupName ="RATES";

Radio.Text = (this.I).ToString();

this.I += 1;

}

this is what is rendered:

<table id="DlTarifas" cellspacing="0" border="0" style="width:237px;border-collapse:collapse;">
<tr>
<td>
<TABLE id="Table1" cellSpacing="5" cellPadding="0" width="100%" border="0">
<TR>
<TD class="TituloTarifa">
<span id="DlTarifas__ctl0_TITULO_TARIFA" class="TituloTarifa">ESPECIAL KM LIVRE</span></TD>
</TR>
<TR>
<TD class="DescTarifa">
<span class="DescTarifa"><input id="DlTarifas__ctl0_TARIFA" type="radio" name="DlTarifas:_ctl0:TARIFAS_AG" value="TARIFA" /><label for="DlTarifas__ctl0_TARIFA">0</label></span></TD>
</TR>

........

........

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Iris Sanders     Answered On: Oct 17

This is a known issue... You should use this server control  from Andy Smith
www.metabuilders.com/Tools/RowSelectorColumn.aspx

 
Answer #2    Answered By: Abhinav Ranjan Sinha     Answered On: Aug 22

Visit this link you will definetly get the required solution: coderskey.blogspot.in/.../...tton-in-datalist.html

 
Didn't find what you were looking for? Find more on Problem with data list and radio buttons Or get search suggestion and latest updates.




Tagged: