Click here to Skip to main content
15,795,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have data list and inside that data list have html radio button .
i want to bind two column values in html radio button 
like in asp  

<asp:RadioButton ID="RadioButton1" runat="server" GroupName="abc1" 
 style="vertical-align: middle;" Text='<%# Eval("Prize") %>' 
 ValidationGroup="abc1" Value='<%# Eval("SubItem") %>'   /> 

 here fetch two column values in text and value like that I want in html radio button

here is my code
inside data list

<input id="rd" type="radio" name="rd" value='<%# Eval("SubItem") %>' 
 onclick="SetSingleRadioButton1(this)" ></input>

 i can bind one value only 
how can i bind two columns values
please help

What I have tried:

<input id="rd" type="radio" name="rd" value='<%# Eval("SubItem") %>' 
 onclick="SetSingleRadioButton1(this)" ></input>
Updated 4-Oct-17 4:21am

1 solution


<asp:DataList ID="DataList1"  runat="server"  >
          <input id="rb1" type="radio" name="<%# Eval("ID")%>"   ><%# Eval("Column1")%></input>
          <input id="rb2" type="radio" name="<%# Eval("ID")%>"   ><%# Eval("Column2")%></input>


protected void Page_Load(object sender, EventArgs e)
           if (!Page.IsPostBack)
               DataTable dt = new DataTable();
               dt.Rows.Add(1, "aa", "bb");
               dt.Rows.Add(2, "cc", "bb");
               dt.Rows.Add(3, "dd", "bb");
               dt.Rows.Add(4, "ee", "bb");

               DataList1.DataSource = dt;
Share this answer
Member 11908679 4-Oct-17 8:55am    
how can i get those two values in javascript
for ex:
function SetSingleRadioButton1(rbtn) {
var total = nameregex.value;
here i get one value ,how can i get another column value?
please help
and thanks
Karthik_Mahalingam 4-Oct-17 23:38pm    
on what basis you need to get the value?
button click?
still not clear

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900