radiobuttons in datalist

Nov 7 2009 4:12 AM
Hi all,

Plz help

i have a data list in which i have some radiobuttuns in it. i want to reterieve the value of select radio button with groupname="select"

here s d code


<asp:DataList ID="dtlProducts" runat="server" Width="100%" OnItemCommand="dtlProducts_ItemCommand1">
                <ItemTemplate>
                <table width="100%"  border="0" cellspacing="0" cellpadding="4">
                <tr align="left">
        <td  height="20" width="30%"  align="left" bgcolor="#DFDFFF"><strong>S.No: <%# i++ %></strong> - <asp:LinkButton ID="lnkAddToQuote" runat="server" CssClass="ablue" CommandName="AddToQuote" CommandArgument='<%# Eval("ItemNo") %>'>Add To Quote List</asp:LinkButton></td><td bgcolor="#DFDFFF" align="right"></td>
      </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Name:</strong></td>
    <td height="20"  bgcolor="#FFFFCC"><asp:Label ID="lblItemNo" runat="server" Visible="false" Text='<%# Eval("ItemNo") %>'></asp:Label><asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label></td>
  </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Cat No:</strong></td>
    <td height="20"  bgcolor="#FFFFE8"><asp:Label ID="lblCatNo" runat="server" Text='<%# Eval("CatNo") %>'></asp:Label></td>
  </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Our Price:</strong></td>
    <td height="20" valign="middle"><asp:RadioButton Text='<%# Eval("OurPrice") %>'
            ID="rbOurPrice" GroupName="select"  runat="server" /></td>
  </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Price:</strong></td>
    <td height="20" ><asp:RadioButton Text='<%# Eval("Priceone") %>'
            ID="rdPriceOne" GroupName="select"  runat="server" /> - <asp:Label ID="lblManu1" runat="server" Text='<%# Eval("Manufacturer1") %>'></asp:Label></td>
  </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Price:</strong></td>
    <td height="20" ><asp:RadioButton Text='<%# Eval("Pricetwo") %>'
            ID="rdPriceTwo" GroupName="select"  runat="server" /> - <asp:Label ID="lblManu2" runat="server" Text='<%# Eval("Manufacturer2") %>'></asp:Label></td>
  </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Price:</strong></td>
    <td height="20" ><asp:RadioButton Text='<%# Eval("Pricethree") %>'
            ID="rdPriceThree" GroupName="select"  runat="server" /> - <asp:Label ID="lblManu3" runat="server" Text='<%# Eval("Manufacturer3") %>'></asp:Label></td>
  </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Other Price:</strong></td>
    <td height="20" ><asp:RadioButton Text='<%# Eval("Other") %>'
            ID="rdOther" GroupName="select"  runat="server" /></td>
  </tr>
  <tr>
    <td width="25%" align="right" height="25" bgcolor="#FFFFCC"><strong>Specification:</strong></td>
    <td height="20" ><asp:Label ID="lblDesc" runat="server" Text='<%# Eval("Specification") %>'></asp:Label></td>
  </tr>
</table>
                </ItemTemplate></asp:DataList>

here s d classfile code

m able to reterieve the label vales..... plz sometell me how to reterieve selected radio button value......


                   Label lblitemNo = (Label)e.Item.FindControl("lblItemNo");
                    Label lblname = (Label)e.Item.FindControl("lblName");
                    Label lblcatNo = (Label)e.Item.FindControl("lblCatNo");
                      .............
                     and what for selcted radiobutton with groupname("select")

Answers (2)