473,831 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

easy ASP.NET question

I have a asp:button wth an event handler, when the event fires I also want to
change the property attribute of a div tag to not visible.

How do I reference the HTML doms named item to set the property ?
I know how with JavaScript on the client with DHTML, but confused now

--
Andrew
Sep 19 '06 #1
4 1123
if you can do it with Javascript, then just create a javascript function
that does it and call it from client side using OnClientClick button event.
Take a quick read of this blog
http://aspnet2holes.blogspot.com/

Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"andrewcw" <an******@acw.c omwrote in message
news:68******** *************** ***********@mic rosoft.com...
>I have a asp:button wth an event handler, when the event fires I also want
to
change the property attribute of a div tag to not visible.

How do I reference the HTML doms named item to set the property ?
I know how with JavaScript on the client with DHTML, but confused now

--
Andrew

Sep 19 '06 #2
Thanks - seems the asp:Panel is the equivalent for design and renders the div
tag. Seems that the HTML DOM is simply not accessible
--
Andrew
"andrewcw" wrote:
I have a asp:button wth an event handler, when the event fires I also want to
change the property attribute of a div tag to not visible.

How do I reference the HTML doms named item to set the property ?
I know how with JavaScript on the client with DHTML, but confused now

--
Andrew
Sep 19 '06 #3
"andrewcw" <an******@acw.c omwrote in message
news:68******** *************** ***********@mic rosoft.com...
>I have a asp:button wth an event handler, when the event fires I also want
to
change the property attribute of a div tag to not visible.

How do I reference the HTML doms named item to set the property ?
I know how with JavaScript on the client with DHTML, but confused now
In your HTML:
<asp:Button ID="MyButton" runat="server" OnClick="MyButt on_Click" />

In your server-side code's Page_Load event:
MyButton.Attrib utes.Add("oncli ck", "alert('Hel lo world!)';");

Since you already know how to hide the div with JavaScript, substitute the
alert code with the JavaScript code which hides the div.
Sep 19 '06 #4
That's both right and wrong. Simply remove the div from the HTML. Replace
the div with a Panel control which renders as a div at runtime. In the
button's event handler reference the Panel and set Panel1.Visible = false
noting this requires a PostBack of course.

If you still want to do it at runtime you need to write attributes to the
button at runtime. When the button is clicked it can invoke your JavaScript
function which disables visibility. You can also raise the button's event
handler using JavaScript. Start learning AJAX/Atlas.

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W

"andrewcw" <an******@acw.c omwrote in message
news:83******** *************** ***********@mic rosoft.com...
Thanks - seems the asp:Panel is the equivalent for design and renders the
div
tag. Seems that the HTML DOM is simply not accessible
--
Andrew
"andrewcw" wrote:
>I have a asp:button wth an event handler, when the event fires I also
want to
change the property attribute of a div tag to not visible.

How do I reference the HTML doms named item to set the property ?
I know how with JavaScript on the client with DHTML, but confused now

--
Andrew

Sep 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2238
by: rdsteph | last post by:
I am having a lot of fun using the pyGoogle module ( http://pygoogle.sourceforge.net/ ) that uses the Google API. It is about as easy to use as I can imagine, and it is a lot nicer than using my old HTMl screen scraping habits. My online CGI program Ask Merlin at www.awaretek.com/askmerlin.html is an example. Currently, the program takes any user's question and picks the best answer from amongst the possible answers given by the user....
0
1374
by: | last post by:
I don't know SQL at all, but I have a problem now because I must use SQL in my PHP scripts. So please help me! I have 2 tables: id | name ----------- 1 | thing1 2 | thing2 3 | thing3 4 | thing4
5
1535
by: LedZep | last post by:
What up, All I need to do is enter a last name in a text box, query a MSAccess database and display the name with the corresponding columns. This is no problem, but when there are more than one records with the same last name, I need to click a command button to display the next record with that name. I cant find it in any of my books and it sounds like an easy enough question. Any help is definately appreciated. TIA,
1
4980
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real pain to work with if you just want to throw some values in a grid and edit them with a textbox. i don't want to persist anything in a database, i just need a fast cheap and easy grid in memory that i can work with! i had functions in vb6 that...
13
1485
by: Ghislain Tanguay | last post by:
I have a compiled vb.net app and I want to give the user a choice to launch it from the start line command and pass it a parameter or not. How can I do that in my code? Is it possible? Ex. : MyApp.exe "Go"
1
1494
by: melanieab | last post by:
Hi, If there's a textbox and the text entered is longer than what's visible (the textbox length), how do you make it so that the beginning chunk of text is visible (instead of the last part of it)? Thanks again!!! Mel
23
2447
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
6
2300
by: Martin Bootsma | last post by:
I have a C question, which looks very easy, but no one here seems to know an easy answer. I have a function "powell" (from Numerical Recipes) which takes an argument of the type "double (*f)(float)" But I want to be able to pass a
27
2300
by: smnoff | last post by:
How does( or should user use) strncpy() to allocate enough memory space for the destination string, s1? I guess I am having trouble using strncpy as it seems to be giving me errors. And just as well, I don't know the value of n until the program runs, so it needs to be dynamically allocated. Then again I hard coded n to be number like3 just to even see if that works.
9
1901
by: rynTAU | last post by:
This is an easy question, I'm sure but I can't seem to figure it out. I'm trying to use the number_format() function to remove all decimal places from a number. $num = number_format($num, 0, '.', ''); So if I have 23.34567 I want 23, and 45.8789 will return with 45.
0
9793
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10534
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,...
0
9317
agi2029
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...
1
7748
isladogs
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...
1
4417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.