Custom .aspx page?


https://forum.kartris.com/Topic2899.aspx
Print Topic | Close Window

By djjohnson - Mon 17 Mar 2014
I new here, so this might be a stupid question. Can you add custom .aspx and .ascx pages for custom code? Not just html, but a fully functional call to the database and results to a grid etc?
By Mart - Mon 17 Mar 2014
You can add new pages if you wish to, and have the skills to develop them. Kartris is completely open source so you can view the full code, add new code or modify existing code.

Good practice would be to see how existing pages are coded and build yours in a similar way so you can take advantage of things liking "skinning", include files, etc.
By djjohnson - Tue 22 Apr 2014
Do you have a step by step tutorial on adding a new aspx page with different logic than just product related? I need to implement a new search page that I have data that I need to import into Kartris or new Data Base. I want to set the Kartris Application up like a search engine for a specific industry that I have a complete company list where they will get listed for free and pay a fee for a sponsored link that would included web address, geolocation etc. to the company. I have been programming in asp, asp.net since version 1.1, so I'm pretty proficient on the programming and SQL side. The only part I can really see in the Custom Development deals with products. I would really like to use they same programming style Kartris currently uses, I really like the way it works. I really think if you could do a step by step guide to adding a new aspx page with different logic than just product related it would greatly increase the customization allowed in the open source of Kartris. Any help in this area would be greatly appreciated.
By Paul - Wed 23 Apr 2014
First thing is to copy another page and codebehind, and rename it. Page.aspx would probably be a good one to consider using, as the page doesn't have much on it (other than a custom page user control). Let's say we call the new page, NewPage.aspx.

On the aspx page, you will need to change the name of the class in the 'inherits' value, and the link to the codebehind file, for example this is the code from Page.aspx:
<%@ Page Language="VB" MasterPageFile="~/Skins/Kartris/Template.master" AutoEventWireup="false"
CodeFile="Page.aspx.vb" Inherits="Page" %>

It would be like this on the new page.
<%@ Page Language="VB" MasterPageFile="~/Skins/Kartris/Template.master" AutoEventWireup="false"
CodeFile="NewPage.aspx.vb" Inherits="NewPage" %>

Then within NewPage.aspx.vb, you'd have to change the name of the class, like this:
Partial Class NewPage
Inherits PageBaseClass
End Class

It's important that this page inherits 'PageBaseClass'. Typically new asp.net pages you create from Visual Studio will inherit the default web page class 'System.Web.UI.Page'. However, because all Kartris pages need to share certain things like skinning code, and so on, we have a PageBaseClass which inherits System.Web.UI.Page but adds in various Kartris code too that we need on each front end page. And then front end pages inherit this, including both the standard page functionality from asp.net and our extra Kartris code.

You then have a free page to put your own code within. I would imagine the custom searching is going to be more complicated to implement though - that's really the difficult part here.
By Tiggywiggler - Mon 11 Aug 2014
From the small amount of time I have spent playing with this system it appears that most products based queries uses ProductsBLL.vb. calls to this allow you to access the products database. If you need to add new tables or modify tables I would encourage you to use the existing systems which are based on .xsd files (found in ProjectRoot/App_Code/DAL/).

The majority of forms are really very simple because they are basically containers for the user controls that are used. This way you can use the existing user controls collection or make your own.

Fortunately this is all open source so you can just open up the existing ones and just read how it is being done there. It has taken me about three days of rummaging around to get my head around how the people at Kartris have approached this and it is a really very straightforward system that is well written.

The only warning I would make is that there is next to zero documentation so you need to try and work it out for yourself, but they have used good naming conventions so most of it is obvious.