 |
BOOK: Beginning ASP.NET 4.5 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4.5 : 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
|
|
|
|

December 15th, 2014, 08:33 AM
|
Registered User
|
|
Join Date: Dec 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Ch13: Problem with "Setting up the Filter" P467
Hi, Imar
Thanks for your great books and this helpful forum. And now I got stuck at chapter 13 for a few days.
When I worked with the last "try it out" on page 463 using the DetailsView control to insert data, i got the same problem as waysgoose did, Problems with DetailsView (Ch. 13), i followed your instructions and solved it at last.
Right now, I'm having a problem again in setting up a filter. Util step 7, everything is Ok and i got the result as figure 13-8. But in step 8, when I return to the Data Source Configuration Wizard, it seems that no sqldatasource has been created. There is no data source to be selected and the code looks like this:
Code:
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem>Make a selection</asp:ListItem>
</asp:DropDownList>
</asp:Content>
Finally I add the rest code manually in accordance with the code in step 10 on page 469, and open the file Reviews.aspx in the browser. It works well!
But I'm still wondering what the problem is.
Thanks for your help,
axelle
|

December 15th, 2014, 12:22 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi axelle,
This could be a bug in Visual Studio. What happens when you try it again after a restart of VS?
Imar
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

December 15th, 2014, 11:40 PM
|
Registered User
|
|
Join Date: Dec 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
Thanks for your quick response.
I tried the following steps:
1. After I restarted VS and got the same result;
2. I added code manually listed in step 10 on page 469 and got the correct result;
3. I continued the next "try it out" : Applying the Filter and succeded.
4. But I ran into trouble again with the new "try it out": Customizing GridView Columns on page 474. In step 2, I opened the Smart Tasks panel for the GridView and clicked on the Edit Columns, after a flash, the Fiedls Dialouge Box didn't show up.
What's wrong? should I refresh schema on DropDownList and GridView? Could you please give me some hint?
Thanks a lot,
axelle
Last edited by axelle; December 15th, 2014 at 11:41 PM..
Reason: typo
|

December 17th, 2014, 05:02 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
should I refresh schema on DropDownList and GridView?
|
Yes, have you tried that?
Most issues I have with the data controls are solved by making sure the data source is refreshed and in sync with the database.
Otherwise, I don't know what to recommend. Are you sure your tables and database are all set up correctly?
Imar
|

December 20th, 2014, 04:48 AM
|
Registered User
|
|
Join Date: Dec 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Hi, Imar,
According to your instructions, I've tried the following steps:
1.
Yes, I've tried refreshing schema in all the controls: SqlDataSource1, DropDownList(on page 467 "Setting up the filter), SqlDataSource2, GridView (on page 473 "Customizing GridView Columns"), unfortunately nothing has changed.
2.
Quote:
Are you sure your tables and database are all set up correctly?
|
I've checked the Database, the Primary Keys for the both tables and the Diagrams Relationship. They are OK. And the tables are created with the file "Create Planet Wrox Database.sql" .
3. I've even endeavored to do all the operations from the start of chapter 13, but the problems are still there.
4. I've also googled and baidued on the internet with the keywords "GridView, Edit Column, flash"(in chinese), finding that there are 3 results similar to mine. but all of them are without solutions.
5. I'm wondering that this problem may be related to the properties or events about the GridView. But I can't tell it clearly right now.
By the way, the code of Reviews.aspx are as follows:
Code:
<%@ Page Title="Planet Wrox - Management - Reviews" Language="C#" MasterPageFile="~/MaterPages/Management.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:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" AppendDataBoundItems="True" DataTextField="Name" DataValueField="Id">
<asp:ListItem Value="">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: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>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PlanetWroxConnectionString1 %>" SelectCommand="SELECT [Id], [Name] FROM [Genre] ORDER BY [SortOrder]"></asp:SqlDataSource>
</asp:Content>
6. I'm prepared to skip this "try it out" on GridView column and continue this book.
Anyway, Thank you very much!
axelle
|

December 21st, 2014, 11:29 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Can you make a download available somewhere with the database and the *minimum amount of files needed to reproduce the problem*? In other words, try deleting as much stuff as possible so I don't have to wade through it in order to make it work. If you can bring the application in a state up to the point where the book differs from what you're seeing, I'll take a look and see if I can run into the same issue. If I don't, it may be a bug in VS.
Cheers,
Imar
|

February 25th, 2015, 01:53 AM
|
Registered User
|
|
Join Date: Feb 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
please make your first post by asking your question in the right forum for the question. Or become part of the community by providing a useful answer to someone else's question.???
|
|
 |
|