Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2010, 12:53 PM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Default UpdatePanel question

This is expanding on a post I made in the Beginning ASP.net 3.5 book forum, but since it's slightly beyond the scope of the book, I decided to post it here.

I'm having trouble figuring out UpdatePanels. What I want is to be able to trigger an UpdatePanel from multiple controls outside of it and have only the content inside of it refresh. And the content inside to be different depending on which control I clicked.

Imar suggested I use LinkButtons, which was a great idea. But I still can't figure out how to make each LinkButtons uniquely change the content of the UpdatePanel.

For example, say my updatepanel is in the main content area of my site, and I have "lnkBlue" and "lnkRed" linkbuttons in a sidebar outside of it. When I click the lnkBlue button, I want the main content area to turn blue. When I click the lnkRed button, I want the main content area to turn red. And I want only the main content area to postback via the updatepanel.

Thanks,
-Chris
  #2 (permalink)  
Old August 17th, 2010, 04:53 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Chris,

Are triggers what you're looking for?

http://www.codegod.de/WebAppCodeGod/...AX-AID282.aspx
http://www.google.com/#hl=en&source=...panel+triggers

And is the change of color just an example, or your actual requirement?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old August 18th, 2010, 04:53 PM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Default

The color thing is just a hypothetical example.

I've done some Google searching but something about triggers just isn't clicking with me. Let me ask this one question, because I think it might be the basis of my confusion: can an UpdatePanel be triggered by a control on a DIFFERENT .aspx page?

I appreciate your time,
-Chris
  #4 (permalink)  
Old August 19th, 2010, 01:43 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
Let me ask this one question, because I think it might be the basis of my confusion: can an UpdatePanel be triggered by a control on a DIFFERENT .aspx page?
No. Period. ;-)

The whole idea of the UpdatePanel is to only refresh a portion of a page and avoid a full page request. A "different page" is by definition a new request, and thus AJAX is useless. When you click a button on Page A which redirects to Page B, there is always a new request and there is nothing left to "just update".

Maybe you can make it less hypothetical and try to explain what you're doing? There may be other alternatives such as AJAX + Web Services or even iframes.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #5 (permalink)  
Old August 19th, 2010, 11:28 AM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Default

That clears everything up for me. What I was attempting to do was update a main content area of my default.aspx page by use of linkbuttons from the master page. See, I have my sidebar, menu and header all housed in the master page, and I wanted just the main content area to postback when links were clicked.

Obviously that wasn't working. My solution was to put everything on the master page, put the content from each page in its own panel within the updatepanel, and code each linkbutton's click event to set its corresponding panel to .visible = true and all the rest to .visible = false. Works like a charm now :)

And now that I've figured it out, I think I'm going to go back to the old non-AJAX way. Something just doesn't seem right about having the majority of a website load via javascript. This was more for my own edification than anything else.

I really appreciate your help.
-Chris
  #6 (permalink)  
Old August 19th, 2010, 01:05 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You're welcome. Glad I could help.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
caiman (August 19th, 2010)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 10 - UpdatePanel question caiman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 August 15th, 2010 12:05 PM
UpdatePanel without ScriptManager Manoj Bisht ASP.NET 3.5 Professionals 2 March 9th, 2009 11:12 PM
UpdatePanel daniel.mihalcea Ajax 10 September 27th, 2008 07:39 AM
UpdatePanel Problem? rajatbirth_1978 .NET Framework 2.0 0 February 14th, 2007 02:27 AM



All times are GMT -4. The time now is 08:24 AM.


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