Professional Web Applications Themes

Overiding Page Class - ASP.NET General

"Vincent V" <vincentv-n0-5pam-optushome.com.au> wrote in message news:%phx.gbl...  I'm not sure what you mean here. If you want to set some values inside of your custom page class, you can add public properties to the custom page class. You can then create a separate control which has mirror copies of those properties, and which simply sets them in the custom page class: <wc:MyControl PageID="p1" PageCategory="Company" PageSubCategory="Investment" /> MyControl would save the property values in class members until OnLoad is called, then: protected override void OnLoad(EventArgs e) { MyPage p = this.Page as MyPage; if (p == null) return; p.PageID = m_PageID; ...

  1. #1

    Default Re: Overiding Page Class

    "Vincent V" <vincentv-n0-5pam-optushome.com.au> wrote in message
    news:%phx.gbl... 

    I'm not sure what you mean here. If you want to set some values inside of
    your custom page class, you can add public properties to the custom page
    class. You can then create a separate control which has mirror copies of
    those properties, and which simply sets them in the custom page class:

    <wc:MyControl PageID="p1" PageCategory="Company"
    PageSubCategory="Investment" />

    MyControl would save the property values in class members until OnLoad is
    called, then:

    protected override void OnLoad(EventArgs e)
    {
    MyPage p = this.Page as MyPage;
    if (p == null)
    return;

    p.PageID = m_PageID;
    p.PageCategory = m_PageCategory;
    p.PageSubCategory = m_PageSubCategory;

    base.OnLoad(e);
    }

    ....
     
    OnInits 

    When you override a method, you should almost always call the base class
    method. When you call it depends on the nature of the method, but in this
    case, call base.OnInit(e) at the end of your OnInit override.
    --
    John Saunders
    Internet Engineer
    com


    John Guest

  2. #2

    Default Re: Overiding Page Class

    Check out this article, here i have passed pagetitle and stylesheet name to
    the base page class.
    http://www.microsoft.com/india/msdn/articles/87.aspx

    --
    Saravana
    Microsoft India Community Star,MC**
    www.extremeexperts.com



    "Vincent V" <vincentv-n0-5pam-optushome.com.au> wrote in message
    news:#phx.gbl... 
    to 
    OnInits 


    Saravana Guest

  3. #3

    Default Overiding Page Class

    Hey im Overiding OnInit in my Custom Page class
    What i want to be able to do is pass in Some Values
    Ie PageID PageCategory, PageSubCategory
    How can i pass in some Vairables So my Custom Page class can see these


    Imports System.Web

    Imports System.Web.UI

    Imports System.Data

    Namespace MTT.PageClasses

    Public Class GenericPage

    Inherits System.Web.UI.Page

    Protected Overrides Sub OnInit(ByVal e As System.EventArgs)

    Dim myCtrl As Control

    For Each myCtrl In Page.Controls

    Response.Write(myCtrl.ID)

    Next



    End Sub

    End Class

    End Namespace


    Also another question is it possible to Inherit The page class more than
    once
    I want a GenericPageClass That Does Some Work on OnInit

    I want Another MainPageClass That Inherits Generic Page Class And i want to
    do some work OnInit Int this sub
    The problem seems that Im using Overload that cuases only One of the OnInits
    To Fire

    Is there a way i can get these 2 OnInit Subs Perform Different to the one
    page

    Thanks





    Vincent Guest

Similar Threads

  1. how can I reference a user control from a page class?
    By Harper in forum ASP.NET Building Controls
    Replies: 3
    Last Post: January 8th, 08:07 PM
  2. multiple form in a page class
    By Vanessa in forum PHP Development
    Replies: 2
    Last Post: May 21st, 08:55 AM
  3. Overiding Language setting from String Panel
    By noclar7 webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 6th, 07:11 PM
  4. Replies: 0
    Last Post: August 18th, 04:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139