Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 14th, 2012, 05:59 AM
Authorized User
Points: 180, Level: 3
Points: 180, Level: 3 Points: 180, Level: 3 Points: 180, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: Milan, , Italy.
Posts: 39
Thanks: 2
Thanked 2 Times in 2 Posts
Default Replace Content based on button click

Hi all,
I have in my Default.aspx a simple table like this:

HTML Code:
<table>
<tr>
<td>
asp:Content ID="ContentLeft" ContentPlaceHolderID="HeadContent" runat="server">
<asp:Button ID="btn1" runat="server" Text="First form" />
<asp:Button ID="btn2" runat="server" Text="Second form" />
<asp:Button ID="btn3" runat="server" Text="Third form" />
/asp:Content>
</td>
<td>
<asp:Content ID="ContentCenter1" ContentPlaceHolderID="MainContent" runat="server">
</td>
</tr>
</table>
Is it possible to replace the ContentCenter based on the button clic?

For example, if the user clicks on btn2, I need to replace the ContentCenter1 with another content, placed (for example) in the Default.aspx itself.

Luigi
Reply With Quote
  #2 (permalink)  
Old February 14th, 2012, 01:34 PM
Friend of Wrox
Points: 742, Level: 10
Points: 742, Level: 10 Points: 742, Level: 10 Points: 742, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Location: Tehran, Iran
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Default use iFrame

you can use 'iframe'
Code:
<table>
<tr>
<td>
<asp:Content ID="ContentLeft" ContentPlaceHolderID="HeadContent" runat="server">
<a href="FirstForm.aspx" †target="myFrame"††>First Form</a>
<a href="SecondForm.aspx" target="myFrame"††>Second Form</a>
<a href="ThirdForm.aspx" †target="myFrame"††>Third Form</a>
</asp:Content>
</td>
<td>
<iframe name="myFrame" id="myFrame" border="no" width="100%" height="100%"></iframe>
</td>
</tr>
</table>


You can't replace a asp.net control with other (because of runat="server"). you can load at runtime but you can't replace existing item
often UserControls are loaded at runtime:
aspx page:
Code:
<td id="td1" runat="server"></td>
aspx.cs :
Code:
MyUserControl ctrl = LoadControl("~/UserControls/MyUserControl.ascx");
td1.Controls.Add(ctrl);
note that this control will be distroyed after postback
__________________
happy every time, happy every where

Reza Baiat
Reply With Quote
  #3 (permalink)  
Old February 14th, 2012, 03:22 PM
Authorized User
Points: 180, Level: 3
Points: 180, Level: 3 Points: 180, Level: 3 Points: 180, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: Milan, , Italy.
Posts: 39
Thanks: 2
Thanked 2 Times in 2 Posts
Default

Thank you Ir, I'll try.

Luigi
Reply With Quote
Reply


Thread Tools
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
Highlight a row based on cell content needhelptdot Excel VBA 0 September 8th, 2011 12:42 PM
Continous Form, resize based on content (Tricky) hkmulligan Access 2 August 13th, 2007 12:02 PM
How we can replace content of WebPartzone anurag_ur ASP.NET 2.0 Basics 0 June 24th, 2006 10:15 AM
How we can replace content of WebPartzone anurag_ur ASP.NET 2.0 Professional 0 June 24th, 2006 10:13 AM



All times are GMT -4. The time now is 10:32 AM.


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