Wrox Programmer Forums
|
BOOK: Beginning ASP.NET for Visual Studio 2015
This is the forum to discuss the Wrox book Beginning ASP.NET for Visual Studio 2015 by William Penberthy; ISBN: 978-1-119-07742-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET for Visual Studio 2015 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 November 18th, 2016, 09:42 AM
Registered User
 
Join Date: Nov 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap 6, p189/193

First as an aside, I sympathize with fellow VB users. Too much is made by people who forget that a programming language is just a tool purchased to produce a product for a customer. Use the tool that suits you and does the job for you. As to my problem, when I added the code snippet to produce the check boxes:
Code:
        <div class="form-group">
          @Html.LabelFor(Function(model) model.Hobbies, htmlAttributes:= New With { .class = "control-label col-md-2"})
          <div class="col-md-10">
            @For Each hobby As String In hobbyList
' (note: I declared the checkedTest in the @Code section)
              checkedText = If(Model.Hobbies.Contains(hobby), "checked", String.Empty)
              <span>
                <input name="hobbies" value="@hobby" type="checkbox" @checkedText />
                @hobby
              </span>
            Next
          </div>
        </div>
both <span> and <input throw up an error stating
'Attributes cannot be applied to local variables'
Another thing I cannot resolve (remember that the title of this book starts with 'Beginning' is that 'model' doesn't get instantiated and retuns 'Nothing'.
I managed to sort out everything up to this point but I just cannot get around these. I use VB and created the project as an MVC with ASP.
Any help?

Last edited by AxelT; November 18th, 2016 at 12:21 PM.. Reason: Additional question in same snippet. I'm stuck!





Similar Threads
Thread Thread Starter Forum Replies Last Post
chap 6, sandeepgreaternoida BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 October 31st, 2013 09:05 AM
Chap 3 Exercise 2 mikenoth BOOK: Ivor Horton's Beginning Visual C++ 2010 0 September 28th, 2013 12:27 AM
Chap 2 - Avatars and uploading files, (would apply to Chap 6 too) kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 18th, 2009 03:14 PM
help in chap 15 manal_sag BOOK: Beginning ASP 3.0 2 May 25th, 2005 02:59 AM
Returncode: 193 Inga Apache Tomcat 1 August 11th, 2004 01:53 AM





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