Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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
 
Old September 17th, 2004, 05:06 PM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Buttons Enabled property from another frame

Hi,

I have two frames with webforms.
In the top frame I have a Button,
in the bottom frame I have a DataGrid.
I want to set top frames Button Enabled property to true or false depending on if I have selected or deselected a row in the bottom frames DataGrid.

How is that done?

Regards,
Peter
 
Old September 27th, 2004, 01:05 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You need to employ javascript to do this. The syntax is something along these lines...

window.top.frameName.formName.buttonName.enabled = true|false
 
Old September 28th, 2004, 04:22 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Planoie,
I'm new to this.
When I'm trying your suggestion I'm not able to see the frames name unless I write the javascript in the frames Html-code. And I'm not able to see the forms name neither.

I got two webforms Webform1 and Webform2. In Webform1 I have placed the DataGrid and in Webform2 the buttons. The ID of the topFrame is top1 and the ID of the bottomFrame is bottom1. The bottomFrame holds Webform1.aspx and the topFrame Webform2.aspx.
Do I have to declare my Webforms and buttons somewhere else or in another matter?

Regards,
Peter

 
Old September 28th, 2004, 01:34 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The javascript needs to be in the HTML. That's the only place it will work.

What do you mean by "I'm not able to see the frames name"?
 
Old September 29th, 2004, 03:15 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I have the DataGrids Select Event in Webform1 and try to write the javacode that you suggested in the HTML-code behinde Webform1, I will get suggestions of what to chose when i write a dot after window.top, none of the suggestions are the framename I want to referre to. I can only se the framename if I write the javacode in the frames HTML-code, but I never get the suggestion for the webformname, Webform2.
I'm certainly doing something wrong, but I cant figure out what...

Best regards,
Peter

 
Old October 4th, 2004, 12:12 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Don't trust intellisense for javascript. Just write it and try it out. The browser will tell you if the javascript is bad.
 
Old October 5th, 2004, 03:20 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You were right about the Intellisense...
But the call to the Enabled-property doesn't work. I get no error and it changes nothing. Take a look at the piece of code beneath.

function btnClick() {
   try
   {
      window.top.top1.Form2.btn1.enabled=false; //Doesn't change anything and doesn't generate an error//
      window.top.top1.Form2.btn2.style.visibility="hidde n"; //This works just fine...//
   }
   catch(e)
   {
      alert(e.message);
   }
}

 
Old October 25th, 2004, 02:40 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Whenever I have problems with javascript I use lots of "alert()"s. Try alerting "window.top.top1.Form2.btn1" and see if you get "[object]" as a result. Then you'll know whether or not that is resolving to the button object or not.





Similar Threads
Thread Thread Starter Forum Replies Last Post
paging enabled but hidden buttons DarkForce ASP.NET 2.0 Basics 1 July 27th, 2007 02:52 AM
change from two frames to just one frame crmpicco HTML Code Clinic 1 August 19th, 2005 10:24 PM
Bound Object Frame Property Needed SerranoG Access VBA 0 April 16th, 2004 10:42 AM
Changing Control Property from another Frame Wandha ASP.NET 1.0 and 1.1 Basics 4 August 8th, 2003 01:34 AM
Changing Control Property from another Frame Wandha Forum and Wrox.com Feedback 1 August 5th, 2003 07:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.