CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > general_asp.net.getting_started Tags:
Item Type: Date Entered: 2/8/2007 3:36:54 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 19 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
"Warenth" <>
NewsGroup User
Databinding, Access to DataSource2/8/2007 3:36:54 PM

0

I'm trying to understand databinding and am currently binding to a ComboBox, setting the DataTextField and DataValueField. How do I access properties of the datasource that aren't those two fields?

For example:
Lets say I'm creating a DropDownList of employees. Each Employee has three fields (Name, ID, Age). 
I programatically bind to this list of Employees, that is created on initial page load, setting my DataTextField equal to name, and DataValueField equal to ID.
I then later in the page, after postback, want to access the Age of the currently selected employee.

How can I do this?

Is it possible to cast my SelectedItem back to an Employee and use its properties? (I've attempted this but had no luck).

 Thanks in advance.


Think like a man of action; act like a man of thought.
"Mikesdotnettin
NewsGroup User
Re: Databinding, Access to DataSource2/8/2007 5:21:48 PM

0

The only way you can do this is to perform a lookup in the database

SELECT Age From Employees WHERE EmployeeID = @ID 

@ID is the selectedvalue 


Regards Mike

8 out of 10 questions have already been asked. Their answers can be found using Google. Go on, try it.

If you prefer code samples or tutorials in another language, translate it for free at www.codechanger.com
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:













framework

help!! what did vwd 2008 express do to my web.config?

can i practice web parts and sharepoint develping with it ?

how do you do a non-standard "web installer" install

version installations

is it possible to configure visual studio 2008 beta express editions to use asp 2.0 instead of 3.5

materpage problem

get applcation to run on iis 7.0

visual web deverloper 2008 websites....

access denied when adding a db to app-data

can i create components (dll:s) in vwd?

frustration in switching from asp classic to .net

vwd 2008 + vista localhost not working

vwd 2008 and ajax extenders

error with dealing with asp.net controls

code behind page not executing

visual web developer 2008 and vista

can’t scroll the design pane

ide hangs when switching from source to design view

ajax control tools

what are differences between vs2008 standard and vs2008 express?

v web 2008 install issue

docking the database explorer and solution explorer windows

can i use visual web develoepr free edition for production uses

wierd problem updating database.

linq adding to two tables related to each other

create a thumbnail using visual web dev. 2005 express

vista iis7 visual web 8 asking for frontpage extensions

update to vwd2008? should?

lost all visual studio project files

use vwd 2008 express to open windows 2008/iis7 site

does linq work with express edition visual web developer 2008?

very slow save in dataset designer

"tab order" in visual web developer 2008 express

how to add reportviewer in visual web developer 2008 ?

creating stub

issues with jpg's in preview

making multiple selections in design view in visual web developer 2008 express

can multiple studios live together in harmony?

changing login database

order/group project items

how can i center an image with visual developer

autorefresh on button click issue

license and distribution of software created in vwd

ctrl f5 does not navigate to my page

vwd 2008 multi-select and align controls problem

connecting to ftp database

error in the visual web developer 2008 express..

visual web developer express 2008 fails on install

creating web services with vwd

   
  Privacy | Contact Us
All Times Are GMT