 |
| 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 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
|
|
|
|

August 17th, 2010, 12:53 PM
|
|
Authorized User
|
|
Join Date: Aug 2010
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 18th, 2010, 04:53 PM
|
|
Authorized User
|
|
Join Date: Aug 2010
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 19th, 2010, 01:43 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

August 19th, 2010, 11:28 AM
|
|
Authorized User
|
|
Join Date: Aug 2010
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 19th, 2010, 01:05 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome. Glad I could help.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|
 |