Page 1 of 1

Creating a custom page question

Posted: Wed May 21, 2008 9:19 am
by egormsen
I am trying to create a new page that contains some addtional information that I am collecting about users. I have already modified the My Account sciptlet to contain a link to the new page and also have made a copy of webpage.aspx to use as my starting point. The problem that I am having is that this page needs to pull data from the database and I can not find a way to do that that works they way I need it to. I have tried the following two ways to accomplish this, but the each have problems:

1) Modifying the new page directly (not via scriptlet manager). When I do this I can retrieve/update the data that I need, but the page does not look right because I can not make use of the standard layout (ie. header, footer).

2) Modifying the page via the scriptlet manager. In this case I can get standard headers and footers to display but when I can not figure out how to the make use of the asp code needed to get/retrieve data.

Anyone see anything that I am doing wrong, or know of a better way to accomplish this?

Eldon

Re: Creating a custom page question

Posted: Wed May 21, 2008 2:13 pm
by jmestep
Is the data in original Able table fields, or have you added new fields?

Re: Creating a custom page question

Posted: Wed May 21, 2008 4:43 pm
by egormsen
Both - I have a custom table and also am storing data in the the ac_UserSettings table.

Re: Creating a custom page question

Posted: Wed May 21, 2008 5:49 pm
by AbleMods
If you are trying to pull data from the database using the new page you've created, there will be only two ways to accomplish it:

1. Write .Net programming code and access the data via the data classes. This is done in the code-side of the webpage. You will need a good working knowledge of .Net 2.0 programming and a basic understanding of how Microsoft Data Classes are implemented.

2. Utilize the nVelocity scripting commands. This is done in the HTML-side of the webpage. You will need to be familiar with the various scripting commands available - I am not fluent at all in nVelocity but several of the email templates use it and would be a good starting point to learning what possibilities exist.

Re: Creating a custom page question

Posted: Thu May 22, 2008 8:30 am
by egormsen
I can pull the data already via .Net code. For example I am already displaying this data in the Edit User page of the Admin module (EditUser.aspx). I just added the necessay code the retreive the data via the GetValueByKey() functions and also using the SQLDataAdaptor and DataSet classes to retrieve the data from my new table.

What I can not do if accomplish this same thing in the Store side of AbleCommerce. I can create a page that reads and displays that data just fine, but when I then try to get the Header & Footers that match the rest of the site I can not get it. The closest I have come is to get the page header and footers working with my data displayed (code snipet below), but these leave text on the page such as "[[footer]]" & "[[header]]" that I can not get rid of.

<cb:ScriptletPart ID="WebpagePage" runat="server" Layout="Account" Header="Standard Header" Content="UserPrefs" Title="View Webpage" AllowClose="False" AllowMinimize="false" />

*** My Custom Code *****

<cb:ScriptletPart ID="WebpagePageb" runat="server" Layout="Account" Footer="Standard Footer" AllowClose="False" AllowMinimize="false" />

Re: Creating a custom page question

Posted: Thu May 22, 2008 8:48 am
by AbleMods
I'm not sure I fully understand the issue yet but I think I know the problem.

If you want to execute .Net code on the store side, you have to make two things. First, make a new content scriptlet and assign it to the layout content of the new web page.

Then create a new .Net user control and put your programming functionality in there.

Once the .Net user control is ready, store it in the ~/ConLib/Custom/ folder of your store. Then add a reference to it in the new scriptlet you created. For example, if you created a user control called Foo.ascx and saved it in the custom folder, you would add the line [[ConLib:Custom\Foo]] to your new content scriptlet.

You can opt to include the content section HTML in your user control (my preference), or wrap the [[ConLib]] reference inside straight HTML in the scriptlet itself. If you look at some of the other scriptlets, you'll see Able does it both ways depending on the need. The choice is yours.

The webpage.aspx page file becomes just a place holder for the scriptlets assigned to the page - the actual programming work occurs within the user controls referenced in each scriptlet.

Re: Creating a custom page question

Posted: Thu May 22, 2008 2:06 pm
by egormsen
Thank you very much for you help. I think I understand what I need to do - it seems like the creating the user control is the piece that I was missing.

Wish me luck :wink:

Re: Creating a custom page question

Posted: Thu May 22, 2008 11:39 pm
by AbleMods
/Luck Wished 8)