Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
SUM and displaying rows
posted

Is it possible to display the sum of selected records then have the records displayed under the main row when the user clicks the plus. i know the viewtype needs to be set to hierarchical but what would the SQL statement be in the SqlDataSource control and if there are any special property settings.

ex. SELECT FirstName , SUM(orders), SUM(Price) FROM Customers

need

Bill |300|1000

-Bill 150|900

-Bill 150|100 

Many thanks for any help!

 

  • 28464
    posted

    Hello,

    I think there are several possibles approaches to this problem. One is to enumerate all selected grid rows, get an unique indentifier for the row (say ID for customer and add it to the WHERE IN  SQL clause. WHERE IN examples can be found here:

    http://www.dmxzone.com/forum/topic.asp?topic_id=24682

    Another good suggested is to use the SelectParameters collection of all declarative datasources to pass parameters to SQL - a great approach is discussed in this forum thread:

    Selected Row as SQL parameter

    http://forums.infragistics.com/forums/p/6181/28766.aspx

    HTH