Hi, i have a gridview whit 2 columns: a BoundField connected whit a database and a TemPlateField with 3 radio button like this <Columns> <asp:BoundField DataField="Domanda" HeaderText="Domanda" /> <asp:TemplateField HeaderText="Seleziona"> <ItemTemplate> <input name='<%# Eval("ID") %>' type="radio" value="0" />Insufficiente<br /> <input name='<%# Eval("ID") %>' type="radio" value="1" checked="checked"/>Sufficiente<br /> <input name='<%# Eval("ID") %>' type="radio" value="2" />Buono </ItemTemplate> </asp:TemplateField> </Columns> From code i can read value from the 1st column and , e.g., put it on a listbox Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click For i = 0 To GridView1.Rows.Count - 1 ListBox1.Items.Add(GridView1.Rows(i).Cells(0).Text Next End Sub but i don't have any idea to read the value of the RadioButton!!! My be i'm confusing with asp (not aspx) but in aspx i don't know what i must to do :-( I'm using vb 2008. Thank's
Well depends on where you want to read it. Basically you have input fields so they should be on the form in the code behind. If thats where you want the value. ANyhow I forget the syntax for processing the form post on the code behind, but thats where the value of the radio buttons can be read from the easiest. -- Evan Freeman Evan.E.Freeman@gmail.com http://evanfreeman.blogspot.com "Sergio" wrote in message news:A64A38C4-4E62-4921-8D72-382CCCBA51E9@microsoft.com... > Hi, > i have a gridview whit 2 columns: a BoundField connected whit a database > and a TemPlateField with 3 radio button like this > > <Columns> > <asp:BoundField DataField="Domanda" HeaderText="Domanda" > /> > <asp:TemplateField HeaderText="Seleziona"> > <ItemTemplate> > <input name='<%# Eval("ID") %>' type="radio" > value="0" > />Insufficiente<br /> > <input name='<%# Eval("ID") %>' type="radio" > value="1" > checked="checked"/>Sufficiente<br /> > <input name='<%# Eval("ID") %>' type="radio" > value="2" > />Buono > </ItemTemplate> > </asp:TemplateField> > </Columns> > > From code i can read value from the 1st column and , e.g., put it on a > listbox > > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As > EventArgs) Handles Button1.Click > For i = 0 To GridView1.Rows.Count - 1 > ListBox1.Items.Add(GridView1.Rows(i).Cells(0).Text > Next > End Sub > > but i don't have any idea to read the value of the RadioButton!!! > My be i'm confusing with asp (not aspx) but in aspx i don't know what i > must > to do :-( > I'm using vb 2008. Thank's
On 2 Jul, 11:50, Sergio wrote: > Hi, > i have a gridview whit 2 columns: a BoundField connected whit a database > and a TemPlateField with 3 radio button like this > > <Columns> > <asp:BoundField DataField="Domanda" HeaderText="Domanda" /> > <asp:TemplateField HeaderText="Seleziona"> > <ItemTemplate> > <input name='<%# Eval("ID") %>' type="radio" value="0" > />Insufficiente<br /> > <input name='<%# Eval("ID") %>' type="radio" value="1" > checked="checked"/>Sufficiente<br /> > <input name='<%# Eval("ID") %>' type="radio" value="2" > />Buono > </ItemTemplate> > </asp:TemplateField> > </Columns> > > From code i can read value from the 1st column and , e.g., put it on a listbox > > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As > EventArgs) Handles Button1.Click > For i = 0 To GridView1.Rows.Count - 1 > ListBox1.Items.Add(GridView1.Rows(i).Cells(0).Text > Next > End Sub > > but i don't have any idea to read the value of the RadioButton!!! > My be i'm confusing with asp (not aspx) but in aspx i don't know what i must > to do :-( > I'm using vb 2008. Thank's For a templated field you need to use the FindControl method of the Cell object to retrieve the RadioButtonList. Give the control a deliberately chosen name and use that as a parameter. HTH