Wrox Programmer Forums
|
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 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 May 26th, 2009, 06:29 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default LoadScreen From Object: RadioButton List

On one of my forms I used a RadioButton List to choose values and store them in the db.

This is done is several sections and I have picked one to show here.

Code:

//Transfer Reason
baseEO.transferReasons = RadioButtonList1.SelectedValue.ToString();
When a user wants to go and edit a record, what is a good way to pull this information into the LoadScreen From Object Method to set the radio buttons to the stored value?

The only thing that I have seen in the Framework close to this is the block from PTORequest which shows...

Code:

ddlPTORequestType.Items.FindByValue(Convert.ToInt32(baseEO.PTORequestTypeId).ToString()).Selected = true;
ddlPTODayType.Items.FindByValue(Convert.ToInt32(baseEO.PTODayTypeId).ToString()).Selected = true;
but this is built on a custom class PTORequestTypeBO. Looking at this class I dont think I need to do this for what I am trying to do. Can anyone add any ideas?
 
Old May 28th, 2009, 02:30 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

The solution that I found, that actually works fairly good for editing forms. For each value that you store in the db, you should also create a field that houses the index for the rbl (radiobuttonlist) control.

So you when you are storing to the db, you would store the two fields as such.

Code:

baseEO.transFacility = ddlAETransferFacility.SelectedItem.ToString();
baseEO.transFacilityIndex = ddlAETransferFacility.SelectedValue;
Now whenever you need to repopulate a control you can set it by reversing the logic in the LoadScreenFromObject Method.
However you will only need to supply the code for Index field.

Code:
ddlAETransferFacility.SelectedValue = baseEO.transFacilityIndex

This will put your controls such as rbl, ddl ect, back to the state where the user saved the form.

If there is another way to get the same result a more direct way please share it.

Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
RadioButton with GridView Manoj Bisht ASP.NET 3.5 Professionals 1 March 18th, 2009 12:13 PM
RadioButton in Datagrid FLEX abhishekchess1 Flex 1 January 7th, 2008 02:11 AM
RadioButton in Datagrid FLEX abhishekchess1 ASP.NET 1.0 and 1.1 Professional 3 September 28th, 2007 01:19 AM
C# Object Linked List millsbruce C# 5 July 12th, 2005 04:15 PM
help please, object list cannot refresh kawak_zx7 General .NET 4 December 10th, 2004 07:36 AM





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