Nothing shows up at runtime

Posts   
 
    
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 06-Dec-2004 02:23:39   

I added the collections to my toolbox and dragged one on the form, then set the DataSource to the collection name (I'm doing ASP.NET, so I am blessed to only see the name once in the list).

At runtime nothing shows up. However, although it tells me that the build succeeds when I press F5, I notice this message in the task list:

 Method not found: SD.LLBLGen.Pro.ORMSupportClasses.IRetrievalQuery SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(SD.LLBLGen.Pro.ORMSupportClasses.IEntityFields, System.Data.IDbConnection, SD.LLBLGen.Pro.ORMSupportClasses.IPredicate, Int64, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression, SD.LLBLGen.Pro.ORMSupportClasses.IRelationCollection, Boolean, SD.LLBLGen.Pro.ORMSupportClasses.IGroupByCollection, Int32, Int32).

Oops, VS Studio just crashed. flushed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Dec-2004 09:58:02   

The same ORMSupportclasses library is referenced in both the asp.net project and your generated code?

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 06-Dec-2004 15:02:46   

Yes, the version numbers match (1.0.2004.1).

This morning I loaded the solution, and this message appears in the task list:

  The key 'Main.ConnectionString' does not exist in the appSettings configuration section.

VS is so odd at times. How would it know to generate a message like this? Why didn't it show this message yesterday? Why is it showing it now when I haven't even compiled anything? Weirdest of all is that this string is in my web.config file and of course app.config in the DAL project. Anyway, don't know if this has anything to do with my problem.

I do a rebuild solution, and the build succeeds, though this message stays in the task list. Then I run it, and again the grid doesn't show up.

Here's the complete code behind the form:

 using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using MetaBuilders.WebControls;
using SD.LLBLGen.Pro.ORMSupportClasses;
using Newmont.DAL;

namespace Newmont
{
    /// <summary>
    /// Summary description for Departments.
    /// </summary>
    public class Departments : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.DataGrid DepartmentList;
        protected System.Web.UI.WebControls.Button Add;
        protected System.Web.UI.WebControls.Button Edit;
        protected System.Web.UI.WebControls.Button Delete;
        protected Newmont.DAL.CollectionClasses.DepartmentsCollection departmentsCollection1;
        protected System.Web.UI.HtmlControls.HtmlInputHidden ClientMessage;
    
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
        
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {   
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Departments));
            this.departmentsCollection1 = new Newmont.DAL.CollectionClasses.DepartmentsCollection();
            // 
            // departmentsCollection1
            // 
            this.departmentsCollection1.AllowEdit = false;
            this.departmentsCollection1.AllowNew = true;
            this.departmentsCollection1.AllowRemove = false;
            this.departmentsCollection1.EntityFactoryToUse = ((SD.LLBLGen.Pro.ORMSupportClasses.IEntityFactory)(resources.GetObject("departmentsCollection1.EntityFactoryToUse")));
            this.departmentsCollection1.MaxNumberOfItemsToReturn = ((long)(0));
            this.departmentsCollection1.SortClauses = null;
            this.departmentsCollection1.SupportsSorting = false;
            this.departmentsCollection1.SuppressClearInGetMulti = false;
            this.departmentsCollection1.Transaction = null;
            this.departmentsCollection1.ValidatorToUse = null;
            this.Load += new System.EventHandler(this.Page_Load);
            this.departmentsCollection1.GetMulti(null);
        }
        #endregion
    }
}

And here's the grid HTML

            <asp:datagrid id=DepartmentList style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 16px" runat="server" BorderWidth="1px" BorderStyle="None" Height="374px" AllowPaging="True" BackColor="White" Width="375px" AutoGenerateColumns="False" PageSize="16" BorderColor="#3366CC" CellPadding="4" DataSource="<%# departmentsCollection1 %>" DataKeyField="DepartmentID">
                <FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="#CCFF99" BackColor="#009999"></SelectedItemStyle>
                <AlternatingItemStyle Font-Size="12px" Font-Names="Arial"></AlternatingItemStyle>
                <ItemStyle Font-Size="12px" Font-Names="Arial" ForeColor="#003399" BackColor="White"></ItemStyle>
                <HeaderStyle Font-Size="12px" Font-Names="Arial" Font-Bold="True" ForeColor="#CCCCFF" BackColor="#003399"></HeaderStyle>
                <Columns>
                    <mbrsc:RowSelectorColumn HeaderText="Sel" SelectionMode="Single">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </mbrsc:RowSelectorColumn>
                    <asp:BoundColumn DataField="DepartmentID" HeaderText="ID">
                        <HeaderStyle Width="50px"></HeaderStyle>
                    </asp:BoundColumn>
                    <asp:BoundColumn DataField="Department" HeaderText="Department">
                        <HeaderStyle Width="250px"></HeaderStyle>
                    </asp:BoundColumn>
                </Columns>
                <PagerStyle Visible="False" HorizontalAlign="Left" ForeColor="#003399" BackColor="#99CCCC" Mode="NumericPages"></PagerStyle>
            </asp:datagrid>

cry

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Dec-2004 15:43:25   

why didn't you put this line: this.departmentsCollection1.GetMulti(null); in the page_load handler?

Furthermore, you forgot the DataBind() call. simple_smile

When I simply call a GetMulti() in the Page_Load on a collection that's been dragged onto a webform and then grid.DataBind(); it works.

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 06-Dec-2004 16:02:19   

Otis wrote:

why didn't you put this line: this.departmentsCollection1.GetMulti(null); in the page_load handler?

Furthermore, you forgot the DataBind() call. simple_smile

I stuck that line there because that's where the other code was. And I forgot the DataBind() call because on my last two projects I never used data binding, I wrote all the code to fill controls with data.

I knew it had to be something obvious. Thanks for the quick support, Frans, as always! I have a demo in two hours and now I'm set. smile

By the way, I printed out the entire manual and I'm reading it cover to cover.

Jim

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Dec-2004 16:24:55   

Good luck with the demo simple_smile

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 07-Dec-2004 01:21:54   

OK, what's the equivalant action for typed lists?

I dragged a tl to my form and set my grid's datasource to it.

I do this in Page_Load:


           jobSearchResultsTypedList1.Fill();
           SearchResultsList.DataBind();

Then one of two things happens. Either jobSearchResultsTypedList1.Count returns 0 and nothing shows up (but there's no exception, I see the header row for the grid), or else it returns 3 (there are 3 records) and I get the exception

Object reference not set to an instance of an object

Sometimes jobSearchResultsTypedList1.Count returns 0 right after the call to Fill() executes, but then I can go execute it in the immediate window and it works, now Count() returns 3! It's hard to debug something when the behavior is not consistent. Any ideas?

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 07-Dec-2004 01:25:44   

Ha ha ha. I just created new form and new grid and repeated whole process and now it works. Now what do you think could be in my form that would cause all this odd behavior?

.NET is just so weird sometimes.......

Sorry to bother you, Frans.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 07-Dec-2004 10:20:38   

The asp.net designer has mysterious ways of doing things... (not only the asp.net designer. when you're working with custom controls on vb.net winforms, you're in for a lot of fun too... )

Frans Bouma | Lead developer LLBLGen Pro