G
Guest
I have a gridview on the page that i want to dynamically populate with
radiobuttons, so i went out on the net and found something that works
perfectly, it created radionuttons and the postback with the works. My
problem is that i want to send 2 columns to the gridview instead of 1, but i
cant figure out how to add the second column to the gridview.
<asp:GridView ID="GridView1" AutoGenerateColumns="false" runat="server"
ShowHeader="false">
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<input type="radio" name="radiolist" value="<%# Container.DataItem%>" />
<------ Here i want the 2nd column that i dont know how to attach to the
gridview
</ItemTemplate>
< ----- Container.DataItem displays only one column,
what should i use instead? Eval something?
</asp:TemplateField>
<asp:TemplateField HeaderText="Data">
<ItemTemplate>
<%# Container.DataItem %> <!-- here i want the first column to be displayed
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
This is the code i use to get one column into the gridview, but how do i get
a second one? (the second one should just contain a list of number 0--number
of answers in the poll)
This is what i want to be added to the radiobox value
ArrayList mList = new ArrayList();
for (int i = 0; i < mRow.Length; i++)
{
mList.Add(i.ToString());
}
This is what i have now
DataTable mTable = LSQ.Labervote_GetPoll("1");
DataRow[] mRow = mTable.Select();
char[] charsep = new char[1];
charsep[0] = '|';
string[] datastring = mRow[0].ItemArray[1].ToString().Split(charsep,
StringSplitOptions.None);
GridView1.DataSource = datastring;
GridView1.DataBind();
Patrick
radiobuttons, so i went out on the net and found something that works
perfectly, it created radionuttons and the postback with the works. My
problem is that i want to send 2 columns to the gridview instead of 1, but i
cant figure out how to add the second column to the gridview.
<asp:GridView ID="GridView1" AutoGenerateColumns="false" runat="server"
ShowHeader="false">
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<input type="radio" name="radiolist" value="<%# Container.DataItem%>" />
<------ Here i want the 2nd column that i dont know how to attach to the
gridview
</ItemTemplate>
< ----- Container.DataItem displays only one column,
what should i use instead? Eval something?
</asp:TemplateField>
<asp:TemplateField HeaderText="Data">
<ItemTemplate>
<%# Container.DataItem %> <!-- here i want the first column to be displayed
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
This is the code i use to get one column into the gridview, but how do i get
a second one? (the second one should just contain a list of number 0--number
of answers in the poll)
This is what i want to be added to the radiobox value
ArrayList mList = new ArrayList();
for (int i = 0; i < mRow.Length; i++)
{
mList.Add(i.ToString());
}
This is what i have now
DataTable mTable = LSQ.Labervote_GetPoll("1");
DataRow[] mRow = mTable.Select();
char[] charsep = new char[1];
charsep[0] = '|';
string[] datastring = mRow[0].ItemArray[1].ToString().Split(charsep,
StringSplitOptions.None);
GridView1.DataSource = datastring;
GridView1.DataBind();
Patrick