Showing posts with label pages. Show all posts
Showing posts with label pages. Show all posts

Saturday, March 24, 2012

Strnge characters causing compilation error

hi,

i am hoping that someone may be able to help me... i have been writing
vb.net pages using visual web developer. they all work fine locally
however when i upload to the server i get the following error:

Compiler Error Message: BC30037: Character is not valid.

it looks as if some strange characters have been added to the end of
every line of code causing the script to error. see the page here:
http://www.albamclothing.com/register.aspx
doe anyone know what may cause this? or even better how to get rid of
them?

many thanksIt may be the strange return character that word puts in, Ive only seen this
when moving from a windows environment to a unix environment before, but if
there is some sort of FTP going on when youre uploading I'd suggest putting
the FTP client in BINARY mode before uploading...

Regards

Rod
<tom_burrow@.umbro.co.ukwrote in message
news:1158137142.668189.67720@.e63g2000cwd.googlegro ups.com...

Quote:

Originally Posted by

hi,
>
i am hoping that someone may be able to help me... i have been writing
vb.net pages using visual web developer. they all work fine locally
however when i upload to the server i get the following error:
>
Compiler Error Message: BC30037: Character is not valid.
>
it looks as if some strange characters have been added to the end of
every line of code causing the script to error. see the page here:
http://www.albamclothing.com/register.aspx
>
doe anyone know what may cause this? or even better how to get rid of
them?
>
many thanks
>

Thursday, March 22, 2012

Strongly typed datasets and XML

I am having trouble understanding strongly typed datasets and XML files. I
have the following schema:

<xs:schema id="Pages" targetNamespace="http://asdf.org/EOBEPages.xsd"
elementFormDefault="qualified"
xmlns="http://asdf.org" xmlns:mstns="http://asdf.org/EOBEPages.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="EOBEPages">
<xs:complexType>
<xs:sequence>
<xs:element name="Page">
<xs:complexType>
<xs:sequence>
<xs:element name="PageTitle" type="xs:string" />
<xs:element name="PageText" type="xs:string" />
<xs:element name="PageNumber" type="xs:integer" />
<xs:element name="NumImages" type="xs:integer" />
<xs:element name="ImagesDescription" type="xs:string" minOccurs="0"
maxOccurs="1" />
<xs:element name="ImageDefinitions">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema
I load the xml data into the dataset no problem, and can access the "page"
info by:

myDataset.Page(index).pageTitle

, etc, but can NOT access the "ImageDefinitions", because I guess I don't
understand how. What I wanted to do is something like:

myVar = myDataset.Page(index).ImageDefinitions(index2).Des cription

but this is not part of the dataset... why? How can I get access to the
image definition descriptions based on the page index?

Thanks a bunch!

MC Ddatasets are tables with relationships. every xml complex type becomes a new
table. ImageDefinitions becomes a table which you can access.

myVar = myDataset.ImageDefinitions(index).Description

if you have a relionship setup you can access ImageDefinitions rows from
Page rows using GetChildRows

-- bruce (sqlwork.com)

"Big D" <a@.a.com> wrote in message
news:uam6WMY9DHA.1632@.TK2MSFTNGP12.phx.gbl...
> I am having trouble understanding strongly typed datasets and XML files.
I
> have the following schema:
> <xs:schema id="Pages" targetNamespace="http://asdf.org/EOBEPages.xsd"
> elementFormDefault="qualified"
> xmlns="http://asdf.org" xmlns:mstns="http://asdf.org/EOBEPages.xsd"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="EOBEPages">
> <xs:complexType>
> <xs:sequence
> <xs:element name="Page">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="PageTitle" type="xs:string" />
> <xs:element name="PageText" type="xs:string" />
> <xs:element name="PageNumber" type="xs:integer" />
> <xs:element name="NumImages" type="xs:integer" />
> <xs:element name="ImagesDescription" type="xs:string" minOccurs="0"
> maxOccurs="1" /
> <xs:element name="ImageDefinitions">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Description" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> I load the xml data into the dataset no problem, and can access the "page"
> info by:
> myDataset.Page(index).pageTitle
> , etc, but can NOT access the "ImageDefinitions", because I guess I don't
> understand how. What I wanted to do is something like:
> myVar = myDataset.Page(index).ImageDefinitions(index2).Des cription
> but this is not part of the dataset... why? How can I get access to the
> image definition descriptions based on the page index?
> Thanks a bunch!
> MC D

structure

what is the best way of sharing a structure among different pages of my
asp.net application?Hi,

Try putting the Structure in a separate file to your web pages and making it
'public static' (or 'Public Shared' in VB.NET).

James

"Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
news:%23LYbPYrUEHA.4048@.TK2MSFTNGP12.phx.gbl...
> what is the best way of sharing a structure among different pages of my
> asp.net application?

structure

what is the best way of sharing a structure among different pages of my
asp.net application?Muhammad,
I assume you mean the Visual style of the pages?
There are a few ways this can be done, I personally use
WilsonMasterPages: -
http://authors.aspalliance.com/Paul...Articles/?id=14
Hth,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
Hi,
Try putting the Structure in a separate file to your web pages and making it
'public static' (or 'Public Shared' in VB.NET).
James
"Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
news:%23LYbPYrUEHA.4048@.TK2MSFTNGP12.phx.gbl...
> what is the best way of sharing a structure among different pages of my
> asp.net application?
>
sorry didn't make myself clear, I want to use a data structure and assign
values to its members on different pages and offcourse want to retain all
values assigned on different pages.
"Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote i
n
message news:camdst$oni@.odak26.prod.google.com...
> Muhammad,
> I assume you mean the Visual style of the pages?
> There are a few ways this can be done, I personally use
> WilsonMasterPages: -
> http://authors.aspalliance.com/Paul...Articles/?id=14
> Hth,
> Phil Winstanley
> Microsoft ASP.NET MVP
> http://www.myservicescentral.com
>
Muhammad,
You could store this structure in the Application object, and update it
there. Although you may have threading issues, so use locking when
accessing it.
James
"Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
news:eFIQYgrUEHA.2388@.TK2MSFTNGP09.phx.gbl...
> sorry didn't make myself clear, I want to use a data structure and assign
> values to its members on different pages and offcourse want to retain all
> values assigned on different pages.
> "Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote
in
> message news:camdst$oni@.odak26.prod.google.com...
>
Is it possible to definte a user defined stucture as application variable.
just of the sake of example
public struct student
{
int id;
string name;
float age;
string address1;
string address2;
}
How can I create an object of student type as an application variable?
"James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
news:e4qMukrUEHA.2520@.TK2MSFTNGP10.phx.gbl...
> Muhammad,
> You could store this structure in the Application object, and update it
> there. Although you may have threading issues, so use locking when
> accessing it.
> James
> "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> news:eFIQYgrUEHA.2388@.TK2MSFTNGP09.phx.gbl...
assign
all
in
>
Define the struct as you have in a file within your project. In the
Application_Start event handler in the Global.asax file of your project,
enter the following code:
VB:
Dim oStudent As SomeNamespace.student
' Initialise
oStudent.ID = 0
oStudent.Age = 15
..
' Add the student to the application object
Application("Student") = oStudent
C#:
SomeNamespace.student oStudent;
// Initialise
oStudent.ID = 0;
oStudent.Age = 15;
..
// Add the student to the application object
Application["Student"] = oStudent;
The student struct will then be available to each page. To access it, use
the following code:
VB:
CType(Application("Student"), SomeNamespace.student) ...
C#:
(SomeNamespace.student)Application["Student"] ...
Hope this helps,
James
"Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
news:uTCmXtrUEHA.2972@.TK2MSFTNGP12.phx.gbl...
> Is it possible to definte a user defined stucture as application variable.
> just of the sake of example
> public struct student
> {
> int id;
> string name;
> float age;
> string address1;
> string address2;
> }
> How can I create an object of student type as an application variable?
> "James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
> news:e4qMukrUEHA.2520@.TK2MSFTNGP10.phx.gbl...
> assign
> all
> in
>
Excellent! that make 100% sense, will give it a go now thank you for help.
"James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
news:u2jIuzrUEHA.1036@.TK2MSFTNGP12.phx.gbl...
> Define the struct as you have in a file within your project. In the
> Application_Start event handler in the Global.asax file of your project,
> enter the following code:
> VB:
> Dim oStudent As SomeNamespace.student
> ' Initialise
> oStudent.ID = 0
> oStudent.Age = 15
> ...
> ' Add the student to the application object
> Application("Student") = oStudent
> C#:
> SomeNamespace.student oStudent;
> // Initialise
> oStudent.ID = 0;
> oStudent.Age = 15;
> ...
> // Add the student to the application object
> Application["Student"] = oStudent;
> The student struct will then be available to each page. To access it, use
> the following code:
> VB:
> CType(Application("Student"), SomeNamespace.student) ...
> C#:
> (SomeNamespace.student)Application["Student"] ...
> Hope this helps,
> James
> "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> news:uTCmXtrUEHA.2972@.TK2MSFTNGP12.phx.gbl...
variable.
it
retain
wrote
>
Muhammad,
James' sample is great, you might also want to take a look at an
article I put together a while ago on the subject: -
http://aspalliance.com/431
Hth,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
that is extremely helpful. thank you phil.
"Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote i
n
message news:camn5j$65l@.odak26.prod.google.com...
> Muhammad,
> James' sample is great, you might also want to take a look at an
> article I put together a while ago on the subject: -
> http://aspalliance.com/431
> Hth,
> Phil Winstanley
> Microsoft ASP.NET MVP
> http://www.myservicescentral.com
>

Structuring web pages

Hi,

New to ASP.NET. I am in search of resources that show best-practice for structuring web pages. What I mean by this, is how all pages get the same header, footer etc...Are there best practice patterns for this?

Thanks.

MB.No problem here - - it all depends on what you want (code-wise) in your header/footer files...

If nothing is coded specific to (let's say) Classic ASP, then, you can just create include files and use them, just as you did in Classic ASP - -

if you want more robust functionality, that ASP.Net is good at - - then, you might want to look into creating a User Control for each, placing them wherever you'd like on the page.

here's a start for you , concerning UserControls:
http://aspnet101.com/aspnet/headfoot.aspx?code=/aspnet/headfoot.aspx - keep in mind, this is a VERY simple sample, just to give you a look at how it's done...
Thanks David.
David,

Having looked at the link, it is very simple and not very helpful. I am striving for a complex page structure. I want a header, a left panel, possibly a right panel, a footer and the main content in the middle of all this. Plus, I dont want to duplicate any code. As far as I can tell, I would need to create this structure and copy it into all the ASPX files, and simply embed user-controls for the actual HTML. But this doesnt seem very sophisticated. Surely there is a way of removing the duplication, yet retaining the ability to have complex structures defined in one place?

MB.

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