Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old August 23rd, 2009, 08:38 AM
Authorized User
 
Join Date: Jul 2009
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
Thumbs up Page 417 step 12 "Bound to:" field

Hello!
A.
Your book is definately the best I have ever used. I was wondering if the next book called "Professional ASP...." works by the same method with " Try it out " on each chapter as in your book.

B.
When I reached Page 417 step 12 "Bound to:" field I saw that it contains the following options:
1. (Unbound)
2. Id
3. Name

I am asked to select GenreId but that is not available.
Where is my problem?
If it of any use my code is :

<%@PageLanguage="C#"MasterPageFile="~/MasterPages/ManagementMaster.master"AutoEventWireup="true"CodeFile="AddEditReview.aspx.cs"Inherits="Management_AddEditReview"Title="Planet Wrox - Management - Insert and Update Reviews" %>
<asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server">
</
asp:Content>
<
asp:ContentID="Content2"ContentPlaceHolderID="cpMainContent"Runat="Server">
<asp:DetailsViewID="DetailsView1"runat="server"AutoGenerateRows="False"DataKeyNames="Id"DataSourceID="sdsGenres"DefaultMode="Insert"Height="50px"Width="125px">
<Fields>
<asp:BoundFieldDataField="Id"HeaderText="Id"InsertVisible="False"ReadOnly="True"SortExpression="Id"/>
<asp:TemplateFieldHeaderText="Title"SortExpression="Title">
<EditItemTemplate>
<asp:TextBoxID="TextBox1"runat="server"Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal1"ControlToValidate="TextBox1"runat="server"ErrorMessage="Please enter a title">
</asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBoxID="TextBox1"runat="server"Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal2"ControlToValidate="TextBox1"runat="server"ErrorMessage="Please enter a title">
</asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:LabelID="Label1"runat="server"Text='<%# Bind("Title") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBoxID="TextBox1"runat="server"Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal1"ControlToValidate="TextBox1"runat="server"ErrorMessage="Please enter a title">
</asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBoxID="TextBox1"runat="server"Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal2"ControlToValidate="TextBox1"runat="server"ErrorMessage="Please enter a title">
</asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateFieldHeaderText="Summary"SortExpression="Summary">
<EditItemTemplate>
<asp:TextBoxID="TextBox2"TextMode="MultiLine"Width="500"Height="100"runat="server"Text='<%# Bind("Summary") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal3"ControlToValidate="TextBox2"runat="server"ErrorMessage="Please enter a summary">
</asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBoxID="TextBox2"TextMode="MultiLine"Width="500"Height="100"runat="server"Text='<%# Bind("Summary") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal4"ControlToValidate="TextBox2"runat="server"ErrorMessage="Please enter a summary">
</asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:LabelID="Label2"runat="server"Text='<%# Bind("Summary") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBoxID="TextBox2"TextMode="MultiLine"Width="500"Height="100"runat="server"
Text='<%# Bind("Summary") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal3"ControlToValidate="TextBox2"runat="server"ErrorMessage="Please enter a summary">
</asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBoxID="TextBox2"TextMode="MultiLine"Width="500"Height="100"runat="server"
Text='<%# Bind("Summary") %>'></asp:TextBox>
<asp:RequiredFieldValidatorID="reqVal4"ControlToValidate="TextBox2"runat="server"ErrorMessage="Please enter a summary">
</asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateFieldHeaderText="Body"SortExpression="Body">
<EditItemTemplate>
<asp:TextBoxID="TextBox3"runat="server"Text='<%# Bind("Body") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBoxID="TextBox3"runat="server"Text='<%# Bind("Body") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:LabelID="Label3"runat="server"Text='<%# Bind("Body") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBoxID="TextBox3"TextMode="MultiLine"Width="500"Height="100"runat="server"
Text='<%# Bind("Summary") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBoxID="TextBox3"TextMode="MultiLine"Width="500"Height="100"runat="server"
Text='<%# Bind("Summary") %>'></asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateFieldHeaderText="GenreId"SortExpression="GenreId">
<EditItemTemplate>
<asp:TextBoxID="TextBox4"runat="server"Text='<%# Bind("GenreId") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownListID="DropDownList1"runat="server"DataSourceID="sdsGenres"DataTextField="Name"DataValueField="Id">
</asp:DropDownList>
</InsertItemTemplate>
<ItemTemplate>
<asp:LabelID="Label4"runat="server"Text='<%# Bind("GenreId") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CheckBoxFieldDataField="Authorized"HeaderText="Authorized"SortExpression="Authorized"/>
<asp:BoundFieldDataField="UpdateDateTime"HeaderText="UpdateDateTime"SortExpression="UpdateDateTime"Visible="False"/>
<asp:CommandFieldShowEditButton="True"ShowInsertButton="True"/>
</Fields>
</asp:DetailsView>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:PlanetWroxConnectionString1 %>"DeleteCommand="DELETE FROM [Review] WHERE [Id] = @Id"InsertCommand="INSERT INTO [Review] ([Title], [Summary], [Body], [GenreId], [Authorized], [UpdateDateTime]) VALUES (@Title, @Summary, @Body, @GenreId, @Authorized, @UpdateDateTime)"SelectCommand="SELECT [Id], [Title], [Summary], [Body], [GenreId], [Authorized], [UpdateDateTime] FROM [Review] WHERE ([Id] = @Id)"UpdateCommand="UPDATE [Review] SET [Title] = @Title, [Summary] = @Summary, [Body] = @Body, [GenreId] = @GenreId, [Authorized] = @Authorized, [UpdateDateTime] = @UpdateDateTime WHERE [Id] = @Id">
<SelectParameters>
<asp:QueryStringParameterName="Id"QueryStringField="Id"Type="Int32"/>
</SelectParameters>
<DeleteParameters>
<asp:ParameterName="Id"Type="Int32"/>
</DeleteParameters>
<UpdateParameters>
<asp:ParameterName="Title"Type="String"/>
<asp:ParameterName="Summary"Type="String"/>
<asp:ParameterName="Body"Type="String"/>
<asp:ParameterName="GenreId"Type="Int32"/>
<asp:ParameterName="Authorized"Type="Boolean"/>
<asp:ParameterDbType="Date"Name="UpdateDateTime"/>
<asp:ParameterName="Id"Type="Int32"/>
</UpdateParameters>
<InsertParameters>
<asp:ParameterName="Title"Type="String"/>
<asp:ParameterName="Summary"Type="String"/>
<asp:ParameterName="Body"Type="String"/>
<asp:ParameterName="GenreId"Type="Int32"/>
<asp:ParameterName="Authorized"Type="Boolean"/>
<asp:ParameterDbType="DateTime"Name="UpdateDateTime"/>
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSourceID="sdsGenres"runat="server"ConnectionString="<%$ ConnectionStrings:PlanetWroxConnectionString1 %>"SelectCommand="SELECT [Id], [Name] FROM [Genre] ORDER BY [SortOrder]">
</asp:SqlDataSource>
<p>
</p>
</
asp:Content>

  #2 (permalink)  
Old August 24th, 2009, 12:15 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Dan,

Can you please repost your code and when you do so, use the Remove Code Formatting button on the toolbar to remove the color coding? Due to a bug in this forum all relevant spaces are lost.

Also, are you sure you're opening up the right dialogs for the correct control? GenreId should be available in the binding dialog; just a few lines above the DDL you see this: Bind("GenreId") which implies GenreId is in scope.

Glad to hear you like the book so much...

AFAIK, the Pro series doesn't use Try It Out exercises, but you could download a sample chapter and see if you like it: http://www.wrox.com/WileyCDA/WroxTit...470187573.html

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
How to go back to last position after move mouse by mouse_event Lib "user32" Hoang Excel VBA 0 July 7th, 2009 11:00 PM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM
Chapter-5 on Intents:ContactPickerTester does not show the button "Pick a Contact" sunilm12 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 April 15th, 2009 11:55 AM
How to download Code in "Professional Active Server Page 3.0 " book. renjith0 All Other Wrox Books 2 April 2nd, 2009 05:06 AM





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