Showing posts with label directive. Show all posts
Showing posts with label directive. Show all posts

Saturday, March 24, 2012

The directive Page is unknown

I am learning ASP.NET
I downloaded source code fromwww.planet-source-code.com
but when I tried to load Default.aspx got this error:

The directive 'Page' is unknown

Here is the first line form my Default.aspx:

<%@dotnet.itags.org. Page language="c#" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" CodeBehind="Default.aspx.cs" %>

What's wrong with "Page" ?

what did you "load" it into ? the syntax looks right

Thursday, March 22, 2012

the explorer window scroll is not kept although smartnavigation=true

Here is my page directive, but the scroll is not kept in its place afte a post back any idea, pls:
<%@dotnet.itags.org. Page language="c#" Codebehind="sap.aspx.cs" AutoEventWireup="false" Inherits="WebForm1" smartNavigation="true"%>
Thankstry setting MaintainScrollPositionOnPostBack = True
sorry i forgot to mention i am using 2003 net 1.1
Thanks

Tuesday, March 13, 2012

The image cannot be displayed, because it contains errors.

I have a code in photo.aspx.cs as follows to display image in browser (photo.aspx does not have any space or markup, only @dotnet.itags.org. Page directive):

protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "image/bmp";

string employeeID = Request.QueryString["EmployeeID"];
string sqlText = "SELECT Photo FROM Employees WHERE EmployeeID = " + employeeID;
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ToString());
SqlCommand command = new SqlCommand(sqlText, connection);
connection.Open();
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
Response.BinaryWrite((byte[])dr["Photo"]);
}
connection.Close();
Response.Flush();
Response.Close();
}

Now when I access this page as http://localhost:4538/WebSite12/photo.aspx?EmployeeID=1 in firefox, it gives following error. Can someone help me to sort out this problem please?

The image "http://localhost:4538/WebSite12/photo.aspx?EmployeeID=1" cannot be displayed, because it contains errors.

Hi,

How about this one, which is from http://davidhayden.com/blog/dave/archive/2006/07/25/SavingDisplayingPhotosInSQLServerUsingASPNET.aspx

protectedvoid Page_Init(object sender, EventArgs e){if (Request.QueryString["id"]!=null) {int id;if (Int32.TryParse(Request.QueryString["id"],out id)) { Response.Clear(); Response.ContentType="image/jpeg"; Image image= RetrieveImage(id); image.Save(Response.OutputStream, ImageFormat.Jpeg); } }}private Image RetrieveImage(int photoId){ Image image=null;using (SqlConnection connection=new SqlConnection("...")) {using (SqlCommand command= connection.CreateCommand()) { command.CommandText="SELECT Photo FROM Photos
WHERE PhotoId = @.PhotoId"; command.Parameters.AddWithValue("@.PhotoId", photoId); connection.Open();byte[] imageData= (byte[])command.ExecuteScalar(); MemoryStream memStream=new MemoryStream(imageData); image= Image.FromStream(memStream); } }return image;}
 

The MasterPageFile attribute is not supported by the page directive.

While just copying and pasting the standard master page example from the microsoft website: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/masterpages.asp

I'm constantly receiving the following error, what am I doing wrong here?

-------

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The 'MasterPageFile' attribute is not supported by the 'page' directive.

Source Error:

Line 1: <%@dotnet.itags.org. Page MasterPageFile="~/Simple.master" %>
Line 2: <asp:Content
Line 3: ID="Content1"

-------
Thanks!Are you using the .NET 2.0 Framework? It's still in beta and not released to the "masses" just yet, that's why I ask.
well damn :( it's a asp.net v2.0 feature :(
Yea I have a MSDN member ship and have been using 2.0 for a few months now. It is simply wonderful. There are a ton of changes that will make developing pages a lot faster. Productivity is much improved!
I really can't WAIT, just the masterpagefile thingy rocks!