Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
|
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
 
Old December 15th, 2014, 08:33 AM
Registered User
 
Join Date: Dec 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Post 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
 
Old December 15th, 2014, 12:22 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 axelle,

This could be a bug in Visual Studio. What happens when you try it again after a restart of VS?

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:
axelle (December 15th, 2014)
 
Old December 15th, 2014, 11:40 PM
Registered User
 
Join Date: Dec 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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
 
Old December 17th, 2014, 05:02 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
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 December 20th, 2014, 04:48 AM
Registered User
 
Join Date: Dec 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi, Imar,

According to your instructions, I've tried the following steps:

1.
Quote:
have you tried that?
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
 
Old December 21st, 2014, 11:29 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
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 February 25th, 2015, 01:53 AM
Registered User
 
Join Date: Feb 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting "margin-top" Attribute of <fo:region-body> ritagr XSLT 0 January 18th, 2013 05:37 PM
Can not find "intent-filter" code by default bcools BOOK: Beginning Android 4 Application Development 0 August 29th, 2012 04:31 PM
Base Page Problem with "safeitenames" carryover in the 'inherits" johnandrewmcknight BOOK: Beginning ASP.NET 4 : in C# and VB 3 April 22nd, 2011 04:08 PM
Differences between LinqDS and sqlDs with setting AppendDAtaBoundItems="true" on ddl robbaralla BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 November 28th, 2009 09:55 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.