ASP.NET 2.0 GUI templates released! (beta) (Last updated: 09-jan-2007)

Posts   
1  /  2
 
    
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 08-Jan-2007 15:55:39   

UPDATED New build available (09-jan-2007).

We just released the first beta of our ASP.NET 2.0 GUI templates, which generate a complete database editor for adapter.

The archive is available in the 2.0 -> 3rd party section area in the customer area.

We've planned to ship the templates as an example on the public site as well as soon as the templates are out of beta.

Supported features

  • Entity insert/edit/delete/view.
  • viewing of related entities
  • Fields mapped onto related fields
  • Image/blob fields (insert / edit only)
  • filtering and searching.
  • sorting (client side sorting when fields mapped onto related fields are used)
  • pre-selecting of FK values when adding new entities.
  • Automatic paging
  • much more.

The generated code is a VS.NET 2005 website project and is ready to use.

Please read the enclosed readme for details how to use the templates, how to customize the templates and how to control the output of the templates through custom properties set in the LLBLGen Pro designer.

Bugs can be reported in the Template Studio and Custom Templates forum: http://www.llblgen.com/tinyforum/Threads.aspx?ForumID=19

The templates are for adapter, as adapter didn't have a proper ASP.NET example (Selfservicing has HnD wink ), though they're easy to port.

The templates are a proof of concept, and are also meant to get you started on your own GUI templates or to give you ideas how to generate certain pieces of code.

Enjoy! simple_smile


Changelog:

09-jan-2007: ADDED: Preset which combines Adapter general 2005 preset and DbEditor preset so just 1 preset has to be used to generate both DAL and GUI CHANGED: Switched off validation of request in the Page element of AddNew.aspx, EditExisting.aspx and ListSubset.aspx to allow Xml and other texts to be specified without getting a server error. FIXED: When a DateTime field was part of the PK, the Search control wasn't properly generated: the code behind referred to a textbox control while a datetime field is generated as a DateTextBox. FIXED: TextArea controls which were mandatory, weren't shown with a themed different background color. FIXED: Mandatory DateTime fields weren't validatable, because the DateTextBox control lacked a proper validator property. FIXED: In the search form for subset search, a non-nullable datetime field were shown as datetextboxes with the background color for required fields, and the field itself was marked as required as well. FIXED: GUID pk's weren't usable in a search (for example for 'Edit Existing'), as the code behind file for the search control has incorrect code for converting the string to a normal GUID. Also added: code to make the code compilable for entities with a PK which is a byte[]. FIXED: Entities without a PK still got edit/delete functionality generated which was leading to non-compilable code or a badly functioning application. FIXED: If a subset of the entities in the project is used to generate the code, the templates were still referring to all entities in the project, instead of using the selected subset.

Frans Bouma | Lead developer LLBLGen Pro
jbb avatar
jbb
User
Posts: 267
Joined: 29-Nov-2005
# Posted on: 08-Jan-2007 17:04:04   

Thank's a lot for your nice work!

Now it's time to test it!!simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 08-Jan-2007 17:23:19   

Thanks! simple_smile

I'm pretty sure silly things will pop up, so please post the issues you run into in the templates forum so I can address them a.s.a.p. simple_smile .

Frans Bouma | Lead developer LLBLGen Pro
asn
User
Posts: 2
Joined: 29-Dec-2006
# Posted on: 08-Jan-2007 18:59:43   

Works great for me... this is really going to be helpful!

Thanks,

Adam

swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 08-Jan-2007 19:31:39   

Great stuff!

However, this code fails with message: {"Invalid cast from 'System.String' to 'System.Guid'."}

    public PredicateExpression CreateFilter(NameValueCollection queryString)
    {
        PredicateExpression toReturn = new PredicateExpression();
        string valueFromQueryString = null;
        valueFromQueryString = queryString["Newsgroupid"];
        if(valueFromQueryString!=null)
        {
            toReturn.AddWithAnd(NewsgroupFields.Newsgroupid==(System.Guid)Convert.ChangeType(valueFromQueryString, typeof(System.Guid)));
        }

        return toReturn;
    }

The exception occurs on the line:

toReturn.AddWithAnd(NewsgroupFields.Newsgroupid==(System.Guid)Convert.ChangeType(valueFromQueryString, typeof(System.Guid)));

It's in the Controls/Search[EntityType].ascx.cs file. It seems to occur when trying to find the entity by the primary key when the PK is a Guid. [Edit: FYI, it occurs on all entities whose PK is a Guid.] Upon debugging, I can see that the string valueFromQueryString contains a correct Guid string of a valid PK.

Also, if I had a recommendation, it would be that you include a section in the web.config for those key values that control the database version for MSSQL, then comment it out like you did the trace switches. I want to pick up the paging features from 2005, and it would be handy to have it pre-generated in the web.config.

swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 08-Jan-2007 19:40:42   

Another exception:

Control 'dtxRetrieveddatetime' referenced by the ControlToValidate property of 'reqRetrieveddatetime' cannot be validated. 

Occurs in the AddNew.aspx, on any entity that has a date type.

Stack trace:

[HttpException (0x80004005): Control 'dtxLastretrieved' referenced by the ControlToValidate property of 'reqLastretrieved' cannot be validated.]
   System.Web.UI.WebControls.BaseValidator.CheckControlValidationProperty(String name, String propertyName) +1793781
   System.Web.UI.WebControls.BaseValidator.ControlPropertiesValid() +37
   System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +33
   System.Web.UI.Control.PreRenderRecursiveInternal() +77
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

Very little to go on here. The AddNew.aspx.cs code gets through the Page_Load without issues, and the exception occurs sometime after that. I hope it makes sense to you. My suspicion is that you're adding a validator and something's going wrong. It's a brilliant conclusion, I know.

FYI on the little stuff: MS-SQL 2005 w/SP1, Generated for Adapter, C#, ASP.NET 2.0 on VS 2005 w/SP1, Lipton's Orange Pekoe 1.0 in a Green Cup.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 08-Jan-2007 20:31:46   

About that second exception: is the date-time field non-nullable?

About the guid PK: I'll check that with my guid test db schema simple_smile

Frans Bouma | Lead developer LLBLGen Pro
swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 08-Jan-2007 23:00:03   

Otis wrote:

About that second exception: is the date-time field non-nullable?

About the guid PK: I'll check that with my guid test db schema simple_smile

Yes, the datetime column is non-nullable (allow nulls = false), with a default value of getdate().

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 08-Jan-2007 23:24:45   

This appears in the edit control. I believe this problem occurs when the entity has no PK?


if(entityToProcess != null)
{
// store the PK values so a redirect can use these. 

_pkValuesAfterInsert = ;
}

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 08-Jan-2007 23:40:38   

Hmm. I'm struggling to get a project to compile. At first I started with all entities in my project, but after getting the previous error I posted, I trimmed it down to a single entity.

Now I am getting all kinds of errors in the file "ViewRelatedTo<EntityName>" in code such as this:


    <tr>
        <td class="content">
            <dbeditor:ProjectBacklogForecastNoteInstances ID="laProjectBacklogForecastNote" runat="server" ShowHomeButton="false" />
            <br><br>
        </td>
    </tr>

Error 54 Unknown server tag 'dbeditorstuck_out_tongue_winking_eye rojectBacklogForecastNoteInstances'. C:\Documents and Settings\psandler\Desktop\WMProject\4.0.0_ENHANCEMENTS\src\app\ WMProject.DAL\GUI\Controls\ViewRelatedToPerson.ascx 222

and up at the top of the page like:


<%@ Register TagPrefix="dbeditor" TagName="ProjectInstances" Src="ListProjectInstances.ascx"%>

Error 123 File 'ListProjectInstances.ascx' was not found. C:\Documents and Settings\psandler\Desktop\WMProject\4.0.0_ENHANCEMENTS\src\app\ WMProject.DAL\GUI\Controls\ViewRelatedToCity.ascx 11 67 C:...\GUI\

Hopefully that is enough information.

Is it required that each entity used includes all of its related entities (even m:n)? Am I doing something else wrong?

Thanks,

Phil

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Jan-2007 10:04:39   

Thanks for the issue reports! I think I know why these happen (read: sloppyness on my part) so I'll address them today, and also fix some other small issues. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Jan-2007 11:36:30   

I fixed the date validation issue by adding the following to the DateTextBox.ascx.cs file:

at the top: [ValidationProperty("Text")]

and in the property area:


    /// <summary>
    /// Gets the value as text, which means it will return the date in short date format. If the date is invalid, it will return an empty string. 
    /// Use this property for validators. Use the Value property for obtaining the value. 
    /// </summary>
    public string Text
    {
        get
        {
            Nullable<DateTime> toReturn = ProduceDateValue();
            if(toReturn.HasValue)
            {
                return toReturn.Value.ToShortDateString();
            }
            else
            {
                return string.Empty;
            }
        }
    }

I'm now testing with AdventureWorks, it reveals a lot of small issues. Working on them to get a new build out later today simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Jan-2007 13:55:11   

Still a silly thing: in AddNew more, the ModifiedDate field's DateTextBox is validated properly when I press the submit button. However when I leave the DateTextBox fields clear in the EditExisting form, the validator is never called! The 'Text' property of the DateTextBox isn't read in the EditExisting form, while it is in the AddNew form. I checked everything a gazillion times, there's no typo, etc... disappointed

I give up on that now, unless someone knows what's wrong. I even store the ValidationGroup in the viewstate, no dice... The difference perhaps is that the EditExisting.aspx form gets a postback from the search control, then hides that control and shows the edit control. However all the other control' validators do work (client side)....

Frans Bouma | Lead developer LLBLGen Pro
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 09-Jan-2007 16:04:27   

Incidentally, how hard would this be to port to VB?

Thanks,

Phil

PilotBob
User
Posts: 105
Joined: 29-Jul-2005
# Posted on: 09-Jan-2007 16:20:50   

Otis wrote:

Still a silly thing: in AddNew more, the ModifiedDate field's DateTextBox is validated properly when I press the submit button. However when I leave the DateTextBox fields clear in the EditExisting form, the validator is never called! The 'Text' property of the DateTextBox isn't read in the EditExisting form, while it is in the AddNew form. I checked everything a gazillion times, there's no typo, etc... disappointed

I give up on that now, unless someone knows what's wrong. I even store the ValidationGroup in the viewstate, no dice... The difference perhaps is that the EditExisting.aspx form gets a postback from the search control, then hides that control and shows the edit control. However all the other control' validators do work (client side)....

Do you have a requiredfield validator and a data type validator? I find I have to use both of those on dates the are required. Just have a data type doesn't do anything if you don't type anything into the field... it is considered valid if empty in that case.

BOb

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Jan-2007 17:32:19   

psandler wrote:

Incidentally, how hard would this be to port to VB? Thanks, Phil

Probably an afternoon, but I'm not going to do it. simple_smile (as keeping templates in sync in VB.NET is a pain)

PilotBob wrote:

Otis wrote:

Still a silly thing: in AddNew more, the ModifiedDate field's DateTextBox is validated properly when I press the submit button. However when I leave the DateTextBox fields clear in the EditExisting form, the validator is never called! The 'Text' property of the DateTextBox isn't read in the EditExisting form, while it is in the AddNew form. I checked everything a gazillion times, there's no typo, etc... disappointed

I give up on that now, unless someone knows what's wrong. I even store the ValidationGroup in the viewstate, no dice... The difference perhaps is that the EditExisting.aspx form gets a postback from the search control, then hides that control and shows the edit control. However all the other control' validators do work (client side)....

Do you have a requiredfield validator and a data type validator? I find I have to use both of those on dates the are required. Just have a data type doesn't do anything if you don't type anything into the field... it is considered valid if empty in that case.

No, I have a custom control with 3 textboxes. The control has a ValidatorProperty attribute and a property (defined by the attribute) which is called 'Text' which is solely used for validation (i.e. it returns the date in string format if there's a valid date, otherwise an empty string). The lame thing is: if the formview is in INSERT mode, the required field validator indeed calls the 'Text' property when the postback occurs, and validation works as expected. In EDIT mode however, the Text property is never read, still the validator is 'valid' (checked in the debugger). So hte validator apparently doesn't check properly..

I hope to have updated templates within the hour or so so you can check it out yourself. simple_smile

I hope someone with l33t ASP.NET skills can help me with this error because I'm out of options. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 09-Jan-2007 19:19:59   

Uploaded a new build. See startpost for changelog simple_smile More issues are logged: - Abstract entities still get an editor generated (LDBT-275) - DbGeneric/Specific name settings aren't used in templates (LDBT-271) - Web.config should get db specific settings generated as commented out code (LDBT-270)

Frans Bouma | Lead developer LLBLGen Pro
p3mek
User
Posts: 68
Joined: 19-Feb-2007
# Posted on: 19-Feb-2007 02:21:48   

Hi Otis

I'm having trouble generating code using the Beta version of your DBEditor template. LLBLGen version: 2.0.0.0 Final

When I GENERATE using the "[b]SD.Presets.Adapter.General2005WithDbEditor[/b]" preset, the

Log Viewer shows that the FileCreators task failed and displays the following information (this is just a part of the output, the entire 'FileCreators" task seems to fail: Task SD.Tasks.Adapter.DbEditor.DefaultThemeCode Could not find template 'SD_DefaultThemeCss'. It is not defined in any of the bindings specified. Task SD.Tasks.Adapter.DbEditor.AppCodeGeneralUtils Could not find template 'SD_AppCodeGeneralUtils'. It is not defined in any of the bindings specified. Task SD.Tasks.Adapter.DbEditor.DeleteExistingCode Could not find template 'SD_DeleteExistingCode'. It is not defined in any of the bindings specified.

From my experience, I can safely guess that I have missed something trivial, could you point me in the right direction.

Have I missed something really obvious?

michael Mackowiak

p3mek
User
Posts: 68
Joined: 19-Feb-2007
# Posted on: 19-Feb-2007 02:54:22   

As I wrote in my previous post, I'm sure it's something obvious... For the use of anyone else having this issue. Make sure your project is set to C# as this is a C# template and not VB.NET.

Works like a charm...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 19-Feb-2007 10:08:16   

Yes, the templates are for C#, and the COMBINED preset uses dbeditor + dal templates of the same target language. As you selected VB.NET, the code generator will look for VB.NET specific templates of the dbeditor, but these aren't there.

So if you're using VB.NET, first use the normal adapter preset, then generate the dbeditor code using the dbeditor preset (so not the combined one) and choose C#.

Frans Bouma | Lead developer LLBLGen Pro
p3mek
User
Posts: 68
Joined: 19-Feb-2007
# Posted on: 19-Feb-2007 13:57:42   

The editor templates were to act as a 'cheat sheet' and help me with some messy relationships and syntax to use in my actual project, however, I noticed that the code generated didn't bind the combo boxes according to their relationships.

anyways ...back to hackin' away

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 19-Feb-2007 14:11:47   

p3mek wrote:

The editor templates were to act as a 'cheat sheet' and help me with some messy relationships and syntax to use in my actual project, however, I noticed that the code generated didn't bind the combo boxes according to their relationships.

What exactly do you mean? You have to specify a custom property as stated in the readme to get the comboboxes, otherwise no comboboxes are generated.

Frans Bouma | Lead developer LLBLGen Pro
p3mek
User
Posts: 68
Joined: 19-Feb-2007
# Posted on: 19-Feb-2007 14:38:09   

What exactly do you mean? You have to specify a custom property as stated in the readme to get the comboboxes, otherwise no comboboxes are generated.

Ahhh YES, the README... simple_smile

We do things a little differently here "Down Under" wink

Actually. I've spent all day going through the docs today but couldn't figure out where you would use the custom properties. Still getting my head around the Typed Lists/Views. I assumed(incorrectly) that the editor templates would produce a complete set of auto populated comboboxes as a generic editor. (e.g. customer A has a combobox of related orders). I guess this is a bad example and you might prefer a grid, hence, no combobox.

ATXOOM
User
Posts: 2
Joined: 20-Feb-2007
# Posted on: 20-Feb-2007 12:05:50   

Hi,

I tried to set up these templates (to have a look to a good way to use LLBLGen). It works fine but I've been due to replace a lot of:

ValidationExpression="\+?(\d) CssClass="required""

by

ValidationExpression="\+?(\d)" CssClass="required"

Didier

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 20-Feb-2007 13:04:58   

In which controls/classes/forms do these occur?

Frans Bouma | Lead developer LLBLGen Pro
1  /  2