473,587 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDown list not displaying--Urgent!!

Hi
Am doing a web app which has a datagrid with template columns. One of the
columns has dropdowns for each row. I also have the EditCommandColu mn. The
problem am facing is I just see the last value of the dataset for the
dropdowns(in the non-edit mode). and moreover its just showing it as a label
instead of a dropdown. But once I click the Edit button, its displaying the
dropdowns with all dataset values. Here is the code for my ItemDataBound
event handler

protected void dgDetails_ItemD ataBound(object sender, DataGridItemEve ntArgs e)
{
if(e.Item.ItemT ype == ListItemType.Ed itItem)
{
DropDownList list = (DropDownList)e .Item.FindContr ol("ddlOrder") ;
list.DataSource = dsOrder;
list.DataTextFi eld = dsOrder.Tables[0].Columns[0].ColumnName;
list.DataValueF ield = dsOrder.Tables[0].Columns[0].ColumnName;
list.DataBind() ;
}
}

and this is the html
<ASP:TEMPLATECO LUMN HeaderText="Ord er">
<HEADERSTYLE FONT-BOLD="True" BACKCOLOR="#EDE AE7"></HEADERSTYLE>
<ITEMTEMPLATE >
<%# DataBinder.Eval (Container, "DataItem.Displ ayOrder") %>
</ITEMTEMPLATE>
<EDITITEMTEMPLA TE>
<ASP:DROPDOWNLI ST ID="ddlOrder" runat="server" CssClass="label 242"
Height="20" Width="40" Font-Size="12px"
DataValueField= "DisplayOrd er" DataTextField=" DisplayOrder"
DataSource='<%# dsOrder %>' SelectedIndex=' <%#
GetSelectedInde x(DataBinder.Ev al(Container.Da taItem,"Display Order").ToStrin g()) %>'
AutoPostBack="T rue" >
</ASP:DROPDOWNLIS T>
</EDITITEMTEMPLAT E>
</ASP:TEMPLATECOL UMN>

What do I have to do so that the dropdowns are shown when the page loads the
first time too.
Can anyone help me with it please?

Thanks
Jul 21 '05 #1
3 1314
JV
Take a look at "Customizin g Column Layout in Display and Edit Mode" on
http://msdn.microsoft.com/library/de...vercontrol.asp

"Deepa" <De***@discussi ons.microsoft.c om> wrote
Am doing a web app which has a datagrid with template columns. One of the
columns has dropdowns for each row. I also have the EditCommandColu mn.

Jul 21 '05 #2
thanks JV... it was helpful. But I have another issue here. Am populating the
dropdowns right, and when I edit it,its going to update in the database,
which causes the updated values to be displayed for the dropdowns. But I want
a set of specific values (its 1 thru 5) to be displayed for them instead of
the updated set of values. Do you have any thoughts on how to do this?

thanks
"JV" wrote:
Take a look at "Customizin g Column Layout in Display and Edit Mode" on
http://msdn.microsoft.com/library/de...vercontrol.asp

"Deepa" <De***@discussi ons.microsoft.c om> wrote
Am doing a web app which has a datagrid with template columns. One of the
columns has dropdowns for each row. I also have the EditCommandColu mn.


Jul 21 '05 #3
JV
Sorry, I don't understand your question.
Jul 21 '05 #4

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

Similar topics

1
8273
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two dropdown lists. If you change the selection of the left one (e.g. choose parentoption2), it should open up page2.htm in a popup window.
6
10671
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. Let's say you select 1 of the items, and are properly redirected. You press the back button. I have three servers providing two different...
4
4581
by: Paul | last post by:
I have a dropdown list box and a button on a web form, the autopost back is false for the dropdown list box and button. When the button is pushed the selection in the dropdownlist box is lost, just wondering what is wrong. Selected value is always 1 no matter what is selected in the dropdown list box. Private Sub btn_yes_Click(ByVal...
5
11883
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My dropdown list control does not retain its SelectedValue. Unless I read the SelectedValue right after the control has been loaded, populated, and assigned...
3
3515
by: er1 | last post by:
Hi all, I have created a double dropdown list. Based on the first list selection, second list populates (this works fine). I have a submit button, which when clicked should run a select query based on the values selected on both the dropdown lists. But this part is not working. It picks up right value for the first dropdown list and always...
6
5842
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList ID="FldType_add" Runat="server" DataSource='< %#GetFieldType()%>' DataValueField="Type" DataTextField="Type" /> Oce the page is loaded all the...
0
1975
by: Andrus | last post by:
I'm using WinForms DataGridView I need to make dropdown list wider that grid column width. I tried the following code, but dropdown list widht is the same as column width. How to increase dropdown list width ? Andrus. To reproduce
3
2796
by: fish919 | last post by:
Hello All, I am creating a date base in access. I want to create a dropdown list box that is connected to another dropdown list box. You start with a dropdown list that has 5 choices and each of these choices will call another dropdown list box when one of the choices from the first gets selected. (I hope this makes sense) All of this is...
5
6644
by: abhi3211 | last post by:
i am using java inside java script page. in that page i want to use two dropdown list. in first dropdown list i am getting data from ms-access database. in second dropdown list i want to get data according to selection made in first dropdown list and it will also come from ms-access database.(for example if i am selecting country as india in...
4
2717
by: Paul | last post by:
Hi all, I have a page that has a form on it which has a dropdown list on it. It connect to an sql database and populate the list. What I would like to do is make the list editable so that if the data returned doesnt contain what I want, I can type in the data I require which will then be updated to the database when the form is posted. ...
0
7920
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8215
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
8347
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
7973
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
8220
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
6626
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
5718
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
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.