Solved

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

Posted on 2008-10-15
2
276 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

734 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