Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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?
  #2 (permalink)  
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:30 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.