Solved

Selected Index Change of a Drop Down List

Posted on 2004-08-16
6
1,028 Views
Last Modified: 2008-03-04
Hello,
I have I one drop down list and one textbox contol on my asp page.
I want to do that, when I changed the selected index of a drop down list with special condition the textbox become disabled.
For example;
Private Sub ddlCalismaDurumu_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles       ddlCalismaDurumu.SelectedIndexChanged
        If ddlCalismaDurumu.SelectedIndex = 1 Then
            txtSure.Enabled = False
        End If
    End Sub
But this solution does not work. Because (I think) it requires refresh.
So how can I do that without refresh.
Many Thanks
0
Comment
Question by:emrahtufan
[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
6 Comments
 
LVL 8

Expert Comment

by:razo
ID: 11808843
u can do it with java script
0
 
LVL 8

Expert Comment

by:razo
ID: 11808857
<asp:DropDownList id="DropDownList1" runat="server" onChange="javascript:dropDownUpdate1();"></asp:DropDownList>

then add this function in the javascript section
function dropDownUpdate1() {
      if document.getElementById("dropdownlist1").value =1
document.getelementbyid("textbox1").enable=false;
}
0
 
LVL 8

Expert Comment

by:shovavnik
ID: 11808858
Can you use javascript for this solution or do you have to post back and disable the button on the server?

Does the solution have to be compatible for all browsers, or can it work just on IE?

0
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!

 
LVL 4

Expert Comment

by:hamood
ID: 11808896
WHERE are you adding or binding date with dropdown list. if you binding data from any database then call the binding data like this in page onload event

if page.ispostback = false then
    loaddata()
endif

also set autopost back property of list box to true

i think your are not getting the selected index of of the list box. try to debug your code


Hamood

0
 
LVL 11

Accepted Solution

by:
saleek earned 100 total points
ID: 11809171
Check that the DropDownLists control has the option "AutoPostBack" is set to True.

regards,

KS
0
 
LVL 8

Expert Comment

by:daffodils
ID: 11810943

Check the "AutoPostBack" property for the DropDownList and set it to "True".
A selection change in a DropDownList does not cause a postback by default, that is why the SelectedIndexChanged event does not fire. A refresh sort-of simulates a postback and the event fires.

Set the "AutoPostBack=True" and you won't need to refresh.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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…

691 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