C# - Url Routing From Hierarchical Tree Of Pages Stored In A Database?

Mar 2, 2010

I have a bunch of html pages stored in a mssql database. Each row has:

ID
PageTitle
Page Html Content
ParentId

ParentId is there so i can create a hierarchical tree of pages.

Currently i am using this line of code in order to access the pages...

routes.MapPageRoute("front", "{PageTitle}", "~/front.aspx");

Which then causes a redirect to front.aspx so i can then use:

Page.RouteData.Values["PageTitle"].ToString()

In order to grab what i need so i can display the appropriate page in the browser.

However, can anyone suggest how i would amend 'routes.MapPageRoute' so it supports an infinate hierarchical tree like i have in my database. Essentially i want to be able to type a url like: http://localhost/PageOne/SubPageOfPageOne etc

View 1 Replies


Similar Messages:

MVC :: Generate Hierarchical Menu From Database?

Mar 2, 2011

Site.Master file contains

<ul id="nav">
<% Html.RenderAction("Menu", "ShoppingCart"); %>
</ul>
[ChildActionOnly]
public ActionResult Menu()
{
// for to geenrate menu ?
return ????
}

How to generate hierarchical menu below in Menu method from database data ? Should I use stringbuilder or is there better way ?

Resulting html shoudl look like:

[Code]....

View 64 Replies

MVC :: Routing Displaying Different Pages With The Same Url With Optional Parameter?

May 27, 2010

I would like to have two different welcome pages for a site.How could I handle this? I've looked at routing but I'm not sure if global.asax.cs is the correct place to place this into.

www.mycompany.com should display generic information. Displaying view Home/Default.aspx
www.mycompany.com?id=1 should display welcome customer x. Displaying view Home/Welcome.aspx

View 2 Replies

Web Forms :: How To Use Same Number Of Parameters For Two Pages In URL Routing

May 7, 2015

I have some routes defined in global.asax according to which the page is redirected.

 Global.asax
void Application_Start(object sender, EventArgs e) {
RegisterRoute(System.Web.Routing.RouteTable.Routes);
} void RegisterRoute(RouteCollection routes) {
routes.MapPageRoute("MainCategory", "{state}/{mcat}", "~/MainCategory.aspx");
routes.MapPageRoute("carriers", "{state}/{mcat}/{dcat}", "~/carriers.aspx");
routes.MapPageRoute("carrierdevices", "{state}/{mcat}/{dcat}/{carrier}", "~/carrieritems.aspx");
routes.MapPageRoute("cellphone", "{state}/{mcat}/{dcat}/{carrier}/{device}/{id}", "~/Catalog.aspx");
//New Rout with same parameters
routes.MapPageRoute("iphones", "{state}/{mcat}/{dcat}", "~/iphones.aspx");
}

i mean to say how to decide the destination page depending on URL Eg:1.routes.MapPageRoute("carriers", "{state}/{mcat}/{dcat}", "~/carriers.aspx"); 2.routes.MapPageRoute("iphones", "{state}/{mcat}/{dcat}", "~/iphones.aspx");

if value in URL second parameter i.e mcat=cellphone then it must redirect to carriers.aspx. and if mcat=iphone then it must redirect to iphones.aspx page.

Problem:currently if in URL there are 3 parameters then it always goes to carriers.aspx as it searches in route table for 3 parameters it redirects to carriers.aspx which need to be conditionally redirected depending on mcat valuehow to do?

View 1 Replies

HttpHandlers / Modules :: Routing Classic ASP Pages To New 4.0 Site

Sep 24, 2010

We have recently migrated one of our legacy websites (classic ASP) to ASP.Net 4.0. I have already created a RegisterRoutes() in Global.asax (as per [URL]). I am concerned about SEO rankings and link breakages with external sites linking to old site.

Ideally, I will like to: Load all the routes from an XML file within RegisterRoutes() --> As there are 100's of pages with no naming convention followed. We have already created mappings within an excel spread sheet which can easily be exported to XML.Action Permanent redirects from within RegisterRoutes() --> to avoid having landing page(s) performing Redirects like Response.RedirectPermanent() and Response.RedirectToRoutePermanent. Has anyone run into a similar situation? Is there a better way of handling this situation?

View 1 Replies

Prevent Normal Request To .ASPX Pages When Implementing URL Routing

Nov 18, 2010

I am using URL Routing in my .Net Web Application. I would like to prevent users from being able to access the .aspx page.

Example:

Actual URL - [URL]

Routed URL - [URL]

I want users to be able to access the page only by going to /Testimonials, but I would like to setup /Testimonials.aspx to redirect to its route at /Testimonials.

Is there an easy way to do this for Routed Pages throughout the application?

View 1 Replies

Web Forms :: Display Image Which Is Stored In Some Folder And Its Path Is Stored In Database Table?

Feb 13, 2013

i want to display image which is stored in some folder and its path is stored in database table. i used your link [URL] for the same but i am not storing any thing like data column in my table and have passed name column to Byte[]and so its giving datatype error there. what is the way to convert it to byte?

View 1 Replies

Web Forms :: Display Image Which Is Stored In Some Folder And Its Path Is Stored In Database Table

Dec 27, 2011

i want to display image which is stored in some folder and its path is stored in database table. i used your link URL... for the same but i am not storing any thing like data column in my table and have passed name column to Byte[]and so its giving datatype error there.

View 1 Replies

Create Database Tree View Using Jquery?

Sep 19, 2010

how to create database tree view using jquery

View 2 Replies

Web Forms :: Building Quad /Binary Tree From DataBase?

May 18, 2010

I just want to build a quad/Binaray tree in my Webform the data is collected from the DB how it is possible.

Now i am bulding a sample application that deals the all activites of chain marketting(network ) marketing system here i have to build tree from the data base to webform for displaying the bussiness growth of a customer.

SRS:Each customer can add 4 child under his name .My Table format is follow

Table Name:tbl_bussinessData

perentID:-store perant id

leftMiddle:store the iD of first child

left:=store the ID of Second

rightMiddle:=store the id of Third Child

right:=store the id of fourh child

from this structure of Database how i can build a tree upto 10 level or give some advice in DB desin or show some Example

NB:Not drawing or implimenting Binary DATA STRUCTURE

View 1 Replies

Web Forms :: Can Construct A Tree View From XML Retrieved From Database

Jul 20, 2010

I want to create a Tree View using XML that is fetched from SQL Server. How I can directly assigned to tree view, the below code I tried, but throwing error 'dsXML' is not an IHierarchicalDataSource. The XML heirarchy is proper. When I use XmlDataSource with the xml file, tree view is shown.

<asp:SqlDataSource runat="server" ID="dsXML" ProviderName="System.Data.SqlClient"
ConnectionString="Data Source=Server;Initial Catalog=database1;Persist Security Info=True;User ID=userid;Password=password"
SelectCommandType="StoredProcedure" SelectCommand="spGetXML">

[code]....

View 1 Replies

VS 2008 - Deleting Nodes From Tree View Generated From Database

Jan 25, 2012

I have been trying to delete nodes from a tree view that is being generated from a database. I have the code written and it works, but only on the root Nodes. It will not delete Parents/Childs/Leaf, it will if I delete the root, but I also want to be able to delete parent nodes and such.

Right now i have this code so far

Dim tn As TreeNode = treeView.SelectedNode
treeView.Nodes.Remove(tn)

I know that I can just use treeView.Nodes.Remove(treeView.SelectedNode) but was doing some error checking to see if I could firgue out what was going on. I am using VB6, I am not so worried about the database deleting at the moment. I would prefer not to use the Clear() method as this will remove all the nodes I only want to remove certain ones and keep the rest.

View 11 Replies

Web Forms :: Create Family Tree By Storing Relationships From Database

Jul 23, 2013

I'm new in asp.net .... I want a tree view to the family member that stored on database.SQL server 

I have 2 table

one for username password

and the second one for family member

contain member name and relation like wife , mother ..

how i can do that

2 table enough or I need more table?

View 1 Replies

Forms Data Controls :: Tree View Binding To Tables In Database?

Feb 16, 2011

I have three tables

tbl_Cus CatID (Int) CustID(int) CabID(int)
tbl_Cat CatID(int) CatName(varchar) CusID
tbl_Cab CatId(int) CabID(int) CabName(varchar)

I am using Tree View control for the first time.

The above tables I want to bind it to a tree view control the tree view should look some thing like this.

Cus Name1
Cat Name1
CabName1
CabName2
CatName2
CabName1
CabName2
Cus Name2
Cat Name3
CabName1
CabName2
CatName4
CabName1
CabName2

View 2 Replies

Forms Data Controls :: Tree View Set Slected Index / Auto Selected Index Change To Tree Node?

Jan 25, 2011

I have two control page in my aspx page. first one left side "tree view",second one right side " form design".Form design will change based on tree view selected index changed.i have 4 level child node(site, master , slave, space). I have seperate forms to each level of node.

cannot update tree node when update the forms. so i reload tree view.

now i need how to auto selected index change to tree node.

ex.

1 parent node

1.1 child node

1.2 child node

i have update "1.2 child node" rename to "1.3 child node"

and reload treeview so it will chage...

how set tree node.selected index = 1.3 child node....

View 3 Replies

Web Forms :: Url Routing 4.0 From Xml File Or Database

Sep 18, 2010

how i would set up the routes table from a databse i.e can you do something like this i no i should load from a text file created from the save button of my cms page section but dont no how to do that.

rc.MapPageRoute (
"page",
"page/{Type}",
"~/cms.aspx");
// is their some way to load this into the global asx from a text file if so how?
"page/{Type}",
//URL with parameter
"~/cms.aspx");
//Web Form to handle

View 1 Replies

Url Rewriting / Routing - Categories In Database

Oct 8, 2010

I have my categories in database, and want something url rewriting/routing to make my url nicer and more SEO friendly. I have divided my categories into the following:

Cars > Select car > Car model >

how do I create url rewriting / routing in my categories? I use framework 4.0

View 1 Replies

Routing - Load Routes From Database?

Mar 12, 2010

Is it possible to load routes from the database with ASP.NET ?

For each r as SomeRouteObject in RouteDataTable
routes.MapRoute( _
r.Name, _
r.RouteUri, _
r.RouteValues, _ //??
r.Constraints _ //??
)
Next

How should I store the routevalues / constraints? I understand that there are several 'default' routevalues like .Controller and .Action, however I also need entirely custom ones like .Id or .Page...

View 1 Replies

C# - Work Continuously On Other Pages While Executing Stored Proc?

Jul 28, 2010

I have a stored procedure that I need to execute from asp.net button , It takes more than 30 mins to execute. So here I need to show a message like "In Process" while execution and disable couple of links..Once the execution is done I need to show "Last processed data and time" and enable the disabled links. So in "In Process" stage we have to allow user to access other pages in the site. How it is possible?

View 2 Replies

Web Forms :: Web.Routing Doesn't Work On Server On IIS Routing

Jul 20, 2010

I tried everything I could find, but still does not work on IIS routing.

View 2 Replies

Web Configure Can Work With Oracle 9i Database / Database Stored Procedures

Jun 20, 2010

We are building an ASP.NET application with C#.net language and Oracle 9i database. Here we installed Oracle 9i client software on our PCs.We never worked on Oracle 9i database. It's the first time.We are planning to build stored procedures in Oracle database and call them from our ASP.NET application. Does working with Oracle stored procedures and ASP.NET is similar to that of working with MS SQL Server stored procedures and ASP.NET?

View 1 Replies

C# - Outputting Data With An Access Database But Users Stored In An SQL Database?

Dec 3, 2010

I'm creating an ecommerce site using asp.net and a Access Datasource, I have used the pre-defined logging in and registering controls provided by Visual Studio 2010 which stores the user data in a SQL server.

For my site the content of the shopping cart is uploaded to a table in the access database, I need to however save the contents of the cart to a specific user ID. For example if User number 1 orders book id's 4,7,2 this needs to be saved, but if user number 2 comes along and orders 4,1,7 this needs to be saved for them as well.

So a user can have many carts, this is sorted in access but with the user ID being saved to a different database is there anyway I can link the two databases so I can say

"Save bookid's 1,2,3 in tblcart where userID is the same as the logged in user"

View 1 Replies

Retrieve Image From Database Using The Filepath Stored In Database?

Apr 16, 2010

i have created a table in sql server 2005 with two fields ImgId and ImageURL,where ImgId holds the serial number and Image URL holds the URL of the image file about where it is located in my hard disk.

Now i want to retrieve images from the database using its filepath.

I think i had done everything right,I tried to retrieve images in a gridview but dont know why it doesnt shows anything when i build the code.

View 6 Replies

Routing With Web Forms - Could Not Load System.Web.Routing

Dec 12, 2010

I am using:

ASP.NET 3.5 SP1 with Web Forms Routing thru Global.asax (System.Web.Routing and RegisterRoutes)IIS 7

Everything is working fine in my local machine, but it gives the following error in my hosting environment:

Could not load file or assembly 'System.Web.Routing, Version=3.5.0.0, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I did everything inside my web.config file mentioned in the following link:

[URL]

But I am still getting the above error.

What else am I supposed to do fix the error?

View 1 Replies

Rest WCF Url Routing & Web Forms Routing?

Feb 22, 2011

I have a Web application where i have added a reference to a RESTful WCF. I got the WCF url Routing to work in my webapplication by adding Inherits="RestService.Global" to the Web applications Global.asax.

<%@ Application Codebehind="Global.asax.cs" Inherits="RestService.Global" Language="C#" %>

But then i tried to create url Routing for the Web application and it does not work with the Inherits="RestService.Global" in the Global.asax. If i take it away it works fine. Is there a correct way to do this.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved