Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2014, 11:13 PM
Authorized User
Points: 76, Level: 1
Points: 76, Level: 1 Points: 76, Level: 1 Points: 76, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 16
Thanks: 7
Thanked 0 Times in 0 Posts
Default Chapter 2: CodeBehind and CodeInline

Hello to all fellow programmer,

CodeBehind Files

1. The file are created and named after the master.aspx file with additional extension *.vb or *.cs
and are store in the same folder as the master file.

Can we place the file or our customised CodeBehind files to a different folder from the master file
and provide the linkage to all this files as and when needed using <a href), is this a good idea?

CodeInline Files

1. The file are embedded in the master.aspx and its content are stored under the <script> tag.

Am I saying it right, or the content can also be stored in other HTML elements apart from the script?

Thank you very much.

Cheers
Mohamad

Last edited by mohamad; June 19th, 2014 at 11:17 PM..
Reply With Quote
  #2 (permalink)  
Old June 20th, 2014, 03:44 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

>> and provide the linkage to all this files as and when needed using <a href), is this a good idea?

Nope, it's not, and it's not how it works. Neither the Master File nor its code behind ever make it to the browser. They serve to define the presentation and behavior of other pages (Content Pages) only and are never used at the client. As such you cannot link to them.

>> The file are embedded in the master.aspx and its content are stored under the <script> tag.

Well, the *code* should be in a Script element. All other content can be in other places in the page like inside a <head> or <body> element.

>> Am I saying it right, or the content can also be stored in other HTML elements apart from the script?

Other content can, but the server side code cannot.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
mohamad (June 20th, 2014)
  #3 (permalink)  
Old June 21st, 2014, 11:20 PM
Authorized User
Points: 76, Level: 1
Points: 76, Level: 1 Points: 76, Level: 1 Points: 76, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 16
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Thanks Imar,

1. Can we have many code behind files for the master file?


a. And if possible how's the naming convention for the additional files for the
master to take precedence?

Cheers,
Mohamad
Reply With Quote
  #4 (permalink)  
Old June 22nd, 2014, 02:57 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

A master page only has a single code behind file. .net supports the concept of partial classes that allows you to split complex classes into multiple files. However you typically don't have a lot of code behind the master page so I don't think that partial classes are a good fit in this scenario.

cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
mohamad (June 22nd, 2014)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Codebehind for conditional visibility Nostromo77 ASP.NET 2.0 Basics 4 September 21st, 2008 08:00 PM
Codebehind not working angshujit ASP.NET 1.0 and 1.1 Basics 1 September 21st, 2007 07:32 AM
JSP Codebehind buddhudev Pro JSP 0 October 1st, 2005 02:33 PM
Ch15 CodeBehind mahir BOOK: Beginning ASP.NET 1.0 2 May 8th, 2004 01:58 AM



All times are GMT -4. The time now is 11:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.