473,320 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using gridview in a timecard application

Is there a way to use a gridview in a timecard application, and if so, how? I
was looking at using a gridview to display a person's hours worked in a
week. To do this, many different data records would have to display on the
same row to make up a week (the database has a new row for each day entered).
But, from what I can tell, this keeps you from being able to use a gridview,
because the gridview relies on one datakey per row (and there are 7 database
records per one gridview row). Is there a way around this, or do I need to
look in a different direction on building my timecard application?
Oct 16 '07 #1
7 3316
Use a DataList control. It is capable of rendering multiple items on a row.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
Is there a way to use a gridview in a timecard application, and if so,
how? I
was looking at using a gridview to display a person's hours worked in a
week. To do this, many different data records would have to display on the
same row to make up a week (the database has a new row for each day
entered).
But, from what I can tell, this keeps you from being able to use a
gridview,
because the gridview relies on one datakey per row (and there are 7
database
records per one gridview row). Is there a way around this, or do I need to
look in a different direction on building my timecard application?

Oct 16 '07 #2
Thanks for the reply, but unless I don't understand the datalist enough, I do
not think that it will work. I need to be able to list a project once, and
then list all hours in a week associated with that project type (would be
multiple records on one line).

So the timecard would look like this:

Project Name Mon Tue Wed Thu Fri Sat Sun
Total Hours
Project One 1 3 8 8 8
28
Project Two 7 5
12

A record id would need to be associated with each hours entry so if the user
wanted to edit just those hours, they could. That is where the gridview breaks
down. I can have a gridview display records just as I want, but not with a
record id
associated with each hour entry.

Any suggestions?

"Eliyahu Goldin" wrote:
Use a DataList control. It is capable of rendering multiple items on a row.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
Is there a way to use a gridview in a timecard application, and if so,
how? I
was looking at using a gridview to display a person's hours worked in a
week. To do this, many different data records would have to display on the
same row to make up a week (the database has a new row for each day
entered).
But, from what I can tell, this keeps you from being able to use a
gridview,
because the gridview relies on one datakey per row (and there are 7
database
records per one gridview row). Is there a way around this, or do I need to
look in a different direction on building my timecard application?


Oct 16 '07 #3
Ok, consider the following way:

Reverse to gridview. Databind it to a dataset that will contain a datatable
with the columns corresponding to the ones in the gridview. Populate the
dataset programmatically from the database. Updates to the gridview will
update the dataset. Then save dataset date programmatically to the database.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:0A**********************************@microsof t.com...
Thanks for the reply, but unless I don't understand the datalist enough, I
do
not think that it will work. I need to be able to list a project once, and
then list all hours in a week associated with that project type (would be
multiple records on one line).

So the timecard would look like this:

Project Name Mon Tue Wed Thu Fri Sat Sun
Total Hours
Project One 1 3 8 8 8
28
Project Two 7 5
12

A record id would need to be associated with each hours entry so if the
user
wanted to edit just those hours, they could. That is where the gridview
breaks
down. I can have a gridview display records just as I want, but not with a
record id
associated with each hour entry.

Any suggestions?

"Eliyahu Goldin" wrote:
Use a DataList control. It is capable of rendering multiple items on a
row.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
Is there a way to use a gridview in a timecard application, and if so,
how? I
was looking at using a gridview to display a person's hours worked in
a
week. To do this, many different data records would have to display on
the
same row to make up a week (the database has a new row for each day
entered).
But, from what I can tell, this keeps you from being able to use a
gridview,
because the gridview relies on one datakey per row (and there are 7
database
records per one gridview row). Is there a way around this, or do I
need to
look in a different direction on building my timecard application?

Oct 16 '07 #4
I think, the easy way is to refine your DB query and put your work hours and
ids at one record, and store multiple ids at data keys (you can store array
of key at 2.0 and I assume you use 2.0) and access them later.

Shaw
"Wannabe" wrote:
Thanks for the reply, but unless I don't understand the datalist enough, I do
not think that it will work. I need to be able to list a project once, and
then list all hours in a week associated with that project type (would be
multiple records on one line).

So the timecard would look like this:

Project Name Mon Tue Wed Thu Fri Sat Sun
Total Hours
Project One 1 3 8 8 8
28
Project Two 7 5
12

A record id would need to be associated with each hours entry so if the user
wanted to edit just those hours, they could. That is where the gridview breaks
down. I can have a gridview display records just as I want, but not with a
record id
associated with each hour entry.

Any suggestions?

"Eliyahu Goldin" wrote:
Use a DataList control. It is capable of rendering multiple items on a row.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
Is there a way to use a gridview in a timecard application, and if so,
how? I
was looking at using a gridview to display a person's hours worked in a
week. To do this, many different data records would have to display on the
same row to make up a week (the database has a new row for each day
entered).
But, from what I can tell, this keeps you from being able to use a
gridview,
because the gridview relies on one datakey per row (and there are 7
database
records per one gridview row). Is there a way around this, or do I need to
look in a different direction on building my timecard application?
Oct 16 '07 #5
Shaw,

Yes, I am using 2.0. You may have hit on something that I can do, but can
you please explain it a little more.

Just to make sure, here is the hours table structure:
recordid int
projectid int
daterecorded datetime
hours decimal

I need to be able to take up to 7 records (could be less) and combine them
into one row, as shown in another post. For each hour, have it associated
with its own recordid. The projectid for each row would be the same for all
hours in that row (and could be changed, if the user picked the wrong one
initially). If you could explain further about using the datakey property,
that would be great. Thanks.

"Shaw" wrote:
I think, the easy way is to refine your DB query and put your work hours and
ids at one record, and store multiple ids at data keys (you can store array
of key at 2.0 and I assume you use 2.0) and access them later.

Shaw
"Wannabe" wrote:
Thanks for the reply, but unless I don't understand the datalist enough, I do
not think that it will work. I need to be able to list a project once, and
then list all hours in a week associated with that project type (would be
multiple records on one line).

So the timecard would look like this:

Project Name Mon Tue Wed Thu Fri Sat Sun
Total Hours
Project One 1 3 8 8 8
28
Project Two 7 5
12

A record id would need to be associated with each hours entry so if the user
wanted to edit just those hours, they could. That is where the gridview breaks
down. I can have a gridview display records just as I want, but not with a
record id
associated with each hour entry.

Any suggestions?

"Eliyahu Goldin" wrote:
Use a DataList control. It is capable of rendering multiple items on a row.
>
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
>
>
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
Is there a way to use a gridview in a timecard application, and if so,
how? I
was looking at using a gridview to display a person's hours worked in a
week. To do this, many different data records would have to display on the
same row to make up a week (the database has a new row for each day
entered).
But, from what I can tell, this keeps you from being able to use a
gridview,
because the gridview relies on one datakey per row (and there are 7
database
records per one gridview row). Is there a way around this, or do I need to
look in a different direction on building my timecard application?
>
>
>
Oct 17 '07 #6
I am not very sure your database table logic. One possible query is to use
function, such as GetWorkdayHours and GetWorkdayID. So here is a similar
query:

SELECT DISTINCT projected, GetWorkdayHours(‘Monday’, projected ,
weeksatrtday), GetWorkdayHours(‘Tuesday’, projected , weeksatrtday), …,
GetWorkdayID(‘Monday’, projected , weeksatrtday),…
FROM HoursTable
WHERE daterecorded weeksatrtday AND daterecorded < weeksatrtday

To bind keys (VB):
gridView.DataSource = dataview_name
gridView.DataKeyNames = New String() {"MondayID", “TuesdayID”,…}
gridView.DataBind()

The best way I think, is to modify your database table to fit your needs.

Hope it works (not sure).

Shaw
"Wannabe" wrote:
Shaw,

Yes, I am using 2.0. You may have hit on something that I can do, but can
you please explain it a little more.

Just to make sure, here is the hours table structure:
recordid int
projectid int
daterecorded datetime
hours decimal

I need to be able to take up to 7 records (could be less) and combine them
into one row, as shown in another post. For each hour, have it associated
with its own recordid. The projectid for each row would be the same for all
hours in that row (and could be changed, if the user picked the wrong one
initially). If you could explain further about using the datakey property,
that would be great. Thanks.

"Shaw" wrote:
I think, the easy way is to refine your DB query and put your work hours and
ids at one record, and store multiple ids at data keys (you can store array
of key at 2.0 and I assume you use 2.0) and access them later.

Shaw
"Wannabe" wrote:
Thanks for the reply, but unless I don't understand the datalist enough, I do
not think that it will work. I need to be able to list a project once, and
then list all hours in a week associated with that project type (would be
multiple records on one line).
>
So the timecard would look like this:
>
Project Name Mon Tue Wed Thu Fri Sat Sun
Total Hours
Project One 1 3 8 8 8
28
Project Two 7 5
12
>
A record id would need to be associated with each hours entry so if the user
wanted to edit just those hours, they could. That is where the gridview breaks
down. I can have a gridview display records just as I want, but not with a
record id
associated with each hour entry.
>
Any suggestions?
>
"Eliyahu Goldin" wrote:
>
Use a DataList control. It is capable of rendering multiple items on a row.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
Is there a way to use a gridview in a timecard application, and if so,
how? I
was looking at using a gridview to display a person's hours worked in a
week. To do this, many different data records would have to display on the
same row to make up a week (the database has a new row for each day
entered).
But, from what I can tell, this keeps you from being able to use a
gridview,
because the gridview relies on one datakey per row (and there are 7
database
records per one gridview row). Is there a way around this, or do I need to
look in a different direction on building my timecard application?

Oct 17 '07 #7
Thanks...that gives me a good starting point. I'll give that a try and repost
if I need any other information.

"Shaw" wrote:
I am not very sure your database table logic. One possible query is to use
function, such as GetWorkdayHours and GetWorkdayID. So here is a similar
query:

SELECT DISTINCT projected, GetWorkdayHours(‘Monday’, projected ,
weeksatrtday), GetWorkdayHours(‘Tuesday’, projected , weeksatrtday), …,
GetWorkdayID(‘Monday’, projected , weeksatrtday),…
FROM HoursTable
WHERE daterecorded weeksatrtday AND daterecorded < weeksatrtday

To bind keys (VB):
gridView.DataSource = dataview_name
gridView.DataKeyNames = New String() {"MondayID", “TuesdayID”,…}
gridView.DataBind()

The best way I think, is to modify your database table to fit your needs.

Hope it works (not sure).

Shaw
"Wannabe" wrote:
Shaw,

Yes, I am using 2.0. You may have hit on something that I can do, but can
you please explain it a little more.

Just to make sure, here is the hours table structure:
recordid int
projectid int
daterecorded datetime
hours decimal

I need to be able to take up to 7 records (could be less) and combine them
into one row, as shown in another post. For each hour, have it associated
with its own recordid. The projectid for each row would be the same for all
hours in that row (and could be changed, if the user picked the wrong one
initially). If you could explain further about using the datakey property,
that would be great. Thanks.

"Shaw" wrote:
I think, the easy way is to refine your DB query and put your work hours and
ids at one record, and store multiple ids at data keys (you can store array
of key at 2.0 and I assume you use 2.0) and access them later.
>
Shaw
>
>
"Wannabe" wrote:
>
Thanks for the reply, but unless I don't understand the datalist enough, I do
not think that it will work. I need to be able to list a project once, and
then list all hours in a week associated with that project type (would be
multiple records on one line).

So the timecard would look like this:

Project Name Mon Tue Wed Thu Fri Sat Sun
Total Hours
Project One 1 3 8 8 8
28
Project Two 7 5
12

A record id would need to be associated with each hours entry so if the user
wanted to edit just those hours, they could. That is where the gridview breaks
down. I can have a gridview display records just as I want, but not with a
record id
associated with each hour entry.

Any suggestions?

"Eliyahu Goldin" wrote:

Use a DataList control. It is capable of rendering multiple items on a row.
>
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
>
>
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:C5**********************************@microsof t.com...
Is there a way to use a gridview in a timecard application, and if so,
how? I
was looking at using a gridview to display a person's hours worked in a
week. To do this, many different data records would have to display on the
same row to make up a week (the database has a new row for each day
entered).
But, from what I can tell, this keeps you from being able to use a
gridview,
because the gridview relies on one datakey per row (and there are 7
database
records per one gridview row). Is there a way around this, or do I need to
look in a different direction on building my timecard application?
>
>
>
Oct 17 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kjetil Klaussen | last post by:
Hi, I’m having some troubles trying to bind my dataset to a GridView control through an ObjectDataSource control. The binding works fine for regular columns in my dataset, but I can’t seem...
4
by: Jim Katz | last post by:
I have an application that updates a strongly typed data set at run time. I'd like to dynamically create a table that connects to a run time data table. For displaying the data, this works well. ...
5
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
1
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
0
by: samridhi | last post by:
Hi Do anybody have code example in .net of providing a url for posting or requesting cxml timecard data. I searched the net but didn't found any example.
2
by: William Youngman | last post by:
We are developing an application that presents data to the user in a gridview and we are using the dropdown extender to give the user a SharePoint 2007 type dropdown menu attached to the cells of a...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
5
hyperpau
by: hyperpau | last post by:
CAn anybody give me an advise on the best way to create a payroll or timecard ms access database? This database should be on a recurring basis, meaning, it talks about all the days in a year. I...
4
ollyb303
by: ollyb303 | last post by:
Hi, wasn't sure whether I should post this under .net, IIS or access, but I've plumped for .net! I have a problem with an asp.net website which I am hosting on a windows server 2003 under IIS...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.