Create Custom Default.ASPX

Discussion in 'ASP .Net' started by Sanjay Pais, Jun 17, 2005.

  1. Sanjay Pais

    Sanjay Pais Guest

    We are using ASP.2.0 and I was wondering if any one knew how I could modify
    the default.aspx.

    What I want to do is add some new HTML to the aspx page as well as either
    change the code behind or use some new code beside on the page itself.

    For example, I want to change this
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    Inherits="_Default" %>

    To

    <%@ Page Language="C#" AutoEventWireup="true" UICulture="auto"
    Culture="auto" CodeFile="Default.aspx.cs" Inherits="_Default" %>



    I also was hoping to add some custom code to the page by default ie:

    protected override void InitializeCulture(){

    string CurrentCulture ="";

    try{

    CurrentCulture = Session["Culture"].ToString();

    if (CurrentCulture.Length > 0){

    Thread.CurrentThread.CurrentUICulture = new
    CultureInfo(CurrentCulture);

    Thread.CurrentThread.CurrentCulture =
    CultureInfo.CreateSpecificCulture(CurrentCulture);

    ErrorMessage = "Language: " + CurrentCulture;

    }

    }

    catch (Exception ex) {

    ErrorMessage = ex.Message.ToString();

    }


    }

    I am not interested in the master page solution as it is not a viable
    approach for our solution.



    Thanks in advance



    Sanjay
     
    Sanjay Pais, Jun 17, 2005
    #1
    1. Advertising

  2. Sanjay Pais

    Brock Allen Guest

    You'd have to change the template files. This was fairly easy before for
    non-web projects, but for the new web model these are the only files I can
    find:

    C:\Program Files\Microsoft Visual Studio 8\Web\WebNewFileItems\CSharp

    So change these template files and see if that gives you what you need.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > We are using ASP.2.0 and I was wondering if any one knew how I could
    > modify the default.aspx.
    >
    > What I want to do is add some new HTML to the aspx page as well as
    > either change the code behind or use some new code beside on the page
    > itself.
    >
    > For example, I want to change this
    > <%@ Page Language="C#" AutoEventWireup="true"
    > CodeFile="Default.aspx.cs"
    > Inherits="_Default" %>
    > To
    >
    > <%@ Page Language="C#" AutoEventWireup="true" UICulture="auto"
    > Culture="auto" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    >
    > I also was hoping to add some custom code to the page by default ie:
    >
    > protected override void InitializeCulture(){
    >
    > string CurrentCulture ="";
    >
    > try{
    >
    > CurrentCulture = Session["Culture"].ToString();
    >
    > if (CurrentCulture.Length > 0){
    >
    > Thread.CurrentThread.CurrentUICulture = new
    > CultureInfo(CurrentCulture);
    >
    > Thread.CurrentThread.CurrentCulture =
    > CultureInfo.CreateSpecificCulture(CurrentCulture);
    >
    > ErrorMessage = "Language: " + CurrentCulture;
    >
    > }
    >
    > }
    >
    > catch (Exception ex) {
    >
    > ErrorMessage = ex.Message.ToString();
    >
    > }
    >
    > }
    >
    > I am not interested in the master page solution as it is not a viable
    > approach for our solution.
    >
    > Thanks in advance
    >
    > Sanjay
    >
     
    Brock Allen, Jun 17, 2005
    #2
    1. Advertising

  3. Hello,

    I don't know how to do it in 2.0 but in 1.x you can create your own custom
    templates. It's a bit of a process but well worth the effort to not have to
    customize each page as you know.

    Here is the article I used to create all of mine.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/customwebwiz.asp

    HTH
    --
    Ian Lane


    "Sanjay Pais" wrote:

    > We are using ASP.2.0 and I was wondering if any one knew how I could modify
    > the default.aspx.
    >
    > What I want to do is add some new HTML to the aspx page as well as either
    > change the code behind or use some new code beside on the page itself.
    >
    > For example, I want to change this
    > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    > Inherits="_Default" %>
    >
    > To
    >
    > <%@ Page Language="C#" AutoEventWireup="true" UICulture="auto"
    > Culture="auto" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    >
    >
    >
    > I also was hoping to add some custom code to the page by default ie:
    >
    > protected override void InitializeCulture(){
    >
    > string CurrentCulture ="";
    >
    > try{
    >
    > CurrentCulture = Session["Culture"].ToString();
    >
    > if (CurrentCulture.Length > 0){
    >
    > Thread.CurrentThread.CurrentUICulture = new
    > CultureInfo(CurrentCulture);
    >
    > Thread.CurrentThread.CurrentCulture =
    > CultureInfo.CreateSpecificCulture(CurrentCulture);
    >
    > ErrorMessage = "Language: " + CurrentCulture;
    >
    > }
    >
    > }
    >
    > catch (Exception ex) {
    >
    > ErrorMessage = ex.Message.ToString();
    >
    > }
    >
    >
    > }
    >
    > I am not interested in the master page solution as it is not a viable
    > approach for our solution.
    >
    >
    >
    > Thanks in advance
    >
    >
    >
    > Sanjay
    >
    >
    >
     
    =?Utf-8?B?SWFuIExhbmU=?= .enizin.net>, Jun 17, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Lau
    Replies:
    6
    Views:
    2,907
    Steven Cheng[MSFT]
    Feb 27, 2004
  2. Ted Apollo

    WebForm1.aspx / default.aspx

    Ted Apollo, Aug 26, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,452
    Joerg Jooss
    Aug 26, 2004
  3. John M
    Replies:
    1
    Views:
    1,239
    Kumar Reddi
    May 29, 2005
  4. Gaetan
    Replies:
    3
    Views:
    1,458
    Juan T. Llibre
    Feb 14, 2006
  5. brown

    create webcontrols in aspx or aspx.cs

    brown, Sep 22, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    174
    brown
    Sep 24, 2006
Loading...

Share This Page