Hi,
I am trying to access the visible property of an ASP button inside
javascript to no avail. Here's what my button control looks like:
<asp:Button id="btnAcceptTr ips" name="btnAccept Trips" runat="server"
Text="Accept Trips" Visible="False" >
Here's my test method:
function test(checkbox)
{
if (checkbox.check ed)
{
document.Form1. btnAcceptTrips. visible = true
}
}
I get an error saying this object is null or doesn't exist. So I
played around with this. I can verify that I can access the
btnAcceptTrips object within javascript, I can even access the
btnAcceptTrips object name property value, but visible doesn't appear
to be accessible. I've tried "Visible" and "visible".
Does anyone know how to get access to this value? 5 16308
Doogie said the following on 6/18/2007 11:08 AM:
Hi,
I am trying to access the visible property of an ASP button inside
javascript to no avail. Here's what my button control looks like:
<asp:Button id="btnAcceptTr ips" name="btnAccept Trips" runat="server"
Text="Accept Trips" Visible="False" >
What your server code looks like is irrelevant. What is important is the
HTML that the browser gets.
Here's my test method:
function test(checkbox)
{
if (checkbox.check ed)
{
document.Form1. btnAcceptTrips. visible = true
}
}
I get an error saying this object is null or doesn't exist. So I
played around with this. I can verify that I can access the
btnAcceptTrips object within javascript, I can even access the
btnAcceptTrips object name property value, but visible doesn't appear
to be accessible. I've tried "Visible" and "visible".
Does anyone know how to get access to this value?
Visibility is a property of the style object.
..style.visibil ity = "visible"
..style.visibil ity = "hidden"
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Hi Randy,
This works - but to a point. If I start the app off with the button
visible like so:
<asp:button id="btnAcceptTr ips" runat="server" Text="Accept Trips"
Visible="True" name="btnAccept Trips"></asp:button>
then everything works fine.
But if I set the visibility property of the control to false like this
(and this will be the way my app neds to be have:
<asp:button id="btnAcceptTr ips" runat="server" Text="Accept Trips"
Visible="False" name="btnAccept Trips"></asp:button>
and then start the app, when I try to set the .style.visibili ty value
I get this error:
'document.Form1 .btnAcceptTrips .style' is null or not an object.
Doogie wrote:
Hi Randy,
This works - but to a point. If I start the app off with the button
visible like so:
<asp:button id="btnAcceptTr ips" runat="server" Text="Accept Trips"
Visible="True" name="btnAccept Trips"></asp:button>
then everything works fine.
But if I set the visibility property of the control to false like this
(and this will be the way my app neds to be have:
<asp:button id="btnAcceptTr ips" runat="server" Text="Accept Trips"
Visible="False" name="btnAccept Trips"></asp:button>
and then start the app, when I try to set the .style.visibili ty value
I get this error:
'document.Form1 .btnAcceptTrips .style' is null or not an object.
Quote what you respond to so everyone can follow along without having to
reference threads that may not be available.
Also, just like Mr. Webb said, you need to worry about (valid) HTML.
Without it, JavaScript cannot behave consistently.
Start with this and or modify until you get what you want.
<form id="form1">
<button name="button1" type="button">A ccept Trips</button>
</form>
<script>
document.forms['form1'].elements['button1'].style.visibili ty = 'hidden';
</script>
--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Quote what you respond to so everyone can follow along without having to reference threads
that may not be available.
Why would a reference thread not be available (just curious).
Personally, I find the additional quotes annoying to parse through.
Also, just like Mr. Webb said, you need to worry about (valid) HTML. Without it, JavaScript cannot behave consistently.
What is invalid about my html? I created it directly from within .NET
by dumping the control onto my form and setting the visible property
to false (which is what I need). I need this control to be invisible
when the app starts, and then my javascript method will make it
visible or invisible depending on condtions. If I start with the
control visible and run through setting it's visibility in javascript
it works, but if I start with it invisible it does not work.
Doogie said the following on 6/18/2007 4:12 PM:
>Quote what you respond to so everyone can follow along without having to reference threads that may not be available.
Why would a reference thread not be available (just curious).
Personally, I find the additional quotes annoying to parse through.
Because, in my case, I have already read the message you are replying to
(in fact, I wrote it). And since I have already read it, and not marked
it unread, Thunderbird doesn't show it to me anymore unless I go through
certain steps to view it again. Quoting what you are replying to
prevents that from ever happening.
>Also, just like Mr. Webb said, you need to worry about (valid) HTML. Without it, JavaScript cannot behave consistently.
What is invalid about my html?
Good question :) Since you posted the server side code (which I said was
irrelevant) nobody would know what the browser got without having an
ASP.NET server to serve it to the browser to see. When posting code
here, post the resulting HTML and not the server code that generates it.
I created it directly from within .NET
I am not a big fan of the HTML that .NET produces.
by dumping the control onto my form and setting the visible property
to false (which is what I need). I need this control to be invisible
when the app starts, and then my javascript method will make it
visible or invisible depending on condtions. If I start with the
control visible and run through setting it's visibility in javascript
it works, but if I start with it invisible it does not work.
Then start with it visible and immediately hide it.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sundown |
last post by:
I am trying to create a custom button control for the web that, when clicked,
disables and changes the text of itself and a bunch of other controls (in the
collection). My goal is to end up with a button that prevents the user from
submitting a form back multiple times and also prevents them from submitting
the form and then clicking something else before the postback can finish
processing.
What I have is a working button that disables...
|
by: Dot net work |
last post by:
Hello.
I've read many posts about disabling submit buttons, but I can't get
these answers to solve my problem.
I have a server side asp.net button, and under the button I have code
behind that does some simple processing, followed by a
response.redirect.
When the user clicks on this button, I would like the button to
|
by: Red |
last post by:
Can you access web form control via javascript ie..
if I have <asp:textbox runat=server id=txtTextbox/>
can I say in javascript
txtTextbox.Enabled = true;
??
|
by: R Duke |
last post by:
I have tried everything I can think of to change the visible property
of a design time created control from a dynamically created control's
command event handler.
Here is the scenario.
I have a WebForm with some textboxes, dropdownlists, a panel,
imagebutton and so on. When I click on the image button (which was
created at design time) I dynamically build a table. In each of row of
that new table I put several cells and one cell...
|
by: Craig G |
last post by:
i have a user control which is basically a datagrid, which has
add/edit/delete buttons on the grid
is there anyway of accessing the actual datagrid from the form itself?
basically i want to set the add/edit/delete options visble/invisible on the
datagrid depending on the users's role, but found that i cannot access the
grid to do this.
is the only way of setting it in the page load of the usercontrol itself?
| |
by: Bob |
last post by:
Hello:
I have a form with 26 panels. Each panel has a bunch of other controls in
it. The panels visible property are set to False.
Each panel has a corosponding button to set it's visible property to true
and all the other panels to false when clicked.
Well, thats a lot of code in the form. I would like to move the code for the
buttons to a module for code organization.
|
by: Keith |
last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate.
Each item contains a checkbox with an ID of chkReconciled, and the header
contains a single checkbox with an ID of chkAll. I simply want to have
chkAll be checked if every item in the repeater has its checkbox checked. In
the code behind page, I can access the checked property of chkReconciled by
doing the following:
Dim CurrentCheckBox As CheckBox...
|
by: Keith |
last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate.
Each item contains a checkbox with an ID of chkReconciled, and the header
contains a single checkbox with an ID of chkAll. I simply want to have
chkAll be checked if every item in the repeater has its checkbox checked. In
the code behind page, I can access the checked property of chkReconciled by
doing the following:
Dim CurrentCheckBox As CheckBox...
|
by: GaryDean |
last post by:
I have a Wizard page and need to affect the next and previous buttons from
my code-behind. I've googled around and found two solutions, and neither
appear to work.
I can access the SideBarList steps successfully with the following code...
Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer");
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList");
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |