Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
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
 
Old April 13th, 2009, 11:06 AM
Authorized User
 
Join Date: Jan 2009
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default User click change text of a div

Is it possible to create a dynamic section of a webpage that changes when a user clicks a picture? I have a website that has a div called Description and five pictures. On page load, the first picture is selected and the description div displays the information for that picture. What I want to accomplish is if the user clicks the second picture, the text in the description div to change without going to a different page. Is this possible to do in ASP.Net without the use of javascript?
 
Old April 13th, 2009, 11:44 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

If you don't want to use JavaScript, you would have to make the clicks on the pictures post back to the server. There, you could set the description text to anything you want.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old June 10th, 2009, 01:38 AM
Authorized User
 
Join Date: Feb 2009
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default use javascript

Hi,

I don't this will full fill your requirement, but tried this.

you can use javascript to change text of div tag. Here I am giving some code to use.

Code:
<script type="text/javascript">
function display(id)
{
       if(id==1)
       {
          document.getElementById('div1').innerHTML = 'your required text';
       }
}
</script>
<img src="" onclick="display(1);" />>br/>
<div id="div1">
default text
</div>
I think this will helps you.

http://www.codedefiner.com
__________________
Rajendar





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to center text/image/any object into a div beetle_jaipur BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 3 January 24th, 2013 01:25 PM
Change return type of Click Event prasanna.nadgir C# 11 August 9th, 2007 11:11 PM
Change name of buttonfield on click GS ASP.NET 2.0 Professional 0 March 15th, 2007 11:34 AM
Hide div unless user logged in DanDan PHP How-To 4 January 21st, 2005 08:21 PM





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