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 February 16th, 2011, 11:19 AM
Registered User
 
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch12 - TIO - Customizing GridView Controls p404 Step 9 & 10

Hello:
I am working my way thought chapter 12 and have hit a road block. On page 404 of chapter 12 in the Try It Out - Customizing GridView Columns I am having problems with step 9 and 10.

Step 9 reads: Switch to Markup View and then remove the <EditItemTemplate> for the Authorized field.

Step 10 reads: Modify the label control in the ItemTemplate on the Authorized field so it ends up like this.
<asp:Label ID='lblAuthorized" runat="server"
Text='<%# GetBooleanText(Eval('Authorized')) %>' />
I have tried this exercisse twice with deleting the reviews.aspx page between tries and both times I can not find the <EditItemTemplate> or the <asp:Label ID="lblAuthorizsed runat="server"..... that has been refereced by steps 9 and 10.

I have checked the "errata" and found no mention of any erros for this try it out. I could certainly just copy your code from the source data but I would much rather know where I went wrong.

Below is the markup code for my Reviews.aspx page. Can you please tell me where my error is or where I went wrong with this try it out.

Thanks!

Markup code:
Code:
<%@ Page Title="Planet Wrox - Management - Reviews" Language="C#" MasterPageFile="~/MasterPages/ManagementMaster.master" AutoEventWireup="true" CodeFile="Reviews.aspx.cs" Inherits="Management_Reviews" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True" 
                AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="Name" 
                DataValueField="Id">
                <asp:ListItem Value ="">Please make a selection</asp:ListItem>
            </asp:DropDownList>
            
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="Id" DataSourceID="SqlDataSource2">
                <Columns>
                    <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                        ReadOnly="True" SortExpression="Id" />
                    <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                    <asp:CheckBoxField DataField="Authorized" HeaderText="Authorized" 
                        SortExpression="Authorized" />
                    <asp:BoundField DataField="CreateDateTime" HeaderText="CreateDateTime" 
                        SortExpression="CreateDateTime" />
                </Columns>
            </asp:GridView>
            
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:PlantetWroxConnectionString1 %>" 
                
                SelectCommand="SELECT [Id], [Title], [Authorized], [CreateDateTime] FROM [Review] WHERE (([GenreId] = @GenreId) AND ([GenreId] = @GenreId2))" 
                DeleteCommand="DELETE FROM [Review] WHERE [Id] = @Id" 
                InsertCommand="INSERT INTO [Review] ([Title], [Authorized], [CreateDateTime]) VALUES (@Title, @Authorized, @CreateDateTime)" 
                UpdateCommand="UPDATE [Review] SET [Title] = @Title, [Authorized] = @Authorized, [CreateDateTime] = @CreateDateTime WHERE [Id] = @Id">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DropDownList1" Name="GenreId" 
                        PropertyName="SelectedValue" Type="Int32" />
                    <asp:ControlParameter ControlID="DropDownList1" Name="GenreId2" 
                        PropertyName="SelectedValue" Type="Int32" />
                </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="Id" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Title" Type="String" />
                    <asp:Parameter Name="Authorized" Type="Boolean" />
                    <asp:Parameter Name="CreateDateTime" Type="DateTime" />
                    <asp:Parameter Name="Id" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="Title" Type="String" />
                    <asp:Parameter Name="Authorized" Type="Boolean" />
                    <asp:Parameter Name="CreateDateTime" Type="DateTime" />
                </InsertParameters>
            </asp:SqlDataSource>
            
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:PlantetWroxConnectionString1 %>" 
                SelectCommand="SELECT [Id], [Name] FROM [Genre] ORDER BY [SortOrder]">
            </asp:SqlDataSource>
            
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
 
Old February 16th, 2011, 12:45 PM
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,

Did you do step 6 on page 406? That's the step where you click the blue Convert this Field into a Template Field link. Once you click that link, the BoundField changes into a TemplateField with an item and edit item template.

I just did that step with your source code and ended up with the templates as described.

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 February 16th, 2011, 02:33 PM
Registered User
 
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default [BegASP.NE​T3.5] Ch12 - TIO - Customizin​g GridView Controls p404 Step 9 & 10

Quote:
Originally Posted by Imar View Post
Hi there,

Did you do step 6 on page 406? That's the step where you click the blue Convert this Field into a Template Field link. Once you click that link, the BoundField changes into a TemplateField with an item and edit item template.

I just did that step with your source code and ended up with the templates as described.

Cheers,

Imar
Imar:
Thank you for the prompt reply.

Yes, I did click the "Convert this field into a TemplateField" for the Authorized field. I am working in Visual Studio 2008 Professional and when I clicked the above mentioned link all that happens is that the "CheckBoxField properties" on the right above the OK & Cancel buttons is converted to "TemplateFeild properties" and the area where you would expect to see the properties contains nothing and is only white. After I click OK and return to VWD and goto the Markup code I only see the code I sent you.

Am I missing something? Do I need to click on the "Refresh Schema" prior to clicking OK?

Your help is greatly appreciated.

Thanks
 
Old February 16th, 2011, 03:19 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Do I need to click on the "Refresh Schema" prior to clicking OK?
You shouldn't have to, but you could certainly try and see if it helps.

Otherwise, it's a bug (did you install the latest service pack for VS 2008?) which you could report to Microsoft at 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!
 
Old February 17th, 2011, 10:33 AM
Registered User
 
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
You shouldn't have to, but you could certainly try and see if it helps.

Otherwise, it's a bug (did you install the latest service pack for VS 2008?) which you could report to Microsoft at http://connect.microsoft.com

Cheers,

Imar
Imar:
Thanks for the help. I am not sure if it was the updates I downloaded and installed of the "Refresh Schema" but it fixed the problem. I am more inclined to think it is the updates though. I guess our Windows Update Server is not working so well for Windows 7 updates.....got to love computers.

Once again thanks for your help and the promptness of your replies. Both are greatly appreciated.

Enjoy the upcoming weekend!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch12 P406 & 423 - Can't see SQL Server ken evans BOOK: Beginning ASP.NET 4 : in C# and VB 18 January 7th, 2012 04:08 AM
Ch12, TIO p397: Exception in execution mkaftor BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 January 25th, 2011 04:57 AM
Chapter 12, Customizing GridView Columns Wilfredo Rosado BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 June 4th, 2010 03:46 PM
Ch8 - TIO#4 (Other List Controls) jecii BOOK: Beginning ASP.NET 2.0 and Databases 0 December 7th, 2007 07:57 PM
chapter 10 p404 veerle BOOK: Beginning ASP 3.0 2 September 23rd, 2003 04:41 AM





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