Showing posts with label loading. Show all posts
Showing posts with label loading. Show all posts

Monday, March 26, 2012

trouble dynamically loading content to my website

I am trying to dynamically load other pages into one main page on my website kinda of like a "wapper page." I was told to use PlaceHolders to do so but can't get the code to work. The link I am following is http://www.ftponline.com/vsm/2002_10/online/hottips/gusmano/ . I did everything according to the article but I get an error.
My code looks like this:
default.aspx:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
string page = Request.QueryString.Get("page");
PlaceHolder1.Controls.Clear();
if (page == null)
PlaceHolder1.Controls.Add(LoadControl("default" + ".ascx"));
else
{
PlaceHolder1.Controls.Add(LoadControl(page + ".ascx"));
}
}
</script>
<html>
<head></head>
<body>
.....
</body>
</html
and the default.ascx is just a regular html page including a flash document:

<html>
<head>
<title>Main</title>
</head>
<body>
<center>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
width="640" height="480" id="main" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="http://pics.10026.com/?src=main.swf" quality="high" bgcolor="#000000" width="640" height="480"
swLiveConnect="true" NAME="main.swf" name="main" align="middle"
allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</center>
</body>
</html
The error I get is :
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'PlaceHolder1' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 6: {
Line 7: string p = Request.QueryString.Get("page");
Line 8: PlaceHolder1.Controls.Clear();
Line 9: if (page == null)
Line 10: PlaceHolder1.Controls.Add(LoadControl("default" + ".ascx"));

Source File: F:\WWW\default.aspx Line: 8

What am I doing wrong? Also where do I add code into my default.aspx page to tell it where to load the other pages. As far as I can see, it just knows the load the a page but I can't figure out how it knows where to load it. I really appreciate all your help. Thanks a lot.What this is saying is that your placeholder1 does not exsist. Check your code to ensure you are using the corredt spelling for placeholder 1.
check out this maybe this can help

http://dotnet247.com/247reference/msgs/51/256296.aspx
I copied and pasted my code from my file. I really have no idea why it is saying that it doesnt exist. Do I have to import a library??

Trouble Loading Code Behind Type

Hello,

I'm a new VS.NET user having the following issue.

I've created a new ASP.NET WEb Forms app and have been doing some basic
things with no real problems.

I have decided that the next thing in the development will be a secured area
of the app.

I have determined the Forms Authentication is the way I am going.

I have created a basic login form and modified the Web.config file in my
app's main virtual directory (where all of my files have hitherto resided).
I got this all working, no problem. When a page was requested, the user was
redirected to the login form as expected and when authenticated the
originally requested page was properly display.

Here is where the problem comes up. The site will be a mix of public and
"auth-required" pages. So this basically means that I do not want the
"main" virtual directory of the app secured.

Here is what I did.

First, I disabled the authentication requirement on the main virtual
directory.

Then I created a new virtual directory (under the main app's virtual
directory) and called it "Secure".

I moved the Login.aspx (my custom login form) into the Secure virutal
directory and created an additional blank page in there as well.

I put a new copy of Web.config in the Secure virtual directory and
configured it up for Forms based authentication.

Here is what I expect to happen.

When a page in the app's main virtual directory is requested it loads
for anyone (this works fine).

When a page is initially requested in the Secure virtual directory the
user should be redirected to the Login form (the redirection occurs as
expected)

Here is the problem: The Login.aspx page pops a run time error
complaining that the code behind type cannot be loaded.
Parser Error Message: Could not load type 'RPG.Login'.
The application is named "RPG"
Here is the @dotnet.itags.org.Page
<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="Login.aspx.vb" Inherits="RPG.Login"%
Note: This was not erroring out when page in question was in the app's main
virtual directory. It only occurs for pages (I have tested a "Hello World"
page in the same virtual directory with the same error.

This seems to be some sort of pathing issue, but with the .aspx file and the
.aspx.vb file in the same folder, I don't get the problem. I've tried
changing the reference in the "Inherits" attribute to things like
RPG.Secure.Login but I'm too new to the environment to understand the
Namespace.Class reference and how it is effected by the location of the
files in question.

TIADo you have a file called "RPG.dll" in the /bin folder in the web application root?
Yes. RPG/bin/RPG.dll exists.

Saturday, March 24, 2012

Trouble with a page loading when xcopying from localhost to server!

My main webform will not load. I xcopied the entire directory from my computer to the server. One page works, but the main page doesn't load controls or anything, just a white blank page. I put response.writes in the page_load and init functions and they appear when it loads but nothing else! Any ideas? There is a form tag.Sounds like you might not have a "form" tag.
Can you post the html markup?

There is a form tag in the html, but here it is:

Date of Request:Ext.:IS Request #:Originator:Dept Manager:Upload Bulletins



Please select a brandPlease select bulletins to upload for emailing. Note: Uploaded files must be MS Word files. Select Product Bulletin Type

there is a form tag... here is code
It worked locally not on development server..
. Date of Request:Ext.:IS Request #:Originator:Dept Manager:Upload Bulletins



Please select a brandPlease select bulletins to upload for emailing. Note: Uploaded files must be MS Word files. Select Product Bulletin Type

I'm sorry, I meant to post you aspx code for the page. Sorry, I didn't notice that you said you had a <form tag.
You say that another page is working. does it have any server controls on it?
Hey Jim,
Sorry about the double post, I'm new to this forum.. I believe its a sql connection problem. OR not? Here is the code for the connection:

'This will access a SQL database and retreive users name, ext, dept, ID.

Dim cnAsNew SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProductBulletins;Data Source=SERVER") <-generic server

Dim cmdAs SqlCommand
Dim dr As SqlDataReader
Try
cn.Open()
cmd = New SqlCommand("usp_SELECTBYUSERNAME", cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@.username", user)
dr = cmd.ExecuteReader(CommandBehavior.SingleRow)
dr.Read()
lblOriginator.Text = dr.Item("FirstName") + " " + dr.Item("LastName")
lblExt.Text = dr.Item("Extension")
lblDeptManager.Text = dr.Item("Department")
userID = dr.Item("ID")
Catch ex As Exception
Response.Redirect("ErrorSuccess.aspx?Err=1" + Context.Server.GetLastError.Message)
Finally
dr.Close()
cn.Close()
EndTry
EndSub