By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

PHP & MySQL to C# .NET

P: n/a
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

Nov 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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" <ni**@renhome.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 17 '05 #2

P: n/a
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?

Nov 17 '05 #3

P: n/a
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.
http://www.devx.com/dotnet/Article/18042

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" <ni**@renhome.net> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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?

Nov 17 '05 #4

P: n/a
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 CreateChildControls 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" <ni**@renhome.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 17 '05 #5

P: n/a
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?

Nov 17 '05 #6

P: n/a
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.

InitializeComponent 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.

Nov 17 '05 #7

P: n/a
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
"DynamicControlsPlaceholder".

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 DynamicControlsPlaceholder solved this
very nicely indeed by... You guessed it, saving the view state.

http://www.denisbauer.com/ASPNETCont...aceholder.aspx

Nov 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.