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

Issue on asp.net dropdownlist.

nirmalsingh
218 100+
hai all.

i have loaded a dropdownlist box using code.

[HTML] cboUserGroup.DataSource = loadGroupCombos("").Tables[0];
cboUserGroup.DataTextField = "name";
cboUserGroup.DataValueField = "id";
cboUserGroup.DataBind();[/HTML]
now the dropdownlist box have the values such as

name---------------id
--------------------------
A ------------------- 1
B-------------------- 2
C-------------------- 3
D-------------------- 4
for eg selected text is 'A'
now i want to change the selected text as 'B'
i have tried a many ways such as
[HTML]cboUserGroup.Items.FindByValue("B").Selected = true;
cboUserGroup.SelectedItem.Selected = "B";
cboUserGroup.DataValueField.IndexOf("B");
cboUserGroup.Items.FindByValue("B").Selected = true;
cboUserGroup.DataBind();[/HTML]

but it is not working,
but
[HTML]cboUserGroup.SelectedIndex = 1;[/HTML] is working.

and another major issue is when i used this the above method, selected index is
changing but cboUserGroup_SelectedIndexChanged is not firing.

Note: i used autopostback=true for dropdown list.

plz help me to solve this.
thanx in advance.
Apr 14 '08 #1
2 1124
Curtis Rutland
3,256 Expert 2GB
and another major issue is when i used this the above method, selected index is
changing but cboUserGroup_SelectedIndexChanged is not firing.
Well, what you could do is whenever you use the codebehind to change the selected index, you could follow that with a call to
Expand|Select|Wrap|Line Numbers
  1. cboUserGroup_SelectedIndexChanged(cboUserGroup, null);
Apr 14 '08 #2
nirmalsingh
218 100+
thank you, now the event is firing.
but the first problem is not solved, that is i cannot select desired option in combo box.
Apr 15 '08 #3

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

Similar topics

2
by: Sudhir | last post by:
Hi, I have a dropdownlist, which I am creating during runtime. I am then populating it dynamically. Depeding on a condition, I am changing the selected value. After this I am adding the dropdown...
3
by: Olivier Verdin | last post by:
Hi, I have a page with several Textboxes and several DropDownList. When I click on a 'save' button, it creates a record in a database. The page works fine under Internet Explorer. It does...
0
by: Penny Bond | last post by:
Hello, Have an asp.net page that has a number of textboxes, dropdownlists, buttons, datagrid and custom validators on it. In all dropdownlists on the page, I have approximately 20 Here is...
1
by: Wim | last post by:
Hi Everyone, I'm trying to speed up a Asp.net 1.1 applications' performance. The application needs to run in an environment with little bandwith and therefore pagesizes and roundtrip times shoud...
1
by: TRobran | last post by:
What I'm trying to do seems pretty straightforward so I must be missing something simple. Any help is greatly appreciated. On my page I have a DropDownList, a HtmlTable and a Button. Each row...
2
by: Steve Pierce | last post by:
I am having some issues with a runtime dropdownlist in a datagrid. The issue is that I cannot get ViewState to fill the selected index of a runtime dropdown properly on postback. I do not want to...
2
by: P. Yanzick | last post by:
Hello, I am creating an edit template for a FormView control, changing one of the textboxes to a dropdown box. The dropdown will be populated from a simple table with the primary key, and a...
0
by: psrinivasan | last post by:
I have a table (Request table)with SupplierID SupplierName (dropdownlist on all vendors to choose from) InsuranceDetails Now I have to pull in all the supplier names from file VENDOR...
1
by: klaul | last post by:
Hi there. I'm having an issue with autopostback, in that it doesn't seem to be working! The webform I am using pulls the data from an AccessDataSource to populate the gridview, which has Edit and...
2
by: Paul | last post by:
I've written som junk code below to show a problem I'm getting: On a page I've got a dropdownlist and a button using submit behaviour: <asp:DropDownList ID="tester" runat="server"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.