- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Documentation for newbee - GridView
Joined: 21-Apr-2006
Well, i'm impressed with all the questions here.
As I'm new to LLBLGen i'm looking for a SIMPLE example
Who can point me toward the first steps, (I've completed a compile of the included LLBLGen project in my existing project.)
Preferably (for a website):
Show one database field on a webform. Or show one table via a GridView, so I know how to bind to a GridView.
Joined: 21-Apr-2006
Otis wrote:
Have you checked out the petshop project? (it's asp.net 1.1 but you'll get the idea)
No GridView in the Petshop.
Hmmm.... the learning curve of LLBLGen is a bit steeper than it needs to be I think.
Yes, you HAVE done a lot of work making it, and yes I do believe once you get the hang of it it does save a lot of time. But speaking from a didactic (is that English ?... didaktisch ) point of view the documentation needs some improvement.
I like the intro in the help file, and " read this first" 'n all that, the examples on your website is nice, and the book by Chancellor is nice.
But you REALLY have to be motivated to learn this stuff.
What i want to do is put ONE field from the database onscreen, and next ONE table using a GridView onto the screen. Generally I can learn the rest from there. But I really have a hard time finding this starting point. Even the chapters by Chancellor bury the simple stuff below a layer of non-relevant programming (non relevant to either asp.net or llblgen ).
Both the Petshop and the Chancellor book work like an obfuscator .... the simple example is there but you have to earn it.. go figure it out.
As you see I'm a bit irritated here...
on the positive side I would like to help out giving an easy to follow recipe once i get the hang of it myself. I KNOW it is a few lines of code (put the correct using on top of the file, call some DAL thing, bind to GridView, and show ) which is precisely the source of my irritation... the example SHOULD be there somewhere.
If in the meantime someone could point out a correct working short simple example for me(it's over there dummy , why didn't you look ?) I would be glad to stand corrected.
Ad wrote:
Otis wrote:
Have you checked out the petshop project? (it's asp.net 1.1 but you'll get the idea)
No GridView in the Petshop.
true, it's an asp.net 1.1 app. Gridview is .NET 2.0. We'll release the beta of v2 within a week or so and will release .NET 2.0 examples with the final. Things that miss at the moment in the 1.0.2005.1 release, are 2-way databinding in asp.net 2.0, declarative filtering with datasourcecontrols in asp.net 2.0 and other related material. You can do databinding, no problem, but it's done in the .net 1.1 way, hence my suggestion to check out the petshop app.
Hmmm.... the learning curve of LLBLGen is a bit steeper than it needs to be I think.
It's a massive amount of functionality so there is a learning curve, no question about that. Though, take it easy, most of the stuff is applyable in winforms and webforms. For example, fetching an entity collection, and binding it to a gridview in a code behind file, it's pretty easy: CustomerCollection customers = new CustomerCollection(); customers.GetMulti(null); myGridView.DataSource=customers; myGridView.DataBind();
thus the same as in .net 1.1. No design time databinding though, as everything changed in ASP.NET 2.0, and we've addressed that in our upcoming v2.
Yes, you HAVE done a lot of work making it, and yes I do believe once you get the hang of it it does save a lot of time. But speaking from a didactic (is that English ?... didaktisch ) point of view the documentation needs some improvement.
It's 350 printed pages, it's a lot of information. What lacks is more small tutorials. We've recently purchased a better tutorial video creator system and will work hard to provide these videos with the docs.
I like the intro in the help file, and " read this first" 'n all that, the examples on your website is nice, and the book by Chancellor is nice. But you REALLY have to be motivated to learn this stuff.
Yes, reading documentation isn't fun at times, and I know it can be dull to read through a concepts section before digging in. The documentation is layed out in such a way that you learn the background of the material with the material, so you'll understand why it's done that way and thus remember it better next time you run into it/need it.
But there's always room for improvement. Especially in the small tutorial department and small example department we're lacking, and we'll do everything we can to fix that in our new major release soon.
What i want to do is put ONE field from the database onscreen, and next ONE table using a GridView onto the screen. Generally I can learn the rest from there. But I really have a hard time finding this starting point. Even the chapters by Chancellor bury the simple stuff below a layer of non-relevant programming (non relevant to either asp.net or llblgen ).
Ok, first things first: there are two things: 1) the data fetch 2) the data display.
Part 1 is generic for whatever you use: winforms, console app, webapp... Part 2 depends on what your app is. So if you need to fetch a scalar value, e.g. the total of all orders for a customer, the code is exactly the same for winforms as for webforms, and you can for example use the winforms example to check how to fetch the total of an order.
I showed you 4 lines of code above to fetch the customers and bind them to a gridview control in asp.net 2.0 code behind (page load event). the fetch part is the same for all app techniques, the databinding is typical asp.net.
Could you elaborate a bit what you want to do so we can guide you in this? I think that's more constructive
Both the Petshop and the Chancellor book work like an obfuscator .... the simple example is there but you have to earn it.. go figure it out.
As you see I'm a bit irritated here...
Oh don't be Just relax a little, we're here to help you. We've 7 days a week coverage of these forums so there's always a person around to help you out. We know the examples can be hard to grasp at times for some people while not that hard for others (no offence to you, it can be the example illustrates it in a different way than you were expecting it and it then looks odd and hard to grasp), has nothing to do with the skills of the person but with the way the person expects it how it should be done and if it's done totally different the person often gets confused and fears he has to read the docs all over again...
on the positive side I would like to help out giving an easy to follow recipe once i get the hang of it myself. I KNOW it is a few lines of code (put the correct using on top of the file, call some DAL thing, bind to GridView, and show ) which is precisely the source of my irritation... the example SHOULD be there somewhere.
It's the same as in asp.net 1.x, so here I'll bind all customers from germany to a gridview.
webpage:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>
code behind:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Northwind.FactoryClasses;
using Northwind.HelperClasses;
using Northwind.DatabaseSpecific;
using SD.LLBLGen.Pro.ORMSupportClasses;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load( object sender, EventArgs e )
{
using( DataAccessAdapter adapter = new DataAccessAdapter() )
{
EntityCollection customers = new EntityCollection( new CustomersEntityFactory() );
RelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(CustomersFields.Country=="Germany");
adapter.FetchEntityCollection( customers, filter );
GridView1.DataSource = customers;
GridView1.DataBind();
}
}
}
I use adapter here, and if you use selfservicing, replace the using block with:
CustomerCollection customers = new CustomerCollection();
customers.GetMulti(CustomersFields.Country=="Germany");
GridView1.DataSource = customers;
GridView1.DataBind();
and at the top the using statement for databasespecific can be removed, instead add a using for Northwind.CollectionClasses.
In the web.config, the connection string has to be located:
<appSettings>
<add key="Main.ConnectionString" value="data source=your.server.here;initial catalog=Northwind;uid=*****;pwd=*****;persist security info=False;packet size=4096"/>
</appSettings>
as described in the manual.
If in the meantime someone could point out a correct working short simple example for me(it's over there dummy , why didn't you look ?) I would be glad to stand corrected.
Well, if I may, as you can see above, the only line which is asp.net specific is the GridView1.DataBind() call, the rest of the code is equal to the code described in the manual for fetching data.
Ad wrote:
Wow... what an elaborate response
... Thanks. So now i'm tempted to wait for the beta ...
You're welcome . You can get started with the current bits though. V2 builds on top of the current system, so if you're familiar with the current system, it helps
Anyway, this kind of response prompts me to actually buy LLBLGen
which is required to obtain the beta, right ?
Correct. V2 does require a new license though, however current customers will be able to upgrade for 49 euro per developer.