Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2006, 08:12 AM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default need data ini Dropdownlst in Datagrid !!!

hello all

i have datagrid now i want is

<columns>

<TemplateColunmn><ItemTemplate>

<asp:Dropdownlist id="ddl1" runat = "server " datasource= ?? >

</TemplateColunmn></ItemTemplate>

</columns>

now what should i write to have values in Dropdownlist and how can i bind values in tha dropdownlist as we see in good sites ,
i need field from CORE table not DATATABLE pls
?? ?

help me pls send soome code:D
 
Old March 21st, 2006, 07:20 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You are going to need to populate either a Datatable or a dataset to bind data, you cant just stream data into a dropdownbox, not in the way your asking anyway.

Also, as a side bar, when people straight up ask for code samples that is normally when I don't provide any and I don't mean to sound rude or anything but this tells me that the person asking for code is looking for a "quick fix" right now and would rather not take the time to research the problem and that bothers me; you are a programmer, programmer's solve problems, that is why we do what we do.

Back to your question. The ddl has 3 parameters that you can set, a Datasource, DataValueField, and DataTextField the latter 2 params refer to fields in the datasource.

Your datasource can be anything but for this example i will use a datatable. In your code behind page you need to declare your datatable as Public and then when you need the dropdown populated call your method to connect to the database, populate your datatable and viola, you have data in your ddl.

Like i said, DataValueField and DataTextField need to refer to columns in your data source so say i query SQL and return the columns ID and Name to a datatable, Datatable is my source, DataValueField = ID and DataTextField = Name.

Hope this helps.



"The one language all programmers understand is profanity."





Similar Threads
Thread Thread Starter Forum Replies Last Post
Read data from ini file nbryson VB How-To 5 April 2nd, 2015 05:14 AM
INI files Kis C# 3 April 2nd, 2015 05:04 AM
Highlit the new data over the old data in DataGrid kotanaresh_2003 ASP.NET 1.0 and 1.1 Basics 0 April 12th, 2007 10:26 PM
settings.ini nbnelson C# 5 October 30th, 2003 05:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.