Urgent please

Reply

Join Date: May 2007
Posts: 4
Reputation: usershan is an unknown quantity at this point 
Solved Threads: 0
usershan usershan is offline Offline
Newbie Poster

Urgent please

 
0
  #1
Jul 31st, 2007
Hi to all
I have an drop down list, in that there are two fields one is income, expenses and text box . If i select income from the dropdown list then the text box should be disabled, if i select expenses then the textbox should be enabled.

I have tried using this code.
My code
Protected Sub type_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles type.SelectedIndexChanged
If type.SelectedValue.ToString = "Income" Then
vc.Enabled = False
Else
vc.Enabled = True
End If
End Sub
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 24
Reputation: atal is an unknown quantity at this point 
Solved Threads: 0
atal atal is offline Offline
Newbie Poster

Re: Urgent please

 
0
  #2
Jul 31st, 2007
you should enable autopostback for the dropdown list otherwise it wont work.
If you need to run it on a client side then use javascript.

Thank you
Khaled
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,580
Reputation: Infarction has a spectacular aura about Infarction has a spectacular aura about Infarction has a spectacular aura about 
Solved Threads: 52
Infarction's Avatar
Infarction Infarction is offline Offline
Battle Programmer

Re: Urgent please

 
0
  #3
Jul 31st, 2007
I'd also point out that in your code you have both code paths setting the control to Enabled rather than one changing it to Disabled. Possibly a typo in your post, possibly in your actual code, so I thought I'd mention it.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 2
Reputation: vbLegend is an unknown quantity at this point 
Solved Threads: 0
vbLegend's Avatar
vbLegend vbLegend is offline Offline
Newbie Poster

Re: Urgent please

 
0
  #4
Aug 1st, 2007
Originally Posted by usershan View Post
Hi to all
I have an drop down list, in that there are two fields one is income, expenses and text box . If i select income from the dropdown list then the text box should be disabled, if i select expenses then the textbox should be enabled.

I have tried using this code.
My code
Protected Sub type_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles type.SelectedIndexChanged
If type.SelectedValue.ToString = "Income" Then
vc.Enabled = False
Else
vc.Enabled = True
End If
End Sub
Try this

  1. Protected Sub type_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles type.SelectedIndexChanged
  2. If type.Text = "Income" Then
  3. vc.Enabled = False
  4. Else
  5. vc.Enabled = True
  6. End If
  7. End Sub
Use code tags!!

The Legend
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 24
Reputation: atal is an unknown quantity at this point 
Solved Threads: 0
atal atal is offline Offline
Newbie Poster

Re: Urgent please

 
0
  #5
Aug 1st, 2007
Originally Posted by vbLegend View Post
Try this

  1. Protected Sub type_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles type.SelectedIndexChanged
  2. If type.Text = "Income" Then
  3. vc.Enabled = False
  4. Else
  5. vc.Enabled = True
  6. End If
  7. End Sub
No, the code he has written is perfectly right, and the event he is firing is a server side event which will work after page being processed to the server, thats why Autopostback is needed for combobox.

Khaled
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 812
Reputation: arjunsasidharan is on a distinguished road 
Solved Threads: 13
arjunsasidharan's Avatar
arjunsasidharan arjunsasidharan is offline Offline
Practically a Posting Shark

Re: Urgent please

 
0
  #6
Aug 1st, 2007
>>thats why Autopostback is needed for combobox.

I thought it was drop down list.
There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum


Views: 1020 | Replies: 5
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC