Calculate a total for values in a dropdownlist in a gridview

Posted on 2011-10-25
Last Modified: 2012-06-27

Row Number        District Locations

1                                       HE

2                                     RLE

3                                       :RE

4                                        JE

5                                       SE

In a gridview the alpha values come from a dropdownlist.

With a combimination of Row 1 and 2,  2 and 3, and 3 and 4, and 4 and 5.  A SQL select will be done to find a numeric value for the combos and add them together for a total.  This code must have more than one row to make the Database call for the numeric value..  Please provide the code to do this task.  
Question by:kwcowboy1226
    LVL 43

    Accepted Solution

    I don't really understand the question - how can you add HE and RLE - does it give HERLE ?  AND that is definately not numeric
    How do you determine that row 2 belongs to TWO different selections - 1+2 and 2+3 ?
    Which bit can't you do - the Experts here aren't paid to do your work for you.  Some will give code, others (like me) rather more advice.

    Author Comment

    I am very sorry guys, just wanted a starting place.
    LVL 12

    Expert Comment

    Start with using the Items collection of the dropdownlist after it has been bound.  The ListItem's Value property can be sent to your database query to get the value within a loop.

    Along with AndyAinscow, any further advise or snippets (examples not complete code) should be in another question.  From your comment, I assume miscomunications.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now