GridView selection and binding

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RobertTheProgrammer
    New Member
    • Aug 2007
    • 58

    #1

    GridView selection and binding

    Hi all,

    I've got a GridView for which I need to populate the rows with something a little more complicated than a simple SQL statement, thus the SelectCommand won't work. What I'd like to do is call an external procedure (I assume via OnSelecting) to do my more complicated query, but how do I get the results to bind to the GridView object?

    Thanks for any information.

    Robert
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    What do you mean by external procedure?

    If you create a function and have it return a DataTable object (or DataSet) you can just set it as the .DataSource on your GridView and then call the .DataBind() function.

    Comment

    • RobertTheProgrammer
      New Member
      • Aug 2007
      • 58

      #3
      Ah! Yes, that makes sense. And yes "external procedure" refers to the C# code called using the OnSelecting call. I wanted to use this call to do the query to populate my GridView object, but I couldn't figure out how to get the results from my C# code to populate the GridView. Your answer is quite helpful.

      Thanks. I'm still learning.

      Robert

      Comment

      Working...