472,992 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

Editing a dropdown

Hi,
I'm having real trouble trying to figure out how to change the selectedIndex
of a drop down list that sits in the Edit Template of a datagrid bound to a
dataset.

I get the DataValueField and DataTextField coming in fine from a l table
generated dataSet. When I want to edit the dropdown I want a dropdown to be
displayed. So am doing the SelectedIndex property for it.
So, I am trying to call a function from within the SelectedIndex property of
the asp:DropDownList. My function(GetSelectedIndex) takes one argument - an
int which it will then compare with the table and return an integer. I tried
passing that through as the argument to GetSelectedIndex() but I get the
following error:

The best overloaded method match for
'MaintenanceScreen.Screen.GetSelectedIndex(int)' has some invalid arguments
Here is the code on the page:

<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"
DataSource='<%# dsOrder %>' SelectedIndex='<%#
GetSelectedIndex(DataBinder.Eval(Container.DataIte m,"DisplayOrder")) %>'
AutoPostBack="True"
OnSelectedIndexChanged="dgDetailsDropDown_Selected IndexChanged">
</ASP:DROPDOWNLIST>
</EDITITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>

and here is the method on the codeBehind:

protected int GetSelectedIndex(int orderValue)
{
int i;
string id;
DataTable oDT = new DataTable();
oDT = dsOrder.Tables[0];
id = orderValue.ToString();
for(i=0; i<oDT.Rows.Count-1;i++)

if (id == oDT.Rows[i]["DisplayOrder"].ToString())

return i;
return 0;

}

I dont understand where am going wrong. Appreciate if someone can help me
figure it out

Thanks
Jul 21 '05 #1
0 840

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

Similar topics

0
by: Allan Allan Ebdrup | last post by:
Hi I'm looking for the best webinterface for editing database data, for example publishing a table with foreign keys shown as a dropdown. I don't care what database the interface is for (MSSQL,...
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...
9
by: thechaosengine | last post by:
Hi all, I have a problem that I havent really come accross before. I need to be able to allow the user to set a dropdown control to a particular colour value. The permissable values come from...
13
by: melih.onvural | last post by:
Group, I'm having a tough time understanding some of the previous posts on this topic so I wanted to write what I've tried and hope that you can help me troubleshoot. I have a dropdown populated...
0
by: G Dawg | last post by:
I am trying to set the default item in a dropdown list on the fly, I would like to be able to retrieve a value from a Database and set the value that I just retrieved as the default list item. ...
0
by: Nithin | last post by:
My code as an txt attachment. I have 2 drop down list boxes that on selection populate text boxes from my database table. I am able to display the correct values in these text boxes. I have 2...
0
by: Deepa | last post by:
Hi, I'm having real trouble trying to figure out how to change the selectedIndex of a drop down list that sits in the Edit Template of a datagrid bound to a dataset. I get the DataValueField...
5
by: Gil | last post by:
Is there a way to tell if a combbox is in dropdown mode. I tried and if statement combobox.dropdown = true but i get an error. dropwndown function doesnt store if its true or false what i am...
4
by: genojoe | last post by:
My development computer (1 gig, XP Home Edition SP2) freezes when I am editing a very large VB.NET project. It can take minutes to move between a code pane and the Find and Replace pane. On...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.