Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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>
Reply With Quote
  #2 (permalink)  
Old February 16th, 2011, 12:45 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
Old February 16th, 2011, 03:19 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #5 (permalink)  
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!!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.