Thanks Rich,
Imagine this to be my Excel template:
A B C D
1 SITE LDN NYC IDN
2 LDN 1 147 486
3 NYC 147 1 212
4 IDN 486 212 1
I Basically want 2 DropDownLists One to select Sites in the '1' Row and
another to select Sites in the 'A' Column. Then the result to be placed
into a text box. For explanation reasons if site 'LDN' was selected
from row 1 and 'IDN' was selected from column A, the result should be
486.
The current code I am using for a DropDownList looks like this:
private void setupList1(DropDownList list, DataSet infoSet)
{
foreach(DataColumn dCol in infoSet.Tables[0].Columns)
{
if (dCol.ToString() != "")
{
ListItem tempItem = new ListItem(dCol.ToString());
list.Items.Add(tempItem);
}
else
{
break;
}
}
}
It does work but if blank cells are defined in my Excel Spreadsheet the
blank cells are replaced with Cell References for some reason. Plus I
dont know how to make both text boxes reference each other to collect
the correct result.
What is the best way to go about creating two DropDownLists to fill a
text box with the result?
All suggestions will be very greatful.
Thanks
Sunny
Kav wrote:
<su*******@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... Hi,
I am having difficultly being able to view certain Columns and rows
via a DropDownList. Everytime I load my webpage.aspx it just shows
empty drop down menus.
I have no problem showing all the Excel data in a DataGrid, its
just DropDownLists.
To view all the data in a DataGrid I just followed the instructions
on the Microsoft website:
http://support.microsoft.com/default...b;en-us;306572
Any suggestions will be very useful
Thanks
Sunny K
Hi,
Post your code that you are using to populate the DropDownList.
I think the problem may be that you need to state the actual column
name for the data to be displayed and used (see below "TextColumn" &
"DataColumn",) whereas in the microsoft example for displaying Excel data in a
DataGrid there is no column named when the DataSet is created.
ddlName.DataSource = objDataset1.Tables[0];
ddlName.DataTextField = "TextColumn"; // This should be
the name of a column - the data that is displayed
ddlName.DataValueField = "ValueColumn"; // This should be a
name of a column - the data that is used for the value
ddlName.DataBind();
Rich.