PHP & MySQL to C# .NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nick Bolton

    PHP & MySQL to C# .NET

    Hello,

    Maybe a common case, but I really want to not so much as migrate from
    PHP/MySQL to C# .NET but learn the new language.

    I have made maybe 3/4 very simple systems using C# .NET, but they all
    seem to be a little, well simple -- and not uniform at all.

    When I use PHP, I always incorperate some kind of template system, so,
    say I have a master template and a child template which is loaded
    inside the master.

    I am aware of the ASP 2.0 master page functionality, but upgrading to
    VS.NET 2005 right now isn't really an option; so I'm going to have to
    stick with 2003.

    Could anybody shed some light on how I would go about maintaining a
    constant feel to all my aspx pages? An alternative to the master page
    functionality in 2005 perhaps?

    Any help at all would be much appreciated!

    Thanks,
    Nick

  • Andrei Pociu

    #2
    Re: PHP & MySQL to C# .NET

    Hello Nick,

    I use WebUserControls for header, footer, menus and other items that should
    be the same on all pages. Very similar to using PHP's include() function (I
    also come from a PHP & MySQL background).

    Regards,
    Andrei Pociu

    "Nick Bolton" <nick@renhome.n et> wrote in message
    news:1115503330 .355998.236670@ f14g2000cwb.goo glegroups.com.. .[color=blue]
    > Hello,
    >
    > Maybe a common case, but I really want to not so much as migrate from
    > PHP/MySQL to C# .NET but learn the new language.
    >
    > I have made maybe 3/4 very simple systems using C# .NET, but they all
    > seem to be a little, well simple -- and not uniform at all.
    >
    > When I use PHP, I always incorperate some kind of template system, so,
    > say I have a master template and a child template which is loaded
    > inside the master.
    >
    > I am aware of the ASP 2.0 master page functionality, but upgrading to
    > VS.NET 2005 right now isn't really an option; so I'm going to have to
    > stick with 2003.
    >
    > Could anybody shed some light on how I would go about maintaining a
    > constant feel to all my aspx pages? An alternative to the master page
    > functionality in 2005 perhaps?
    >
    > Any help at all would be much appreciated!
    >
    > Thanks,
    > Nick
    >[/color]


    Comment

    • Nick Bolton

      #3
      Re: PHP &amp; MySQL to C# .NET

      Andrei,

      Thanks for the reply! Glad to know I'm not the only lost developer from
      a PHP background.

      I just read a very interesting article on user controls and custom
      controls by a guy called Solomon Shaffer (www.15seconds.com). I
      reccomed anybody to have a look.




      Glad I stumbled across this, it's shed a lot of light on the subject.
      But what I still can't understand is why Microsoft have decided to
      include "Master pages" in the .NET 2.0 framework. What's the
      difference...? Is it just easier to use?

      Comment

      • Andrei Pociu

        #4
        Re: PHP &amp; MySQL to C# .NET

        I believe master pages are a different concept, they don't seem similar to
        WebUserControls :

        ASP.NET 2.0 introduces a new concept known as Master Pages, in which you
        create a common base master file that provides a consistent layout for
        multiple pages in your application. To create a Master Page, you identify
        common appearance and behavior factors for the pages in your application,
        and move those to a master page.


        I haven't tried them yet but I'm planning to soon.

        Don't give up on ASP.NET even though some things might differ a lot from
        PHP, after you get the hang of it, you'll see it was worth it ;).

        Regards,
        Andrei Pociu


        "Nick Bolton" <nick@renhome.n et> wrote in message
        news:1115540487 .761078.125750@ g14g2000cwa.goo glegroups.com.. .[color=blue]
        > Andrei,
        >
        > Thanks for the reply! Glad to know I'm not the only lost developer from
        > a PHP background.
        >
        > I just read a very interesting article on user controls and custom
        > controls by a guy called Solomon Shaffer (www.15seconds.com). I
        > reccomed anybody to have a look.
        >
        > http://www.15seconds.com/issue/020319.htm
        > http://www.15seconds.com/issue/020430.htm
        >
        > Glad I stumbled across this, it's shed a lot of light on the subject.
        > But what I still can't understand is why Microsoft have decided to
        > include "Master pages" in the .NET 2.0 framework. What's the
        > difference...? Is it just easier to use?
        >[/color]


        Comment

        • Sherif

          #5
          Re: PHP &amp; MySQL to C# .NET

          Hello

          The master template can be done with ASP 1.0, but you will have to implement
          it yourself, and you will not have WYSIWYG from VS2003 that VS2005 provides
          with master pages.
          The idea is make one .aspx page with a PlaceHolder control, then override
          the CreateChildCont rols method to dynamically load and add a user control
          (.ascx) file to the PlaceHolder. Determining what .ascx file to use can be
          done by query strings, url rewriting and reading the path, or any other
          method.

          Best regards,
          Sherif

          "Nick Bolton" <nick@renhome.n et> wrote in message
          news:1115503330 .355998.236670@ f14g2000cwb.goo glegroups.com.. .[color=blue]
          > Hello,
          >
          > Maybe a common case, but I really want to not so much as migrate from
          > PHP/MySQL to C# .NET but learn the new language.
          >
          > I have made maybe 3/4 very simple systems using C# .NET, but they all
          > seem to be a little, well simple -- and not uniform at all.
          >
          > When I use PHP, I always incorperate some kind of template system, so,
          > say I have a master template and a child template which is loaded
          > inside the master.
          >
          > I am aware of the ASP 2.0 master page functionality, but upgrading to
          > VS.NET 2005 right now isn't really an option; so I'm going to have to
          > stick with 2003.
          >
          > Could anybody shed some light on how I would go about maintaining a
          > constant feel to all my aspx pages? An alternative to the master page
          > functionality in 2005 perhaps?
          >
          > Any help at all would be much appreciated!
          >
          > Thanks,
          > Nick
          >[/color]


          Comment

          • Nick Bolton

            #6
            Re: PHP &amp; MySQL to C# .NET

            Sherif,

            Nice idea, if it works, it sure beats loading several UserControls on
            to a page at once, then just switching the visability.

            How would I go about creating a new UserControl from a path? Don't they
            have to be registered on the aspx page?

            For example, say I wanted to load in "/Pages/Home.ascx" and assign it
            to currentPage (which is a UserControl object). What method would I use
            to do this?

            Comment

            • Nick Bolton

              #7
              Re: PHP &amp; MySQL to C# .NET

              Serif,

              Found the LoadControl method, which works perfectly. Apart from one
              minor detail, which I cant seem to fix...

              Controls within my called UserControl don't seem to work... at all. Any
              ideas why not? No errors are returned, the control just seems to not
              bother running the associated event then posts nothing back to the
              page.

              InitializeCompo nent is however run, and the event controler for the
              control is added, but as I said, nothing is actually run when a button
              is clicked for example.

              Comment

              • Nick Bolton

                #8
                Re: PHP &amp; MySQL to C# .NET

                Well, third and final post in a row I should hope. Solved the problem!
                All thanks to a top guy called Denis Bauer. He created a Control called
                "DynamicControl sPlaceholder".

                The issue I had yet to discover was that when I posted back to my page,
                all the Controls with my PlaceHolder weren't being saved to the
                viewstate. This means that the events could never actually be fired as
                the UserControl had dissapeared.

                As you may have guessed, the DynamicControls Placeholder solved this
                very nicely indeed by... You guessed it, saving the view state.



                Comment

                Working...