Disable Web Control Button

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

Disable Web Control Button

 
0
  #1
Feb 6th, 2006
I need some assistance with disabling web control button. First, i need to check if the value related to the button is in the listbox. This is done.

If the item is in the listbox, disable the button. I am thinking the possibility of using a loop statement. However, i do not know how to write it to check if the item related to the button matched before disabling button.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Disable Web Control Button

 
0
  #2
Feb 6th, 2006
Are you doing this client-side, or server-side?

What do you mean by "disable"? Show, but have no effect when clicked? Or, remove the button completely?

I have difficulty understanding your last sentence. Could you rephrase the question?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

Re: Disable Web Control Button

 
0
  #3
Feb 6th, 2006
Server Side.

I am doing a movie booking page and the seats are represented by web control buttons. They are to be disabled when the seats booked values are listed in a listbox known as listbox_seatsbooked.

From the listbox_seatsbooked, it is suppose to check if the value of the button matches the ones listed in the listbox to disable the button from being clicked again. (Seats can't be booked) again.

I have included an image of how it looks for better clarifications.
http://i1.tinypic.com/ncim4l.jpg
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

Re: Disable Web Control Button

 
0
  #4
Feb 7th, 2006
' Disable the Add button if the ListBox control already contains the item.

Dim name as string
Dim item As ListItem = listbox_seatsbooked.Items.FindByText(name)
If Not item Is Nothing Then

a1.Enabled = False
Else
a1.Enabled = True

End If
I tried writing this. However, its not executing.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 275
Reputation: f1 fan is an unknown quantity at this point 
Solved Threads: 11
f1 fan f1 fan is offline Offline
Posting Whiz in Training

Re: Disable Web Control Button

 
0
  #5
Feb 10th, 2006
you made a small error... you didnt set 'name' to anything.

Dim name as string
Dim item As ListItem = listbox_seatsbooked.Items.FindByText(name)
If Not item Is Nothing Then
need to be

  1. Dim name as string = thebutton.tag
  2. 'that is assuming you set the tag to be the seat number such as A1 on btna1, A2 on btna2 etc.
  3. Dim item As ListItem = listbox_seatsbooked.Items.FindByText(name)
  4. If Not item Is Nothing Then
  5.  
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

Re: Disable Web Control Button

 
0
  #6
Feb 13th, 2006
Hi f1_fan, thanks for ur assistance.

I cannot find a declaration known as .tag in asp.net (codebehind vb.net). I tried using C# converter to VB.net.

Any suggestions?

Originally Posted by f1 fan
you made a small error... you didnt set 'name' to anything.

need to be

  1. Dim name as string = thebutton.tag
  2. 'that is assuming you set the tag to be the seat number such as A1 on btna1, A2 on btna2 etc.
  3. Dim item As ListItem = listbox_seatsbooked.Items.FindByText(name)
  4. If Not item Is Nothing Then
  5.  
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
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC