 |
| ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 30th, 2007, 02:50 PM
|
|
Registered User
|
|
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
masterpages, contentplaceholder, formview, button
Since I am using master pages, I have a button in a formview in a contentplaceholder. I want the visibility of the button false if the value of a textbox in the same formview is not "AO" . Which event do I handle this? I tried every event available for the formview. Here is my code.
Dim ct As ContentPlaceHolder = CType(Master.FindControl("contentplaceholder1"), ContentPlaceHolder)
Dim fv1 As FormView = CType(ct.FindControl("formview1"), FormView)
Dim tbfund As TextBox = CType(fv1.FindControl("fundTextBox"), TextBox)
Dim btn2 As Button = CType(fv1.FindControl("button2"), Button)
If Not tbfund.Text = "AO" Then
btn2.Visible = False
End If
|
|

November 30th, 2007, 03:59 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Is this something you want to have happen on the client or the server?
As you type into a textbox some client side events fire (keydown, keypress, keyup, maybe more). After you exit the textbox (if the text has changed) the client side textChanged event fires. This is the client side event that is tied to a postback when the control is set for AutoPostback so you'll only get a server side TextChanged event on a text box when the user exits the textbox. If you want to have some dynamic action take place based on a changing value of a textbox you'll need to do some client side scripting.
-Peter
|
|

December 1st, 2007, 12:35 PM
|
|
Registered User
|
|
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Peter,
On the page is a gridview and a formview at the bottom. the formview shows a selected item from the grid. The formview only shows in edit mode. I need for a button, which goes and gets a new Travel Authorication number, to be visible=false if
1. NOT fundtextbox.text ="AO" OR
2. TATextbox.text is not null.
So, when the formview loads, on which event do I run the above logic to make the button visible or invisible? all these controls and button are inside a formview which is inside a contentplaceholder
thanks
Milton
|
|

December 1st, 2007, 09:39 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Will the values driving these conditions be changed by the user between postbacks? As I described before this will have a significant influence on the solution.
-Peter
|
|

December 2nd, 2007, 09:07 PM
|
|
Registered User
|
|
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by planoie
Will the values driving these conditions be changed by the user between postbacks? As I described before this will have a significant influence on the solution.
-Peter
|
NO. These values are already there. If the fund is already "AO" and the TA(Travel Authorization) textbox is empty, then the button can show, IE be visible so the user can click the button and generate a new TA. That is all I want to happen. display the Get TA button or hide the Get TA button.
|
|

December 4th, 2007, 01:17 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
I'm not sure what the problem is. Your code looks ok. However, it seems like there is a lot more than needs to be there. Why all the "FindControl" calls? The button and text box on the form should be directly accessible by their instance names.
-Peter
|
|
 |