Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 26th, 2012, 11:37 AM
Authorized User
 
Join Date: Aug 2012
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default Chapter 13: Not seeing "Edit Columns" choice in SmartTasks Panel for Gridview

Hello again. The subject says it all. I would prefer not to just copy the provided code over from the downloadable code, because it contains stuff for the "reviews.aspx file I haven't gotten to yet. Below is myvcode, and below the code is also a LINK to a screenshot of my issue when seen in design view (this forum format does not allow for insertion of images so I did a screenshot). I have followed all instructions in the "Customizing Gridviews-Try it out " section to the best of my knowledge.

Code:
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PlanetWroxConnectionString1 %>" 
        
        SelectCommand="SELECT [Id], [Title], [Authorized], [CreateDateTime] FROM [Review] WHERE ([GenreId] = @GenreId)" 
        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">
        <DeleteParameters>
            <asp:Parameter Name="Id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="Authorized" Type="Boolean" />
            <asp:Parameter Name="CreateDateTime" Type="DateTime" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="GenreId" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
        <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>
    </asp:SqlDataSource>
And here is the link:
http://graysononline.net/miscFolder/noSelectColumn.png

Thanks again for your assistance.

W!

Last edited by wgrayson; August 26th, 2012 at 11:55 AM.. Reason: added [code] tags and additional information for clarity of post
 
Old August 26th, 2012, 12:44 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,

The image you linked to shows the Smart Tasks panel of the SqlDataSource, not that of the GridView. Maybe that's the problem?

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:
wgrayson (August 26th, 2012)
 
Old August 26th, 2012, 02:45 PM
Authorized User
 
Join Date: Aug 2012
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

A picture is worth a thousand words. For some reason I was unable to find the Smart Tasks Panel to GridView using Design View. However, I switched to Source /Markup view, highlighted the Gridview Code in markup, switched back to Design View, and I was able to see the Gridview Tab and open the Smart Tasks window. Thanks for a prompt reply.
 
Old August 26th, 2012, 02:48 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, it sometimes is hidden by the Smart Tasks panel arrow of the surrounding ContentPlaceHolder. Clicking the GridView twice in Design View usually makes it available, but your solution works fine as well.

Quote:
Thanks for a prompt reply.
You're welcome.

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:
wgrayson (August 26th, 2012)
 
Old August 26th, 2012, 04:43 PM
Authorized User
 
Join Date: Aug 2012
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

It appears that chapter 13 is giving me lots of trouble today. I finally worked through the "try it out/customizing grid views" section after your direction on how to see the smart tasks panel for Gridview. It's working fine, however, the CreateDateTime Field displays "A.D" for all dates. I also included the HtmlEncodeFormatString code in markup, with no success. As usual, here is the markup code:

Code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="Id" DataSourceID="SqlDataSource2">
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="Id" DataTextField="Title" 
                HeaderText="Title" DataNavigateUrlFormatString="AddEditReview.aspx?Id={0}" />
            <asp:TemplateField HeaderText="Authorized" SortExpression="Authorized">
                
                <ItemTemplate>
                    <asp:Label ID="AuthorizedLabel" runat="server" Text='<%# GetBooleanText(Eval("Authorized")) %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="CreateDateTime" HeaderText="CreateDateTime" HtmlEncodeFormatString = "True"
                SortExpression="CreateDateTime" DataFormatString="{0: g}" />
            <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
        </Columns>
    </asp:GridView>
 
Old August 26th, 2012, 05:26 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

A.d. is the era and is usually set with :gg. Try removing the space beteen the colon and the g and see if that helps.

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 26th, 2012, 08:15 PM
Authorized User
 
Join Date: Aug 2012
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default So, I have a big question - spaces??

Thank you. Removing the space between the ":" and the "g" fixed the error. But I thought compilers and HTML editors ignored spaces in code, and we added spaces just to make the code more human-readable.
 
Old August 27th, 2012, 04:30 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:
But I thought compilers and HTML editors ignored spaces in code, and we added spaces just to make the code more human-readable.
Indeed. But this not compiled code, nor HTML. This format string is parsed to determine the format used to display the date. Spaces are significant here as is other formatting and characters.

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:
wgrayson (August 27th, 2012)





Similar Threads
Thread Thread Starter Forum Replies Last Post
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
Chapter 13 pictureDetails.aspx "The resource cannot be found" Rudy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 November 24th, 2009 04:39 AM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM





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