Solved

How to set Dropdown List records that are not selected to be invisible or unabled?

Posted on 2008-10-15
2
249 Views
Last Modified: 2012-05-05
I have an ASP.NET page to retrieve a country name from a list of calculations. Then I forward this country name to the next page which has a dropdown list ddlCompany loaded with a list of companies. Then I need to set one record in the list to be selected (the value passed from last page I mentioned above). Now since this page is read only, I want to disable (or set to invisible) all other country records in the dropdown list so that user only sees this record in the drop down list box. Or the dropdown list is diabled so that user can see only the record which matches the value passed from last page on the dropdown list text box area. Is this possible? Thanks a lot.
0
Comment
Question by:heyday2004
2 Comments
 
LVL 5

Accepted Solution

by:
varungd earned 400 total points
ID: 22728554
Change the enable property as false for dropdownlist
eg:
<asp:DropDownList ID="DropDownList1" runat="server" Enabled="False" Width="166px">
<asp:ListItem>a</asp:ListItem>
<asp:ListItem>aa</asp:ListItem>
<asp:ListItem>b</asp:ListItem>
</asp:DropDownList>
 
c#

protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.SelectedItem.Text = "B";


}
0
 
LVL 1

Assisted Solution

by:ashishkaithi
ashishkaithi earned 100 total points
ID: 22728629
Hi,
what I understood is u r sending
country value to other page and
using this name u fill the companies and
after displaying appropriate records for (COUNTRY_NAME,COMPANY_NAME) pair u want to disable it
but why if u want other pair then like.
(COUNTRY_NAME,COMP1)
(COUNTRY_NAME,COMP2)
(COUNTRY_NAME,COMP3)
If I m wrong let me knw.
If I m write and u want like u said
Go to SelectedIndexChanged event of Drodown(remember u must set autopostback=true) and
disable the dropdown
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now