473,414 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

View Excel Data in DropDownList

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

Nov 16 '05 #1
2 5561
Kav

<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.
Nov 16 '05 #2
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.


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mathieu cupryk | last post by:
in the Button1_Click I need to make the 1st column saved as readonly. How can I do this? using System; using System.Collections; using System.ComponentModel; using System.Data; using...
0
by: Luis Esteban Valencia | last post by:
in the Button1_Click I need to make the 1st column saved as readonly. How can I do this? using System; using System.Collections; using System.ComponentModel; using System.Data; using...
1
by: Luis Esteban Valencia | last post by:
Here is my aspx code: ============= <%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="PDM.excel.WebForm3" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0...
0
by: Paul Zanbaka | last post by:
I have a teamplate field that uses a drop down list in a details view . The drop down lit use its own data surce (DataSource 2) But I am trying to make the default value from DataSource1 (same as...
2
by: Sam | last post by:
A) Destination Table with 4 Fields. 1) Last Name 2) First Name 3) State 4) Zip Code. B) Look up table State/Zip Code with 2 Fields
0
by: Chicagoboy27 | last post by:
I am wondering how to set an object datsource or any data source for a dropdown list that is a details view. Here is a brief set up. I have a details view that lists a bunch of information. when a...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
2
by: cckelly | last post by:
Hello, all! I need help. There is a "view" in a SQL Server 7 database that contains all the data I need. I want to create an Excel file (version Excel 2000). I want the file to open the view and...
0
by: johnlim20088 | last post by:
Hi, Hi, currently I have a code below on my Listcontact.aspx file to export my gridview data to excel:- It is work success, and export the 'Contacts.xls' to my folder. But have following...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.