473,586 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3329
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*****@discus sions.microsoft .comwrote in message
news:C5******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .comwrote in message
news:C5******** *************** ***********@mic rosoft.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 programmaticall y from the database. Updates to the gridview will
update the dataset. Then save dataset date programmaticall y to the database.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Wannabe" <Wa*****@discus sions.microsoft .comwrote in message
news:0A******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .comwrote in message
news:C5******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .comwrote in message
news:C5******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .comwrote in message
news:C5******** *************** ***********@mic rosoft.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.DataSo urce = dataview_name
gridView.DataKe yNames = New String() {"MondayID", “TuesdayID” ,…}
gridView.DataBi nd()

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*****@discus sions.microsoft .comwrote in message
news:C5******** *************** ***********@mic rosoft.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.DataSo urce = dataview_name
gridView.DataKe yNames = New String() {"MondayID", “TuesdayID” ,…}
gridView.DataBi nd()

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*****@discus sions.microsoft .comwrote in message
news:C5******** *************** ***********@mic rosoft.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
2212
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 to get my expression columns to show up in my GridView. Anybody knows any neat tricks to make this work? Here’s a “step-by-step” to reproduce...
4
13480
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. I just set the GridView.DataSource once, and call DataBind(); I'd like to drive the application from the GridView control, by including command...
5
6430
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 dataset with a join query for the GetData() select method. I use ObjectDataStore to couple the GridView with the table adapter on the dataset. ...
1
3521
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 javascript, nothing really having to do with ASP.NET... I'm attempting to put together an application that consists of several GridView controls each...
0
1366
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
10285
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 given column. We are also using another dropdown menu that the user can use to select data using another quesry using the SelectedIndex change method....
1
6120
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 label,textboxs,dropdownlists,radiobutton and checkbox asp standard controls. On the click event of the command button the data gets stored into the...
5
2035
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 can't think of the best way to do this since i am imagining a table with a lot of columns representing the days of each month, which I am sure is not...
4
4544
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 6.0. I am using an access database as the datasource for a gridview - this all works fine when I am running it on the development server in VWD...
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7954
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.