473,378 Members | 1,403 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,378 software developers and data experts.

How to populate a DDList(not from database) from the code behind???

NawazAhmed
Hi,
Can someone help me with populating a drop down list from code behind.
I want to populate the drop down list of years for credit card and the selected value should be the current year.
I am using asp controls(server side controls) in VS 2003


Thanks and Regards,
Nick.
Mar 13 '08 #1
5 1043
Plater
7,872 Expert 4TB
Since you want both a valuemember and a display member, I would suggest creating a DataTable object in memory with two columns and populating them, then you can assign it as the datasource and set the ValueMember and DisplayMember to the column you want.
Mar 13 '08 #2
nateraaaa
663 Expert 512MB
Hi,
Can someone help me with populating a drop down list from code behind.
I want to populate the drop down list of years for credit card and the selected value should be the current year.
I am using asp controls(server side controls) in VS 2003


Thanks and Regards,
Nick.
This site should help.
http://www.velocityreviews.com/forum...down-list.html

Nathan
Mar 13 '08 #3
I don't understand what u say. I think u wrote the answer in the wrong window
Since you want both a valuemember and a display member, I would suggest creating a DataTable object in memory with two columns and populating them, then you can assign it as the datasource and set the ValueMember and DisplayMember to the column you want.
Mar 13 '08 #4
Plater
7,872 Expert 4TB
I don't understand what u say. I think u wrote the answer in the wrong window
Nope, that answer exactly applied to you. Although Nate's answer might make more sense for you.
Mar 13 '08 #5
nateraaaa
663 Expert 512MB
I don't understand what u say. I think u wrote the answer in the wrong window
Plater's advice would also work well. It just depends which way you want to go.

Nathan
Mar 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mal P | last post by:
Hi there, I'm a J2EE fellow who (as usual) has been thrown in the deep end and have to learn a fair chunk of the .NET platform (VS, ADO, WebForms, C# etc) in roughly two days. I'm doing ok so...
1
by: Edward | last post by:
I am having a terrible time getting anything useful out of a listbox on my web form. I am populating it with the results from Postcode lookup software, and it is showing the results fine. What...
2
by: Terry | last post by:
I am converting an ASP page that used iframes for dynamic content to populate td tags in an html table. The parent page called the iframe page and then populates a parent table via Javascript...
4
by: pbb | last post by:
Is it possible to retrieve VB code stored in SQL Server as text and execute it in code behind in an ASP.Net app? I guess what I'm looking for is an object that would have an Execute method that...
9
by: Marina | last post by:
Hello! I have a database with some customers. Each one of them has 3 other customers under him etc. (something like an MLM system). Now, I want to create a treeview with this. Eg. C1 C11...
3
by: Jerry | last post by:
Hello everyone! I'm trying to populate a dropdown list from SQL Server but it's not being populated. I've tried all sorts of suggestions and examples that I found from Google but I just can not...
13
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those...
1
by: j_michas | last post by:
Hi, Im looking to create a class to automatically check a pop address and populate a database with the messages it collects. The problem Im having is that most of the code I have found doesnt...
4
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Dim dInfo As DirectoryInfo dInfo = New DirectoryInfo(Server.MapPath("/Folder1"))...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.