 |
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
|
|
|
|

August 26th, 2012, 11:37 AM
|
Authorized User
|
|
Join Date: Aug 2012
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
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
|

August 26th, 2012, 12:44 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

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

August 26th, 2012, 02:48 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

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

August 26th, 2012, 05:26 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|

August 26th, 2012, 08:15 PM
|
Authorized User
|
|
Join Date: Aug 2012
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
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.
|

August 27th, 2012, 04:30 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|
 |
|