Free Support Forum - aspose.com

DropDownList in Excel From asp.net

Hi.


i want to add Dropdownlist in excel sheet from asp.net programatically. and then how to read back again in asp.net its selected text and selected value.
please help me if someone have any idea.

Regards,

Faisal

Hi,


Please check the topic:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/working-with-controls.html

See the text/example under sub-heading “Adding ComboBox Control to the Worksheet” on the page.

To retrieve the value/text of the combo box, you may try to use the following properties in the given sample code:

Aspose.Cells.Drawing.ComboBox cbx = (Aspose.Cells.Drawing.ComboBox)worksheet.Shapes[0];
string lnkcell = cbx.LinkedCell;
Response.Write(cbx.LinkedCell);
Response.Write(worksheet.Cells[“A1”].StringValue);
Response.Write(cbx.SelectedIndex.ToString());
Response.Write(cbx.SelectedValue.ToString());
Response.Write(cbx.SelectedCell.StringValue);

Thank you.

Hi,


Thanks for your reply.

actually i want to add values to a dropdownlist from a datatable or dataset not from the spreadsheet. kindly help me

Regards,

Faisal

Hi,


Well, I am afraid, you have to import the values from your database to Excel sheet (you may import data from your data source to a sheet and then you can make it invisible if you want) as we do not support the drop down to be bound with data source on the back end.

For importing data from data source, see the topic:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/importing-data-to-worksheets.html


Thank you.