CodeSmith Community
Your Code. Your Way. Faster!

Better admin screens for data

Latest post 12-18-2006 5:13 PM by jstuart. 21 replies.
  • 09-12-2006 8:10 AM

    • NickG
    • Not Ranked
    • Joined on 09-12-2006
    • Posts 3
    • Points 115

    Better admin screens for data

    Hi,

    I've seen that .netTiers generates some admin webpages for updating data. However for most typical tables, they dont' work very well as they don't recognise relations (and replace textboxes with dropdowns) and they also perform editing within a datagrid (something I hate with a passion as it only really works if you never have more than about 4 columns in your tables).

    Are there any existing extensions to .netTiers that would allow me to generate a more useable set of admin pages or would I have to just write some new templates myself?

    Thanks,

    Nick....
    • Post Points: 45
  • 09-12-2006 9:22 AM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 726
    • Points 16,910

    Re: Better admin screens for data

    Hi Nick,

     

    We are planning to improve/enhance admin part of the templates by encapsulating CRUD operations on the entity into WebUserControls.

     

    Here how relations between entities are used:

    1. Column is FK (1:n relation): control rendered as DropDownList

    2. Column type is Boolean: control rendered as RadioButtonList with Yes/No values

    3. Column type string with fixed length: control rendered as TextBox (if length is greater then 255 then control textmode is set to Multiline (i.e. textarea))

    4. Column type date: control rendered as textbox with custom calendar control.

    5. Column used in m:n releation: control rendered as CheckBoxList

     

     

    As far as inline record editing in the GridView, I agree most of the time this functionality is not practical, but it could be easily turned off:

    <asp:CommandField ShowSelectButton="True" ShowEditButton="False" />

     

    There are other templates that produce Admin controls (those are older versions), they are the same with respect to how relation works (I believe Confused [8-)]).

    Mike Shatny
    --------------------------------------------------------------
    Member of the .netTiers team http://www.nettiers.com
    --------------------------------------------------------------

    • Post Points: 65
  • 09-12-2006 9:36 AM In reply to

    • NickG
    • Not Ranked
    • Joined on 09-12-2006
    • Posts 3
    • Points 115

    Re: Better admin screens for data

    I hadn't realised the "Select" link already did what I wanted - DOH!

    With regards to the numbered points in your post, I presume you're saying that's how it will work in the future, despite the "here's how... are used" implying the present? Because I don't see it behaving like that currently.

    I've only found CodeSmith today, so I'm not really familiar with what's possible yet, but it looks like it could be VERY useful to me and the .netTiers templates look almost exactly what I was after.

    Another unrelated question:

    My tables names are plurals. Ie Products, ConnectionTypes, etc. It has therefore generated plural names in the code for things which are really singular. For example, I've ended up with:
    project.Entities.Products instead of Entities.Product to represent a Product. Is there any way to fix this?

    Thanks,

    Nick...
    • Post Points: 35
  • 09-12-2006 10:09 AM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 726
    • Points 16,910

    Re: Better admin screens for data

    Nick,

    Yes, that is how it works presently.

    To your other question. You could use alias file to specify alias name for the class to every table:

    tablename:classname
    tablename:classname

    Mike Shatny
    --------------------------------------------------------------
    Member of the .netTiers team http://www.nettiers.com
    --------------------------------------------------------------

    • Post Points: 35
  • 09-12-2006 10:23 AM In reply to

    • NickG
    • Not Ranked
    • Joined on 09-12-2006
    • Posts 3
    • Points 115

    Re: Better admin screens for data

    mike123 wrote:
    Yes, that is how it works presently.


    Hmm. That's odd. It's not working for me. I only see plain TextBoxes for everything - even integer columns which are FK for other tables. I've checked that all the relations are setup correctly in the database. Is there something I need to turn on or configure for this to work. Is this on the datagrid or on the EntityEdit.aspx page?



    • Post Points: 35
  • 09-12-2006 10:43 AM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 726
    • Points 16,910

    Re: Better admin screens for data

    I'd say the same that is odd. If you could script couple of tables that are referenced along with Primary Keys, Foreign Keys, Constraints i'd be willing to take a look.

    you could pm me or send it to my yahoo account: mshatny

    Mike Shatny
    --------------------------------------------------------------
    Member of the .netTiers team http://www.nettiers.com
    --------------------------------------------------------------

    • Post Points: 5
  • 09-12-2006 10:06 PM In reply to

    • Alex
    • Top 10 Contributor
    • Joined on 07-26-2005
    • Australia, Canberra
    • Posts 526
    • Points 10,645

    Re: Better admin screens for data

    Hi Mike, latest version of new admin pages works much better!

    Btw: There is no way to delete record at this moment?

    Also, export to Excel should not export first column with 'Edit Select'...

    It would be really cool if we can have the same nice Filter panel as we have in old one?

    Though I'm not sure how difficult to implement it using new style...

    Thanks for great work!
    Best regards,
    Alex.
    • Post Points: 35
  • 09-13-2006 4:12 PM In reply to

    Re: Better admin screens for data

    The datagridview has Eidt and Select but NO DELETE link. Is there a way to get that enabled/generated?

    • Post Points: 35
  • 09-13-2006 4:25 PM In reply to

    • mcquiggd
    • Top 25 Contributor
    • Joined on 07-11-2006
    • Amsterdam
    • Posts 174
    • Points 4,375

    Re: Better admin screens for data

     

    Erm, it has to be said, it is rather easy to do that in Visual Studio, just change the CommandColumn (first one in the Grid) and check the boxes for whatever linkbuttons (as they are by default) to include whatever functions you want - personally I just change the Command Column to a Template Column, and paste in in the sytnax for a standard set of code, which consists of two lines that gives me css styled buttons. Some don't need it, so I havent changed the .NetTiers template. 

    One of the reasons I use a Template Column instead of a command column is to include a javascript confirmation dialogue for deletes. I don't do inline editing - I use a seperate page for that.

    David (Could people PLEASE click the 'Mark As Answer' button on the message that solved their problems - it will help others with similar questions and could potentially be included in an FAQ to save time for all of us)
    • Post Points: 35
  • 09-14-2006 6:44 PM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 726
    • Points 16,910

    Re: Better admin screens for data

    Adding the delete link to the grid column wouldn't be a problem, the idea not to have it displayed in the first place, is that it is not a commonly used functionality, but if developer really thinks it is necessary, it would really easy to add this link manually (ShowDeleteButton="true", deleting records already supported by the TypedDataSource controls). Anyway ... i agree it'd be very useful to have grid filter functionality, like we previously had (that is something we've been working on).

     

    Good point, Alex (regarding the export of the CommandField to excel, that shouldn’t have happening), I’ll look into this.

    Mike Shatny
    --------------------------------------------------------------
    Member of the .netTiers team http://www.nettiers.com
    --------------------------------------------------------------

    • Post Points: 35
  • 09-15-2006 2:38 AM In reply to

    • Alex
    • Top 10 Contributor
    • Joined on 07-26-2005
    • Australia, Canberra
    • Posts 526
    • Points 10,645

    Re: Better admin screens for data

    Thanks, great, probably using new cool Filtering classes it would be easier to write Filtering by default? I also think that Grouping of data would be greate addition, but have no idea how can this be implemented. I've been looking at Vista explorer interface and it has great grouping and filtering features...
    Best regards,
    Alex.
    • Post Points: 35
  • 09-20-2006 11:01 AM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 726
    • Points 16,910

    Re: Better admin screens for data

     [edit] the BusinessEntityType is no longer required

     

    So that everyone is aware, there have been a new addition to the controls toolbox, that is GridViewSearchPanel control, which an extension to the GridView, that is bind to the TypedDataSource controls. To add it to your page simply declare it as following:

     

     <data:GridViewSearchPanel runat ="server" ID="SearchPanel" GridViewControlID="GridView1" BusinessEntityType="Northwind.Entities.Products " />

     

    GridViewControlID: is the Control Id of your GridView or EntityGridView controls.

    BusinessEntityType: Business entity of the TypedDataSource that is based on.


    Mike Shatny
    --------------------------------------------------------------
    Member of the .netTiers team http://www.nettiers.com
    --------------------------------------------------------------

    • Post Points: 45
  • 10-07-2006 7:48 AM In reply to

    Re: Better admin screens for data

    Hi,

       Have tried to implement the Search Panel into my Web Application but it doesn't seem to do anything, is their any other special configuration that is required???

     

    Regards..

     

    Peter..

     

    • Post Points: 35
  • 10-07-2006 9:41 AM In reply to

    • mike123
    • Top 10 Contributor
    • Joined on 02-25-2005
    • Toronto, Ontario
    • Posts 726
    • Points 16,910

    Re: Better admin screens for data

    Do you get the panel rendered on the page? Can you post a code sample?

    Annandale:

    Hi,

       Have tried to implement the Search Panel into my Web Application but it doesn't seem to do anything, is their any other special configuration that is required???

     

    Regards..

     

    Peter..

     

    Mike Shatny
    --------------------------------------------------------------
    Member of the .netTiers team http://www.nettiers.com
    --------------------------------------------------------------

    • Post Points: 35
  • 10-07-2006 7:32 PM In reply to

    Re: Better admin screens for data

    Mike,

           Yes the panel renders on the page okay, just doiesn't seem to work in runtime. If I enter a search value for a specified field it doesn't seem to return any results.. Have posted my code below..

     

    <Code>

    <body>
        <form id="form1" runat="server">
            <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
            <div>
                <atlas:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <data:GridViewSearchPanel GridViewControlID="EntityGridView1"  runat ="server" ID="SearchPanel" BusinessEntityType="WebMORT.Entities.VwFuneralsAll"  />
                        <data:EntityGridView id="EntityGridView1" runat="server" AllowPaging="True" DataSourceID="myFun" AllowExportToExcel="False" AllowMultiColumnSorting="True" CellPadding="4" DefaultSortDirection="Ascending" ExportToExcelText="Excel" ForeColor="#333333" PageSelectorPageSizeInterval="15" AllowSorting="True" AutoGenerateColumns="False" DataMember="DefaultView" DefaultSortColumnName="LASTNAME" Font-Names="Times New Roman" Font-Size="Small" PageSize="15" Width="688px">
                            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#7C6F57" />
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:CommandField ShowSelectButton="True" />
                                <asp:BoundField DataField="CODE" HeaderText="CODE" SortExpression="CODE" />
                                <asp:BoundField DataField="LASTNAME" HeaderText="Last Name" SortExpression="LASTNAME" />
                                <asp:BoundField DataField="Name" HeaderText="First/Middle" SortExpression="Name" />
                                <asp:BoundField DataField="TYPE" HeaderText="Type" SortExpression="TYPE" />
                                <asp:BoundField DataField="NUMBER" HeaderText="Number" SortExpression="NUMBER" />
                            </Columns>
                            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                            <RowStyle BackColor="#E3EAEB" />
                            <PagerSettings Mode="NumericFirstLast" />
                        </data:EntityGridView>
                        <data:VwFuneralsAllDataSource ID="myFun" SelectMethod="GetPaged" EnablePaging="true" EnableSorting="true" runat="server" EnableTransaction="True">
                          <Parameters>               
                            <data:CustomParameter ConvertEmptyStringToNull="false" Name="WhereClause" />

                            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
                            <asp:CONTROLPARAMETER ControlID="EntityGridView1" Name="PageIndex" PropertyName="PageIndex" Type="Int32" />
                            <asp:CONTROLPARAMETER ControlID="EntityGridView1" Name="PageSize" PropertyName="PageSize" Type="Int32" />
                            <data:CUSTOMPARAMETER Name="RecordCount" Value="0" Type="Int32" />
                        </Parameters>
                        </data:VwFuneralsAllDataSource>
                    </ContentTemplate>
                </atlas:UpdatePanel>
            </div>
        </form>

        <script type="text/xml-script">
            <page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
                <references>
                </references>
                <components>
                </components>
            </page>
        </script>
    </body>

    </Code>
     

    Regards..

    Peter. 

    • Post Points: 65
Page 1 of 2 (22 items) 1 2 Next > | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems