If you post some code we can help, hard to know what your issue is. Typically most people get stuck with dynamically created controls because they don't understand the page life cycle in ASP.NET. Are you using individual RadiButtons or a RadioButtonList server control or HTML input radio buttons? are they created in a datagrid template column or what? the best way to store/get the values differs depending on your implementation.
heres an example I've posted before in these forums. Its developed against the .NET 2.0 framework, you don't say which you are developing for:
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Radiolist.aspx.cs" Inherits="Radiolist" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" AutoGenerateColumns="false" runat="server">
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<input type="radio" name="radiolist" value="<%# Container.DataItem%>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Data">
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Label ID="lblSelected" runat="server"></asp:Label></div>
</form>
</body>
</html>
ASPX.CS
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Radiolist : System.Web.UI.Page
{
String[] data = new String[5];
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < 5; i++)
{
data[i] = i.ToString();
}
GridView1.DataSource = data;
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Request.Form["radiolist"] == null)
lblSelected.Text = "You didn't choose anything";
else
lblSelected.Text = "You choose " + Request.Form["radiolist"];
}
}
hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68