Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 2 Jul 2008 03:50:04 -0700,    group: microsoft.public.dotnet.framework.aspnet.webcontrols        back       


How to obtain radiobutton value from a GridView   
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
date: Wed, 2 Jul 2008 03:50:04 -0700   author:   Sergio

Re: How to obtain radiobutton value from a GridView   
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
date: Wed, 2 Jul 2008 07:36:35 -0400   author:   Evan Freeman

Re: How to obtain radiobutton value from a GridView   
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
date: Mon, 7 Jul 2008 08:12:52 -0700 (PDT)   author:   Stan

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us