Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-15
2
Medium Priority
?
287 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 1600 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

730 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