Creating a drop down/combo box

Nov 10, 2010 at 2:11 PM

Hi,

I am using C# and ASP.NET and I need to export data to an Excel spreadsheet.

I have a list of applications that contains Application objects.  Each Application object has a status ID.  When I export these applications to Excel then I need a column with a drop down/combo box in it.  In this drop down/combo box should be a list of all the statuses from the database.  And then I need the status to be selected to that of the application's status ID.

Another question is also with regards to the above scenario.  When the user downloads the Excel document then the user can change the status of each application by selecting a different value in the drop down.  I will need to upload this spreadsheet and loop through the rows and get the values of the columns and the value of the selected item in the drop down/combo box.  How would you do this?

Is this possible?  If so, can someone please help provide some sample code for me?

Thanks

Brendan

Nov 11, 2010 at 12:27 AM

You might want to experiment with using a template, this way you can format everything exactly the way you want (including a drop down list).  In terms of reading it back in, I've never tried to read in the value of a drop down list, but you can easily have your Excel form feed a sheet/named range of pure data.  Reading data in with NPOI is very simple!!!

Nov 11, 2010 at 5:31 AM

I can't read it from the disk, it has to be on the fly. 

Ok, but can you atleast tell me how to create a dropdown item populated with values from another sheet?  And then if my application object has a status of declined then I want Declined to be selected from the dropdown.

Thanks.

Jan 6, 2011 at 12:33 PM

This is exactly what I need to do. Dynamically populate worksheets that use other worksheets to build lists then read back into a web service of some sort. Did you ever get this working?