Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 August 9th, 2010, 01:14 PM
Authorized User
 
Join Date: Jul 2010
Posts: 74
Thanks: 23
Thanked 0 Times in 0 Posts
Default Chapter 12 Page 414 Try it out

Hello there,

In this try it out, step 4, Add a RequiredFieldValidator in the EditItemTemplate and InsertItemTemplate.... I am confusing about the RequiredFieldValidator ID="reqVal3", I do not think we define the reqVal3 before, And I am not so clear about how the Validator works in this part.

Another question, the same try it out, setp 12, The Binding for SelectedValue part is gray, which means I can not use this part. I do not know what is going on here, so I have to type the code by hand in the Code Behind.

Thanks.

Last edited by JohnKiller; August 9th, 2010 at 03:09 PM..
 
Old August 10th, 2010, 03: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

Quote:
I do not think we define the reqVal3 before,
Not before, but *in* the very same step you mention:

Quote:
4 Add a RequiredFieldValidator in the EditItemTemplate and the InsertItemTemplate
of both the Title and the Summary rows. You can enter the code directly, or you can drag and drop it from the Toolbox directly in Markup View. Hook the controls up to the TextBox controls in the template by setting the ControlToValidate property and provide a useful error message. Give all four RequiredFieldValidator controls unique names by setting their ID to reqVal1, reqVal2, and so on.
"And so on" is the key here....

Quote:
The Binding for SelectedValue part is gray,
Is the drop down list place correctly inside in a template? Can you post the code for the page? That makes it a lot easier to see why it doesn't work. If you post code here, please use the Remove Text Formatting button on the toolbar and then wrap the code in code tags (the # button on the toolbar).

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!
 
Old August 10th, 2010, 01:29 PM
Authorized User
 
Join Date: Jul 2010
Posts: 74
Thanks: 23
Thanked 0 Times in 0 Posts
Default

Thank you, Imar.

Below is the part of the code, if you need the whole page of code, just let me know.And I typed the
Code:
SelectedValue='<%# Bind("GenreId") %>'
by myself.
Code:
            <asp:TemplateField HeaderText="GenreId" SortExpression="GenreId">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="sdsGenres" DataTextField="Name" DataValueField="Id" SelectedValue='<%# Bind("GenreId") %>'>
					</asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="sdsGenres" DataTextField="Name" DataValueField="Id" SelectedValue='<%# Bind("GenreId") %>'>
					</asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("GenreId") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="UpdateDateTime" HeaderText="UpdateDateTime" 
                SortExpression="UpdateDateTime" Visible="False" />
            <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />

Last edited by JohnKiller; August 10th, 2010 at 01:39 PM..
 
Old August 10th, 2010, 01:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Not sure what the problem is; that code looks fine. Are you doing this in Design View?

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 August 10th, 2010, 02:52 PM
Authorized User
 
Join Date: Jul 2010
Posts: 74
Thanks: 23
Thanked 0 Times in 0 Posts
Default

Imar,

I was doing this at the Design View, but the Binding for SelectedValue part is gray, which means I can not use this part. Then I switched to the Source View to add the code by hand. I really do not know what is going on here. Do you need more code, or what should we do.

Thank you.
 
Old August 10th, 2010, 03:01 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It's supposed to work as described (just tested it), so somehow, something is wrong on your machine.

You can continue by simply typing in the code as you've done now, or report a bug at the Microsoft Connect web site: http://connect.microsoft.com/

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:
JohnKiller (August 10th, 2010)
 
Old August 10th, 2010, 03:17 PM
Authorized User
 
Join Date: Jul 2010
Posts: 74
Thanks: 23
Thanked 0 Times in 0 Posts
Default

Ok, Imar, thank you so much for the help.





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 12: Page 410 - Try it out VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 April 20th, 2008 03:44 PM





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