SqlDataSource question

Discussion in 'Databases' started by wisemx, Jan 11, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Shocks me you didn't get help for this in the ASP.NET forums, guys there usually jump on this sort of thing.

    Let me ask you something before we get into coding this...
    What is it you want to do?

    The reason I'm asking is, the GridView might not be the best solution, but then it could.
    As an example the new ListView is easy to use and much faster:
    http://aspnet.4guysfromrolla.com/articles/122607-1.aspx
    Salute,
    Mark
     
  2. Hey, Mark -

    No, GridView is perfect for the application. Everything I want is implemented with a minimum of coding. Everything, that is, except...

    [​IMG]

    Very simple. I want to place a label near the grid with the count of records returned by the query. 'Total records returned = nn.'

    If I could access the underlying DataSet wrapped by the SqlDataSource, it's a snap. The trouble is I can't get a reference to the dataset.

    I implemented a simple workaround that involves using a separate Command object and executing a 'SELECT COUNT(*)' query, using the same filters asare used to populate the grid. I'd just as soon not have to do that, though - the information I'm after is certainly encapsulated in the SqlDataSource object, but it's not exposed.

    So - the question is, how do I access the DataSet wrapped by a SqlDataSource?

    ASP.NET forum people seemed unable to deal with a specific question. I had several answers suggested - none of which had anything to do with the question I was asking. It seemed they were more intereseted in showing off - answering the question they happened to know, rather than the one I asked. It wasn't much help.
     
  3. I'm with ya bro...


    Actually I like the GridView, currently using it for my Shoutbox.
    But I'm rewriting that now to use the ListView and Ajax, so much faster.


    Have you been here yet? http://www.gridviewguy.com/


    I'm going to help you with this but take a little time and look through the examples:
    http://www.gridviewguy.com/CategoryDetails.aspx?categoryID=7


    Also...Putting summary data in a GridView footer:
    http://msdn2.microsoft.com/en-us/library/ms972833.aspx


    And...How to Display Sum Total in the Footer of the GridView Control
    http://aspalliance.com/782_CodeSnip_How_to_Display_Sum_Total_in_the_Footer_of_the_GridView_Control


    One way I would try to do this first would be to add a query to the SqlDataSource for the total records.
    http://asp.net/learn/data-access/tutorial-47-vb.aspx
    Salute,
    Mark
     
  4. Hey, guys -

    I've been trying to get an answer to this at the ASP.Net forums but am striking out. Maybe someone here knows?

    [​IMG]

    I'm using an SqlDataSource to prepare a Dataset for viewing in a GridView. I want to know how many rows are in the dataset wrapped by the SqlDataSource. I know how to use Rows.Count; I don't need help there. The question is: How do I get a reference to the Dataset wrapped by an SqlDataSource?

    Post Edited (Harvey Birdman) : 1/11/2008 4:19:48 AM GMT
     
  5. Thanks, guy. Like you said, it'll take a minute to read through the examples. They look relevant, though - thanks. The GridViewGuy site looks like a good resource.

    Re Ajax and ListView - the next iteration will probably involve something like that. I've been focused elsewhere other than web dev for the last few years, though, and have some catching up to do. It's that old age and senility thing again, ya dig?

    [​IMG]
     
  6. I'm currently 46
    (21 Nov 1961...Detroit, born just in time to get the tar kicked out of me during the riots.)
    You keep painting a grim picture of my future. [​IMG]

    (The age/location part above is true but the grim picture part is just me having some fun with ya.)
    Salute,
    Mark
     
  7. Here, I'll give you a humorous clue. My wife is currently working on her BSCS. Because of this, we're getting financial aid advertisements addressed to 'The Parents of nnn nnnn'; she's also getting mail from AARP, at the same time.


    [​IMG] [​IMG]
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page