WebMatrix :: How To Change The Default Page Base Class

Aug 16, 2010

I've tried setting the <pages pageBaseType="DynamicWebPage" /> value in web.config, but when I response.write out the page type, I'm still getting Microsoft.WebPages.WebPage.

I'm simply trying to sub-class WebPage and add some additional functionality such as a dynamic PageData dictionary similar to Phil Haack's dynamic ViewData dictionary.

View 3 Replies


Similar Messages:

WebMatrix :: How To Change Default Login Page

Aug 16, 2010

Created a site using the StarterSite template in WebMatrix and am trying to change the default login page url from Account/Login.cshtml to /Signin.cshtml. I've tried setting the loginUrl under the authentication section in web.config to no avail

View 5 Replies

Mvc - Can Set A Custom Class As The Default Base Class For Controllers In MVC3

Feb 15, 2011

I'd like to inherit all my controllers from a custom base class that I write myself. I can change the line every time I add a new controller, but it would be nicer if I could somewhere specify the default value that gets set there. That way I wouldn't need to worry about forgetting this, and other people who get added to the project later on would have an easier time.

View 3 Replies

WebMatrix :: Why Is "default.cshtml" Automatically Recognized As Default Page In IIS Express Server

Feb 4, 2011

When i created a simple site via Matrix which adopts Razor technology by default, i found site automatically display "default.cshtml" if started through "http://localhost:xxxx/bread/" ; however i hadn't set "default.cshtml" as "default document" for this site, even i seek in the "applicationhost.config" i just find

<defaultDocument enabled="true">
<files>
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>

which apparently hasn't "...cshtml" yet. So I am wondering now why in this case the web server actively sets "default.cshtml" as default start page ?

View 5 Replies

Call Always Base Class Method Like Base.OnInit()?

Jun 29, 2010

I am new in asp .net.I am not able to undestand why we call base class method when we
override methods/events.Like automatically visual studio will put base.OnInit() if you are overriding OnInit.

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}

same is the case of Finalize. In derived we call base.Finalize() Is there any need of calling these base class methods ?

View 2 Replies

Page With Base Class With Dynamic Master Page Not Firing Events

May 3, 2010

I am feeling that I have terribly wrong somewhere. I was working on a small asp.net app. I have some dynamic themes in the heme folder and have implemented a page base class to load the master page on the fly. The master is having the ContentPlaceHolder like: <asp:ContentPlaceHolder ID="cphBody" runat="server" />

Now I am adding pages that are derived from my base class and added the form elements. I know, Visual Studio has problem showing the page in the design mode. I have a dropdown box and wish to add the event of onselectedindexchange. But it is not working. the page is like this:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="trigon.web.Pages.MIS.JobStatus" Title="Job Status" AspCompat="true" CodeBehind="JobStatus.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphBody" runat="Server">
<div id="divError" runat="server" />
<asp:DropDownList runat="server" id="jobType" onselectedindexchange="On_jobTypeSelection_Change"></asp:DropDownList>
</asp:Content>

I have also tried adding the event on the code behind like:

protected void Page_Load(object sender, EventArgs e)
{
jobType.SelectedIndexChanged += new System.EventHandler(this.On_jobTypeSelection_Change);
if (!IsPostBack)
{
JobStatus_DA da = new JobStatus_DA();
jobType.DataSource = da.getJobTypes();
jobType.DataBind();
}
}

protected void On_jobTypeSelection_Change(Object sender, EventArgs e)
{
//do something here
}

View 1 Replies

C# - How To Execute Page_Load() In Page's Base Class

Apr 29, 2010

I have the following PerformanceFactsheet.aspx.cs page class

public partial class PerformanceFactsheet : FactsheetBase
protected void Page_Load(object sender, EventArgs e)
// do stuff with the data extracted in FactsheetBase
divPerformance.Controls.Add(this.Data);
where FactsheetBase is defined as
public class FactsheetBase : System.Web.UI.Page
[code]...

View 3 Replies

Put The Database Connection Settings Into A Base Page Class?

Mar 16, 2010

it's possible to put the database connection settings into a base page class so that I can auto-init them on a page. like this document: [URL] but with instructions in VB.net

View 1 Replies

Web Forms :: Access Maser Page In Base Class?

Mar 9, 2010

I have a class BasePage this class inhereted from System.Web.UI.Page, all my other pages inhereted from BasePage.

How i can access Master page in BasePage ? To access master page at any page i use :

Template masterPage = Master as Template; where Template class of my Master page.

View 1 Replies

Web Forms :: Base Class Page Load Not Called?

Jun 24, 2010

I have the below structure. Admin_note --> AdminBasePage --> System.Web.UI.Page.But Page_Load does not call in AdminBasePage when calling page_load in Admin_note class.Do you know how to solve??

//// One file///
namespace UI.Admin
{

[code]...

View 6 Replies

Web Forms :: Access Base Class Functions From Master Page?

May 14, 2010

I have a base class called BasePage, and a master page called SiteMaster. All my content pages inherit BasePage using BasePage instead of System.Web.UI.Page. Now, I need to access some functions in BasePage from my master page SiteMaster, let's say, the function is called "DisplayClientName()". How can I do it? Searched the Web, have found tons of similar questions but not solid solutions.

View 2 Replies

Search Pages And User Controls To See Which Master Page And Base Class They Use

Feb 12, 2010

I want to search my asp.net pages and user controls to see which master page and base class they use. I mention search because we are re-factoring a large project and we need to track progress on the code conversion. I know I can pull this information individually but I need a automated and repeatable procedure.

View 1 Replies

WebMatrix :: How To Add WebMatrix Default Parameters

Aug 10, 2010

That subject may not do this questions justice.

I am trying to limit what I write on all my .cshtml pages. For example, on everypage I am @using myDLL and "connecting" to sql server.

I write that out like

@using System.myDLL;
@{
myDLL dll = new myDLL();
dll.ConnectionString = "blablabla";
}

How can I remove the need to do that to every single page? I think I can create a web.config and do some funky stuff... can someone show examples?

View 13 Replies

Web Forms :: Reference Control On Third Level Master Page From Content Base Class?

Aug 8, 2010

I am attempting to access a textbox control on a master page from a code behind base class but having problems. I have 3 levels of master pages. m1.master is the master page for m2.master which is the master page for m3.master.m3.master has a textbox as shown below

<%Master
Language="C#"
MasterPageFile="~/m2.master"
AutoEventWireup="true"
CodeFile="M3.master.cs"
Inherits="M3"
%>
<asp:Content
ID="Content5"
ContentPlaceHolderID="M2"
Runat="Server">
<asp:TextBox
ID="text1"
runat="server"
></asp:TextBox>
<asp:ContentPlaceHolder
ID="M3"
runat="Server"></asp:ContentPlaceHolder>
</asp:Content>

I have a content page c1.aspx that uses m3.master as its master page as shown below:

@
Page
Title=""
Language="C#"
MasterPageFile="~/m3.master"
AutoEventWireup="true"
CodeFile="c1.aspx.cs"
Inherits="_c1".................

View 2 Replies

C# - How To Access A Private Data Members Of Base Class In The Derived Class

Aug 20, 2010

Since we can access the private data member of base class in the derived class with the help of friend function. How can we do the same in C# asp.net? I mean whats the alternative of friend function in C# asp.net

View 2 Replies

C# - Webservice Complex Types And Class Inheritance - Use The Properties Of The Base Class?

Mar 13, 2010

Using the following Webservice definition using aClientArgs as a complex type:

[System.Web.Script.Services.ScriptService]
public class Controller : System.Web.Services.WebService {
[WebMethod]
public void save_client(aClientArgs client)
{
// Save client data
}
}
Then defining aClientArgs as a sub-class:
public class aArgs
{
public string id = null;
public string name = null;
}
public class aClientArgs : aArgs
{
public string address = null;
public string website = null;
}
Returns the following WSDL fragment for the save_client args:
<save_client xmlns="http://tempuri.org/">
<client>
<address>string</address>
<website>string</website>
</client>
</save_client>
When I'm expecting the following:
<save_client xmlns="http://tempuri.org/">
<client>
<id>string</id>
<name>string</name>
<address>string</address>
<website>string</website>
</client>
</save_client>

So it appears that the .NET WebService is not treating inherited properties as arguments/variables for purposes of a web service. How do I get .NET to also use the properties of the base class?

View 1 Replies

MVC :: Trying To Setup A Base Product Class That Will Be Inherited By A More Specific Class Later?

Dec 16, 2010

In my MVC project, I am trying to setup a base product class that will be inherited by a more specific class later. Here is my scenario. I have a table called ProductBase, it contains three fields, BaseProductId(PK), CatalogNum, and ListPrice. Every product in the system will share these attributes. Next, I have a table called Shirt, with three fields BaseProductId(PK, FK), Color, and Size.

I then setup an Entity Data Model that pulled in both of these tables and created classes BaseProduct and Shirt. So, in my model, I want to do something like this:

[Code]....

The main problem I have with this, is that if I do any kind of condition on CatalogNum or ListPrice, then my performance goes to crap. One of the main things we will want to do is something like this:

[Code]....

This takes an enormous performance hit, and I suspect it is because the partial class above returns to the database for each shirt.

The other problem I have with this approach, is that I cannot force the properties for the Shirt. What if I make a change to the BaseProduct? What happens when I have multiple product types, will I have to repeat this code? I assume I will need to make a change with the entity data model, but I am unsure where to begin.

View 5 Replies

Web Forms :: Master Pages - All My Pages Inherit From The Base Page Class

Jun 21, 2010

Currently I'm doing common functionality required throughout my site inside of my masterpage. What I want to do is move this functionality to a BaseClass so All my pages inherit from the Base Class. However, I'm not sure how to set this up interms of c# code with regards to Using a Base Class and then having a masterpage applied to my aspx pages that i create.

View 5 Replies

WebMatrix :: Custom Default Directory For New Websites?

Jul 15, 2010

How does one create new sites in your own custom directory? Can it be added as a feature?

View 2 Replies

C# - Extending The Base Class?

Mar 5, 2010

When you create a webpage in ASP.net, the codebase inherits System.Web.UI.Page

Now when I extend the page object to check for SessionExpired for example, I create a new class and inherit from system.web.ui.page, and overwrite some functions.

The problem then is that on each page, I have to replace system.web.ui.page with my custompage class.

Is there a way to extend a class by adding methods or modifying its methods directly (e.g. add the sessionExpired check to System.Web.UI.Page) ?

I'm using .NET 2.0

View 2 Replies

Add A Custom Base Class For Web Forms?

Jan 12, 2010

I want to add a custom base class for all of my web forms. I created a "App_code" folder in my asp.net web project and add a simple base page class like this:

namespace MySite.Web
{
// base page for all the pages that need localization
public class LocalizationPage : System.Web.UI.Page
{
protected override void InitializeCulture()
{
base.InitializeCulture();
}
}
}

And then I try to let asp.net web form to inherit from this base page. I have something like this:

using MySite.Web;

namespace MySite.Public
{
public partial class RegisterPage : LocalizationPage
{
}
}

Now I run into problem where Visual Studio doesn't recognize the LocalizationPage class I created. On the above code snippet, LocalizationPage is not highlighted as a class. And when I try to compile, I got the following error message:

Error 1 The type or namespace name 'LocalizationPage' could not be found (are you missing a using directive or an assembly reference?)

View 1 Replies

Base Class Access A Parameter?

Feb 15, 2010

Is it possible for a Controller Base class to access a parameter from an action link and if so how do I access that parameter within my Base Controller?

Action Link:

<%=Url.Action("Area_1419", "Home", new { SectionId = 1})%>

Base Controller Class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Website.Models;
namespace Website.Controllers
{
public abstract class CategoriesController : Controller
{
public CategoriesDataContext _dataContext = new CategoriesDataContext();
public CategoriesDataContext DataContext
{
get { return _dataContext; }
}
public void SectionID()
{
int SectionID = Convert.ToInt32(Request.QueryString["SectionID"]);
ViewData["SectionID"] = SectionID;
}
public CategoriesController2()
{
//ViewData["Categories"] = from m in _dataContext.Categories where m.Area_ID == SectionID select m;
//ViewData["Categories"] = from c in DataContext.Categories select c;
}
}
}

HomeContoller

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Website.Models;
using Website.ActionFilters;
namespace Website.Controllers
{
[HandleError]
public class HomeController : CategoriesController
{
public ActionResult Index()
{
return View();
}
public ActionResult About(int? SectionID)
{
//ViewData["Message"] = SectionID;
return View();
}
public ActionResult Area_1419(int SectionID)
{
return View();
}
public ActionResult Admin()
{
return View();
}
}
}

View 2 Replies

Web Forms :: Master And Base Pages For Default.aspx - Page_Load Is Called Twice?

Feb 2, 2010

I've got a page Default.aspx, it was inherited from class MyBasePage

like this

public partial class _Default : MyBasePage, ICallbackEventHandler
{
}

also it has a master page

<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" MasterPageFile="~/Master/MyMaster.master" CodeFile="Default.aspx.cs" Inherits="_Default" %>

this master page also has a master

<%@ Master Language="C#" MasterPageFile="~/Master/Base.master" AutoEventWireup="true" CodeFile="MyMaster.cs" Inherits="MyMaster" %>

All works ok, but then i discovered that

Page_Load in Default.aspx is called two times, and both from method OnLoad in MyBasePage

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
base.OnLoad(e) calls Page_Load.

I've got a site with such a structure of master pages and basepage, but it works ok, method page_load is called only once.

So why would in the second site PAge_Load be called twice?

View 3 Replies

C# - What Layer Does A UserControl's Base Class Belong

Aug 28, 2010

I have an asp.net usercontrol (ascx) that inherits from an abstract class (that inherits from a UserControl). My Project is in a 3-tier architecture (DAL -> Bll -> UI/Views). Currently there are no class files in the UI layer (other than the code-behinds). Which layer should I add this abstract class to?

View 2 Replies

C# - Inheriting From A System.Web.UI.UserControl Base Class?

Feb 28, 2011

First off, I am wondering if this is possible. I read slight grumblings around the internet about this, but I was not entirely sure.

My scenario: I have a base chart class which has some methods which all charts should have.

public partial class BaseChart : System.Web.UI.UserControl
{
public BaseChart()
{
}
public void ToggleLegend()
{
Chart1.Legends[0].Enabled = !Chart1.Legends[0].Enabled;
}
}

There is also some mark-up for this BaseChart -- setting background colors, etc. All charts which inherit BaseChart should use this starting mark-up and be able to build upon it.

I would then like to do this:

public partial class HistoricalLineChart : BaseChart
{
public HistoricalLineChart()
: base()
{

public HistoricalLineChart(int reportID)
: base()
{
Chart1.Titles[0].Text = "Hello World";
}
}

where HistoricalLineChart is a web user control with no mark-up e.g. "HistoricalLineChart.ascx"

The problem is that Chart1 is undefined when in HistoricalLineChart's scope. Is there something that I am missing here?

View 3 Replies







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