473,516 Members | 3,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDownList not showing data

hi

i have got a dropdownlist in a templatecolumn and I am
trying to load it with values.

this is the code in the testGrid_EditCommand function

testGrid.EditItemIndex = e.Item.ItemIndex;
DropDownList list =
(DropDownList).Item.FindControl("employees");
// The dropdownlist is not found

list.DataSource = employeeList.DataSource;
//employeeList is another dropdownlist on the page
also i have tried by specifying the datasource in the html

<EditItemTemplate>
<asp:DropDownList ID="employees" Runat=server
OnSelectedIndexChanged="employees_SelectedIndexCha nged"
DataSource='<%# employeeList.DataSource%>'
DataTextField="Name" DataValueField="Name">

I have also tried using methods in the datasource which
return data from the database,

nothing works...only an empty list is displayed
I would appreciate any help

thanks
Nov 18 '05 #1
1 3330
You should be adding this code in testGrid_ItemCreated (ItemCreated event)
method.

if(e.Item.ItemIndex == ListItemType.EditItem)
{
DropDownList list = (DropDownList).Item.FindControl("employees");
// The dropdownlist is not found
list.DataSource = employeeList.DataSource;
}

hth,
Av.

"Darren" <an*******@discussions.microsoft.com> wrote in message
news:23*****************************@phx.gbl...
hi

i have got a dropdownlist in a templatecolumn and I am
trying to load it with values.

this is the code in the testGrid_EditCommand function

testGrid.EditItemIndex = e.Item.ItemIndex;
DropDownList list =
(DropDownList).Item.FindControl("employees");
// The dropdownlist is not found

list.DataSource = employeeList.DataSource;
//employeeList is another dropdownlist on the page
also i have tried by specifying the datasource in the html

<EditItemTemplate>
<asp:DropDownList ID="employees" Runat=server
OnSelectedIndexChanged="employees_SelectedIndexCha nged"
DataSource='<%# employeeList.DataSource%>'
DataTextField="Name" DataValueField="Name">

I have also tried using methods in the datasource which
return data from the database,

nothing works...only an empty list is displayed
I would appreciate any help

thanks

Nov 18 '05 #2

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

Similar topics

2
5569
by: sunstarwu | last post by:
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
4
7443
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the placeholder,the user selects the required tags from the dropdownlists (if 5 Xml tags,then 5 dropdownlists each containing 5 xml tags) and now the...
6
5511
by: Julius Fenata | last post by:
Dear all, I have created client-side scripting to trigger event onChange from code-behind, like this: DropDownList1.Attributes = "GenerateArticleID()"; At the script on Windows Form, I added this function to have the value of DropDownList1
3
1650
by: Corobori | last post by:
In my form my users are entering some data, one of them being a dropdownlist. When an item is choosen from that dropdownlist I am posting back to the server in order to retrieve some data from the server that are part of the calculation on the client side. I am using that javascript code also from other control of my form but WITHOUT...
0
1364
by: Dossman | last post by:
I am somewhat new to ASP.NET. Classic ASP/SQL Server experience mostly. I have a DetailsView control with a DropDownList on an EditItemTemplate. The DropdownList shows in place of a bound Textbox. The idea is to show the user the data in a bound textbox field, but show a dropdownlist on Edit. The Dropdownlists' datasource is the...
3
1639
by: Jon Paal | last post by:
this text keeps showing up in my gridview dropdownlist "System.Data.DataRowView" How do I prevent this problem ?
1
8835
by: pleaseexplaintome | last post by:
Hi all, I have a datagrid with a dropdownlist and would like to have the dropdownlist display a database value correctly while the grid is in edit mode. I have a templatecolumn as follows: <asp:TemplateColumn HeaderText="New Route"> <HeaderStyle Width="0.5in"></HeaderStyle>
2
1365
by: renatois | last post by:
DropDownList with custom Data Display in a GridView Hi all, I have a GridView that has a STATUS template field showing a DropDownList on Edit Mode with the users status that can be C, I, B, E. That´s all working fine, the thing is that I want to configure the Data Field Display of the DropDownList that is showing C ,I ,B ,E to corresponding...
1
2139
by: madhukk | last post by:
i had a dropdownlist in datagrid. datagrid showing details of a table. i want dropdownlist list items from other table. where one column in both tables is same. and droplist should update whenever i update the data grid. code i tried.... <asp:DropDownList ID="DropDownList1" AutoPostBack="true" DataTextField="dept" DataValueField="dept"...
0
7182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5714
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.