Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2005, 01:45 AM
Registered User
 
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Radio button template column issue

Hi,
Can any one help me with this datagrid template column issue?
Any code example will be greatly appreciated.
I am developing an application in ASP.net. (Language Vb.net)
Requirement is to display a radio button column within a data grid.
To get this working so far I have placed a template column with HTML radio button control in the data grid.
(I am using a HTMLINPUT radio button control in the template column, as radio button web control does not work within a grid)
Below is the code for rendering radio button dynamically and group it. The grouping and rendering works fine.
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
        If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
            Dim lblOpt As label
            lblOpt = e.Item.FindControl("lblOption")
            lblOpt.Text = "<input type=radio name='"& e.Item.Cells(1).Text &"' value=" & e.Item.Cells(2).Text & ">"
        End If
End Sub
I am looking for solution of the following:
1) On post back - based upon radio button selection, I want to update the underlying dataset that binds to the data grid.
2) I want to retain radio button selection on data grid paging.
Thank you all in advance.
Regards,
-Satyajit
 
Old November 14th, 2005, 02:05 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I am using a HTMLINPUT radio button control in the template column, as radio button web control does not work within a grid ..

This is not true. You can nest web server controls within a datagrid.


 
Old November 14th, 2005, 09:04 AM
Registered User
 
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi ,
I am not sure what do you mean by nesting . Do you have any code example ? With the web control the grouping doesn't work within a grid . Some code will really help me understand how to use radio button web control.
Thanks

 
Old November 14th, 2005, 10:48 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

There is no need for grouping. Use a Radio Button List control.

 
Old November 14th, 2005, 11:05 AM
Registered User
 
Join Date: Jun 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi ,
My need doesn't suit radio button list. Say there are 10 rows on a grid page then first 3 rows could be from one group and last 7 from other . Please let me know how we can use radio button web control .
Thanks

 
Old November 25th, 2005, 09:23 AM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi ,
whatz the major diff between windows forms and web forms?
whe do we use windows forms in our project and when do we use webforms in our project.
can u plz expalin clearly to me.



 
Old November 26th, 2005, 01:48 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Windows forms are created for a Windows application. That application needs to be distributed to each PC that will run it. Webforms are created on a web server and accesed through a browser either on an intranet or throught the internet. They are 2 differnt project types.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Template Column in datagrid prankur ASP.NET 1.0 and 1.1 Professional 1 January 7th, 2006 05:20 PM
Button in Datagrid Template Column thetway ASP.NET 1.0 and 1.1 Basics 1 October 11th, 2005 01:54 PM
Datagrid template column sonurijs ASP.NET 1.x and 2.0 Application Design 1 September 27th, 2005 12:55 PM
Template Column in DataGrid and Button divsalar ASP.NET 1.x and 2.0 Application Design 1 January 23rd, 2005 12:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.