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

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 EditCommandColumn. 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_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.EditItem)
{
DropDownList list = (DropDownList)e.Item.FindControl("ddlOrder");
list.DataSource = dsOrder;
list.DataTextField = dsOrder.Tables[0].Columns[0].ColumnName;
list.DataValueField = dsOrder.Tables[0].Columns[0].ColumnName;
list.DataBind();
}
}

and this is the html
<ASP:TEMPLATECOLUMN HeaderText="Order">
<HEADERSTYLE FONT-BOLD="True" BACKCOLOR="#EDEAE7"></HEADERSTYLE>
<ITEMTEMPLATE>
<%# DataBinder.Eval(Container, "DataItem.DisplayOrder") %>
</ITEMTEMPLATE>
<EDITITEMTEMPLATE>
<ASP:DROPDOWNLIST ID="ddlOrder" runat="server" CssClass="label242"
Height="20" Width="40" Font-Size="12px"
DataValueField="DisplayOrder" DataTextField="DisplayOrder"
DataSource='<%# dsOrder %>' SelectedIndex='<%#
GetSelectedIndex(DataBinder.Eval(Container.DataIte m,"DisplayOrder").ToString()) %>'
AutoPostBack="True" >
</ASP:DROPDOWNLIST>
</EDITITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>

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 1290
JV
Take a look at "Customizing Column Layout in Display and Edit Mode" on
http://msdn.microsoft.com/library/de...vercontrol.asp

"Deepa" <De***@discussions.microsoft.com> 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 EditCommandColumn.

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 "Customizing Column Layout in Display and Edit Mode" on
http://msdn.microsoft.com/library/de...vercontrol.asp

"Deepa" <De***@discussions.microsoft.com> 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 EditCommandColumn.


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
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...
6
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. ...
4
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,...
5
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...
3
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...
6
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...
0
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...
3
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...
5
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...
4
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.