472,961 Members | 2,243 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,961 software developers and data experts.

please anybody to help Dropdownlist selected index problem


I am working in asp.net with C# web application, I have used visual studio 2003, i have used dropdownlist
in my application to populate the data from mysql database, i have got problem while i selected the item from
dropdownlist, its not selecting correct item i'm selecting from dropdownlist, i have 64 records in my table, but i
tried to work with upto 15 records it will not giving problem, when the scroll will enable to dropdownlist its
giving problem, its not selecting the correct record what i'm selecting in dropdownlist, i have used following
codes to fill dropdown and selected index,

public DataSet LoadShotTaskCode()
cmd = new MySqlCommand("HD_PROC_LOADSHOTTASK",global_con);
cmd.CommandType = CommandType.StoredProcedure;
adapter = new MySqlDataAdapter(cmd);
dataset = new DataSet();
return dataset;

private void FillDropDown()
Access = new clshome();
ds = Access.LoadShotTaskCode();
if(ds.Tables[0].Rows.Count != 0 )
DropDownList1.DataTextField = "task_code";
DropDownList1.DataValueField = "task_description";
DropDownList1.DataSource = ds;
if(DropDownList1.Items.Count != 0)
TxtEditTaskCode.Text = ds.Tables[0].Rows[0]["task_code"].ToString();
TxtEditTaskDesc.Text = ds.Tables[0].Rows[0]["task_description"].ToString();

public MySqlDataReader Select_ShotTaskCoes(string tcode)
MySqlCommand taskcmd = new MySqlCommand("select * from hd_tbl_taskcodes where task_code='"+ tcode+"'",global_con);
MySqlDataReader dr = taskcmd.ExecuteReader(CommandBehavior.CloseConnect ion);
return dr;

private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
Access = new clshome();
MySqlDataReader taskdr = Access.Select_ShotTaskCoes(DropDownList1.SelectedI tem.Text);
TxtEditTaskCode.Text = taskdr.GetValue(0).ToString();
TxtEditTaskDesc.Text = taskdr.GetValue(1).ToString();

please anybody help me to slove this problem, advanced Thanks for any reply.

Mar 7 '07 #1
2 1516
759 Expert 512MB
Not selecting correct value means ?

What value you get when make select change in combo ?

Mar 7 '07 #2
366 256MB

what actuaaly your problem ,what happenning when select a value ,by default

is it going to first value in the list, are you using auto post back property of the

combobox to true, some times in page postback the values of the combo box

will not point to the value you have selected instead it goes to to the first value

in the list ,are you facing the same problem i think.

actually the problem you specified is unable to understand your requirement

please try to post with exact requirement
Mar 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
by: DesignerX | last post by:
I have a dynamically created composite server control. The composite control contains a dropdownlist, a validator and a label. I have the dropdownlist AutoPostBack set to true and have defined...
by: Robin Bonin | last post by:
In my user contol I am creating a set of dropdownlists. Each list is created based on input from the other lists. The problem I am having is setting the selected index on the lists. If someone...
by: wolfgang wagner | last post by:
hi all! after successfully integrating a dropdownlist in my datagrid i have another problem: i cannot set the selected index of the dropdownlistbox. here is my code: hardware.aspx...
by: Aws | last post by:
My crazy GridView !! I am using Visual Studio 2005, I have a problem with my GridView. I have one access .mdb table and when I update a record on the table EVERYTHING is perfect. I made a Web...
by: clickon | last post by:
Forget about the controlParameter for the moment, for testing purposes i have created the following Markup: <asp:Table ID="tblSelectRoute" runat="server" CssClass="asp-table"> <asp:TableRow>...
by: Robert Dufour | last post by:
I am trying to localize a very simple web site (english and french) I have a master page and one content page for now. On the master page I have placed a Localize control On the content page I...
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
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...
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 :...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
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...
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...

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.