Solved

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

Posted on 2008-10-15
2
281 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

622 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