2 gridview questions regarding manually populate

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
 
G

Guest

What's your exact problem ?
1. Are you not able to display two columns in GridView with RadioButtons
2. Do you want to display Two Radio Buttons within the one column of the
Grid View
3. Do you want to display the text (bind from data source) along with
RadioButtons in each seperate column

Please let me know what exactly you are looking for ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top