Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Tuesday, March 13, 2012

Stuck on loading pages into a placeholder

Hi Folks,

Can someone point me to a sample or tutorial or the code to load pages into a placeholder.

I have a menu bar on the left of the page and am trying to load the clicked pages on the right.

Any ideas,

Cheers
NickWelcome to the ASP.NET forums, Nick.

You may be very interested inUser Controls. (They were originally called Pagelets, since they are very much like you described ... littles pages that you embed within your main page.)

That link is one of theQuickStart Tutorials which you might want to look through.

Hope this helps.
Hmm ive had a read over and im still stuck.

do i include the code in a script block or in the codebehind file??
Umm, neither.

Can you show the code for your page, indicating which part you want to separate out as the menu bar, and which page will have the content loaded into it?

If you do so, can you please post it between<code> and</code> tags?
Here it is.


for the link
<TD>
<a id="goHome" runat="server"><img src="http://pics.10026.com/?src=images/myWebHome.jpg"></a>
</TD>
with goHome.HRef defined in the cs file.

<TABLE cellSpacing="10" cellPadding="0" width="100%" border="0">
<asp:placeholder id="PageBody" runat="server"></asp:placeholder>
</TABLE>

I'm trying to get the link to display in the placeholder.
Cheers,
Nick
Why not use frames?
One more question before I can show you an answer.

When you say you are trying to load "pages" into a Placeholder, do you mean anentire webpage inside the table cell? Or do you just want to load differentcontent into the table cell, based on the button the user has clicked?
At the moment it is content contained within an aspx file, so an entire page I guess, what other options are available. I'm a bit of a noob to all this and have to get myself on a steep learning curve. Thanks for all your help and time.
You should really be putting yoursections of content in a User Control (.ascx), Loading them (using Page.LoadControl) when appropriate and then adding them to the PlaceHolder Control. For example:

 void Page_Load ( Object src, EventArgs eArgs ) {

Control page;

switch ( QueryString [ "page" ] ) {

case "Home" : page = LoadControl ( "/controls/home.ascx" );
break;
case "About" : page = LoadControl ( "/controls/about.ascx" );
break;
...
}

PageBody.Controls.Add ( page );
}


I assume this goes into a <script> block in the actual page. Now how do I pass the param to the switch?
Either in a <script> declaration block or CodeBehind.

The requesting URL would look like:

 http://www.domain.com/default.aspx?page=Home

stuck with the guided tutorial

Hi all,

i am new to asp.net and just starting out with WebMatrix
guided tour tutorial from ASP.NET. I managed to create the
myfirstpage.aspx (Label, text, calendar, button) and ran
it with webmatrix server smoothly.

However when I tried to create and use the IIS Virtual
Root (under Start Web Application), the browser only
showed the Label part. It also showed an exclamation mark
(error sign). I even copied the myfirstpage.aspx file to
the default web folder (\Inetpub\wwwroot) but to no avail.

What did I do wrong?

I did install everything, right:
IIS
the .NEt framework
webmatrix
sql2kdesksp3.exe
and mdac 2.7

The system runs on Windows 2000 Pro SP4 and it has its own
static IP.

I tried the iis ftp and web using regular html and it
works fine... but not the myfirstpage.aspx.

HElppppp.This could be becuase asp.net is not registered in the iis. try the following:

cd %windir%\microsoft.net\framework\v1.0.3705
aspnet_regiis -i

HTH

-aka
Alleluia... Thank you, it works. Thanks a bunch.

mitoshie