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

How to manually bind data to dropdownlist (hard coded)

hi guys just want to get input from you on how can i bind data to a dropdownlist manually or in hard code?..

How can I use ObjectDataSource for this binding? or is there any other way?..

Thanks..
Aug 18 '06 #1
5 11297
pintum
3
How to bind data to dropdownlist (hard coded) ,send the Code of this forum
Aug 19 '06 #2
pintum
3
Please send the code immidiate
Aug 19 '06 #3
Hi Pintum,

Im so sorry for this late reply. I was out of the office already when you responded to my post on how can i possibly bind data to dropdownlist. Hope you could stil help me out.

Here is my code when Im trying to use ObjectDataSource to bind data to dropdownlist. I tried to run this in Visual Web Developer but I cannot figure out the error. I just patterned this code on tags on autamatically created by the IDE.

Dim filterByQuarterAdapter As New filterSaveTrainingResult_DataSetTableAdapters.sear chSaveDistinctQuarter_TableAdapter

Dim filterDistinctQuarter_ObjectDataSource AsNew ObjectDataSource
filterDistinctQuarter_ObjectDataSource.ID = "filterDistinctQuarter_ObjectDataSource"
filterDistinctQuarter_ObjectDataSource.OldValuesPa rameterFormatString = "original_{0}"
filterDistinctQuarter_ObjectDataSource.SelectMetho d = "filterByQuarterAdapter.GetData_ByQuarter"


Me.filterResult_DropDownList.DataSourceID = "filterDistinctQuarter_ObjectDataSource"
Me.filterResult_DropDownList.DataTextField = "quarter"
Me.filterResult_DropDownList.DataValueField = "quarter"


Me.filterResult_DropDownList.DataSource = filterByQuarterAdapter.GetData_ByQuarter.DataSet


If its confusing to you about the code, Is there a way I can send the proper arrangement of code to you so you can read it clearly? thank you so much.. you can reply direct on my email add at: denver.crisostomo@dhl.com. I will be waiting for your reply..
Aug 20 '06 #4
nmsreddi
366 256MB
hi

u can bind data dynamically from datadase by suing dataset,

SqlConnection con=new SqlConnection(" connection string");
SqlCommand cmd =new SqlCommand("query",con);
DataSet ds=new DataSet();
SqlDataAdapter da=new SqlDataAdapter(cmd);
da.Fill(ds);
DataTable dt=new DataTable();
dt=ds.Tables[0];
DropDownList1.DataSource=dt;
DropDownList1.DataTextField=dt.Columns[1].ColumnName;

DropDownList1.DataBind();



this is comple code in c# al the best


regards

nmsreddi
Aug 21 '06 #5
hi nmreddi,

very good idea!!! =) thank you so much..

regards to you.
Aug 24 '06 #6

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

Similar topics

2
by: Carlos | last post by:
I have a dropdown list that binds data from a data reader bo I have a second dropdown list in my wen form which I want to have same data, how can I copy the one is bind to a secopnd one.. see my...
2
by: COHENMARVIN | last post by:
I'm leafing through a big book on asp.net, and I don't see any way to the following: 1. bind values and text to a dropdown 2. Also make the first line of the dropdown say something different. For...
1
by: mr2_93 | last post by:
Hi All, I am new to ASP.NET and I am looking for help with the dropdownlist data control. I wonder if someone could show me how to past the SelectedValue of a data-bind dropdownlist to...
1
by: Patrik Zdarsa | last post by:
Hi, I'm try VS 2005 and need UPDATE database record in viewform, all working when every filed is type TextBox (html INPUT) but I need change one TextBox to Listbox or dropdownlist and read data...
4
by: Dabbler | last post by:
I have two tables I'm editing in a Gridview. The VANS table contains a key to the other LESSOR table. I would like to use a dropdown list to select the LessorId value while displaying the Lessor...
3
by: sck10 | last post by:
Hello, I am trying to bind an arraylist to a FormView DropDownList control in the PreRender state. The error that I get is the following: Databinding methods such as Eval(), XPath(), and...
2
by: si_owen | last post by:
Hi all, firstly this is a web apps project. Right i had a dropdown list which was populated by a db table which was databound using a sql datasource. however when adding validation controls...
1
by: sweatha | last post by:
Hi Friends I have designed a form with 1 DropDownList box named “ddlShow_time”& the form name is “Default4.aspx”. Just like that, I have the database(SQL SERVER 2000) as Table Name: ShowTime...
2
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i have a hard-coded list of items for my dropdownlist with EnableViewState="false" and it appears that the selected value will be retained regardless of postbacks, is this correct? ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.