ASP.net accessibility help

Capodecina
Permabanned
Joined
31 Dec 2003
Posts
5,172
Location
Barrow-In-Furness
See post 4 for new problem!

My initial testing has gone well and thanks for everyone who has helped me :)

Just to make things 'nicer' though, i'm looking for some help.

I'm storing employee hours in a timesheet database, at the moment they will select a TimeCode to book hours too, to make this easier I would like to have them select the name of the TimeCode, but for the value to be stored as the CodeID.

I know if you add values manually to a DropDownList this is fairly easy, but the list will need to be populated by a Query.

I'm not sure of the easiest way to go about this, i'm i'll need to write some sort of query (or should I try do it in code?) that will fetch the ID based on the name, and then insert that instead?

My insert query at the moment is fairly typical...

Code:
INSERT INTO tblHours
                      (TimeCode, Date, Hours, Username, Comments, Approved)
VALUES     (@TimeCode,@Date,@Hours,@Username,@Comments,@Approved)

Thanks for any help guys :)
 
Last edited:
You can simply get the values as a datatable from a query and then bind this datatable to your dropdownlist.

Set the DataSource property to your datatable, then set the DataTextField and DataValueField properties to your text and id columns appropriately and then call the DataBind method on your dropdownlist.
 
I completely forgot about that property, all I had to do was change the DataTextField to CodeName and got exactly what I want.

Thanks Haircut :)

Expect serious questions soon when I try to write reports using SQL reporting services based on data from two databases, i've never even seen the reporting services development tools :x
 
Ok another usability one here guys...

At the moment i'm displaying a lot of data using a field called Timecode, although users would eventually get to know off the top opf their heads what this Timecode actually means, it's a lot easier if they just see the name.

The problem is, the name is held in a different table..

Do I get the name in the original query that fetches the data, or do I just run another query after the data has been fetched which will then grab the Timecode Name and replace the 'Timecode 7' with the Name?

Thanks! :)
 
Back
Top Bottom