Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Display Modes
  #1 (permalink)  
Old August 26th, 2012, 11:37 AM
Authorized User
Points: 80, Level: 1
Points: 80, Level: 1 Points: 80, Level: 1 Points: 80, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #2 (permalink)  
Old August 26th, 2012, 12:44 PM
Imar's Avatar
Wrox Author
Points: 71,632, Level: 100
Points: 71,632, Level: 100 Points: 71,632, Level: 100 Points: 71,632, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,013
Thanks: 79
Thanked 1,576 Times in 1,553 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
wgrayson (August 26th, 2012)
  #3 (permalink)  
Old August 26th, 2012, 02:45 PM
Authorized User
Points: 80, Level: 1
Points: 80, Level: 1 Points: 80, Level: 1 Points: 80, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #4 (permalink)  
Old August 26th, 2012, 02:48 PM
Imar's Avatar
Wrox Author
Points: 71,632, Level: 100
Points: 71,632, Level: 100 Points: 71,632, Level: 100 Points: 71,632, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,013
Thanks: 79
Thanked 1,576 Times in 1,553 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
wgrayson (August 26th, 2012)
  #5 (permalink)  
Old August 26th, 2012, 04:43 PM
Authorized User
Points: 80, Level: 1
Points: 80, Level: 1 Points: 80, Level: 1 Points: 80, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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>
Reply With Quote
  #6 (permalink)  
Old August 26th, 2012, 05:26 PM
Imar's Avatar
Wrox Author
Points: 71,632, Level: 100
Points: 71,632, Level: 100 Points: 71,632, Level: 100 Points: 71,632, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,013
Thanks: 79
Thanked 1,576 Times in 1,553 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!
Reply With Quote
  #7 (permalink)  
Old August 26th, 2012, 08:15 PM
Authorized User
Points: 80, Level: 1
Points: 80, Level: 1 Points: 80, Level: 1 Points: 80, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #8 (permalink)  
Old August 27th, 2012, 04:30 AM
Imar's Avatar
Wrox Author
Points: 71,632, Level: 100
Points: 71,632, Level: 100 Points: 71,632, Level: 100 Points: 71,632, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,013
Thanks: 79
Thanked 1,576 Times in 1,553 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
wgrayson (August 27th, 2012)
Reply


Thread Tools
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
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 04: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 03: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



All times are GMT -4. The time now is 01:09 AM.


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