Results 1 to 6 of 6

Thread: Gest way to show this in a gridview?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Question Gest way to show this in a gridview?

    Hello,

    I don't know if this is more of a database question or for here. What I need to do is list records of data in a gridview from a SQL table. Yes, I already know how to do this with a SQLdatasource control. But here is my problem. I need to list them in time order starting with 12:00AM through the whole day every half hour. My problem is in the table I only have the half hour times that the person worked. And I need to list every half hour even if they did not work. The other fields going with each time is Activity1 and Activity2. I only have records that has the activity in the table.

    So do I need to create a datatable from the SQL data and then fill in the missing times? Or is there a better way to do this?

    Thanks,

    Warren

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,347

    Re: Gest way to show this in a gridview?

    One option would to use your SQL code to create a result set that contains all the half-hour blocks and then outer-join that with your existing data. That will create a result set that includes all the periods worked or not and then you use the SqlDataSource as normal.

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,606

    Re: Gest way to show this in a gridview?

    + You shouldn't be using SQLDatasource in the first place. An evil control that bloats your page(discussions have been made hundreds of time so i won't go to details).
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: Gest way to show this in a gridview?

    Thanks. I use the SQLDataSource control all the time for when I need to bind a stored procedure to a grid. It is much easier than coding to query data by code, put it in a datatable and then bind it. I use the Telerik asp.net control set and love it!

    Warren

  5. #5
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Gest way to show this in a gridview?

    Hi,

    Well I agree on Sapator on not using SQLDatasource control. So, did @jmcilhinney answer in post #2 helped you
    with your problem?

    KGC
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: Gest way to show this in a gridview?

    I am actually about to try doing that. I'll reply back in a bit with the results but definitely makes sense.

    Warren

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width