Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 12th, 2015, 02:03 PM
Authorized User
 
Join Date: Dec 2008
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default Chapter 11, page 383, SmartTag

Hi,

I'm doing to "Using Basic Selectors" Try It Out and on step 4, instructions say "open its Smart Tasks panel and choose Create Custom Content." Otherwise good, but the only option Smart Tasks panel has is "Default to Master's Content". How do I proceed?

Thanks for any help.
 
Old June 12th, 2015, 02:10 PM
Authorized User
 
Join Date: Dec 2008
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Seems that it is already what it should be (please correct me). The key is that you have in your demo page (I called it Basic Selectors Demo) a new block that is (after completing the exercise) like this:
Code:
<asp:Content ID="Content3" ContentPlaceHolderID="cpClientScript" Runat="Server">
    <script>
        $(function () {
            $('*').css('color', 'Green');
            $('#Sidebar').css('border-bottom', '2px solid red');
            $('h1').bind('click', function () { alert('Hello World') });
            $('.SampleClass').addClass('PleaseWait').hide(5000);
            $('footer, header').slideUp('slow').slideDown('slow');
            $('#Sidebar img').fadeTo(5000, 0.1);
        });
    </script>
</asp:Content>
 
Old June 14th, 2015, 09:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yup, seems your page already had it. But indeed: what's important is that your page has a Content element to which you can add the jQuery code.

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!
The Following User Says Thank You to Imar For This Useful Post:
Jaymond Flurrie (June 14th, 2015)
 
Old April 9th, 2017, 10:47 PM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default New Custom Template??

I was lost at step 4 on page 382.

I did everything in the whole project, and it worked fine.

But my question is - what was I doing when I selected "Create Custom Content" in the smart tag. And why would I create another template from this - based on Ch. 6 rules?

Does the next exercise assume that I did so, or am I still creating a new jQuery Demo page (from page 384) based on the original My Base Page template?
 
Old April 13th, 2017, 03:52 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> what was I doing when I selected "Create Custom Content" in the smart tag.

You're creating a section in a content page for content specific to that page. The master page has a placeholder for it and by creating custom content, you create the content control for it in the content page.

>> And why would I create another template from this - based on Ch. 6 rules?

You updated the master page to include this new section. For each new content page that requires a content section for scripts you can go through the steps that create the custom content. If you need this often this can get a bit cumbersome. In that case, it'll be easier to update / recreate the template so new pages based on that template have that section already.

Does that help?

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!
 
Old April 13th, 2017, 10:07 AM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Custom content

>>You're creating a section in a content page for content specific to that page. The master page has a placeholder for it and by creating custom content, you create the content control for it in the content page.

Very confusing, sorry. I created a placeholder in the master page, I understand this. I also understand that I can create a new template if need be.

But in the exercise, I was asked to "create custom content" from the smart tag off of cpClientScript content section added to master page.

Why couldn't I have just created the jquery for that exercise in the cpMainContent?

What I'm asking is - what was I doing in page 383, step #4?
In relation to page 385, step # 2. "Add a Content block for the cpClientScript below cpMainContent. This block said ID = Content3.

When I did this step, mine said, ID = Content2. Which makes me think I left out some step from the last exercise. Ex: Was I supposed to make a template from 383 step 4?
 
Old April 16th, 2017, 05:18 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

When you create a placeholder in a master page, all you do is that: create a placeholder. In order for it to be useful you need create a content block for it in a content page that uses it.

>> Why couldn't I have just created the jquery for that exercise in the cpMainContent?

You could have, but then it would have ended up in the main body part of the page. By creating a separate cpClientScript placeholder you can define the location of the script in the page: near the end of the page (which is a good place for scripts). Same thing is done with the placeholder called head in the <head> section of the page. That allows you to have a content section in a content page that goes between the <head> tags of the page. The end result is more or less the same: the script ends up in the final page but by having separate placeholders you can define where it ends up.

>> Which makes me think I left out some step from the last exercise.

These IDs are auto-generated so the numbers don't always mean anything. You should have 3 content placeholder in your masterpage: head, cpMainContent and cpSclientScript.

>> Ex: Was I supposed to make a template from 383 step 4?

As I said earlier, you don't have to. If you create a new template based on the updated master, all it does is automatically create a Content section linked to cpClientScripts to each new page you add to the site. If you often need client scripts, that would be helpful. If you hardly need client script, you can leave the old template in place and just use Create Custom Content to add a new <Content /> element in your Content page.

Does this help?

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!
 
Old April 16th, 2017, 02:53 PM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Custom content

Thanks, all of you answer made sense, and were very helpful!

Regarding the "create custom" portion for content.
I think I understand it (please confirm) - that you have to "create custom" on the cpClientScript section every time (unless you've gone with a template) - because the code does not show up in source view?

Or is dragging a content to the source view and labeling the ID "cpClientScript" the same thing?
 
Old April 17th, 2017, 05:54 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> I think I understand it (please confirm) - that you have to "create custom" on the cpClientScript section every time (unless you've gone with a template) - because the code does not show up in source view?

Exactly.

>> Or is dragging a content to the source view and labeling the ID "cpClientScript" the same thing?

Yep, that also creates the custom content, as would manually typing it in source view.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 1, page 11/12 jonzi_456 BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 7 April 21st, 2010 09:18 PM
Chapter 11 Page 354 skijor BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 August 9th, 2009 08:02 AM
Chapter 1, page 11 typo? tumana BOOK Beginning Linux Programming, 3rd Edition 4 August 25th, 2006 10:43 AM





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