CodeSmith Community
Your Code. Your Way. Faster!

Minor change to TableEditControlBase.cst

Latest post 11-26-2007 7:45 AM by swin. 1 replies.
  • 11-09-2007 5:57 PM

    • JRich
    • Top 150 Contributor
    • Joined on 04-24-2007
    • Posts 30
    • Points 785

    Minor change to TableEditControlBase.cst

    I have learned to make really effective use of the WINFORM custom control library.

    However, one minor annoyance with the current version of TableEditControlBase.cst is the value used to set the "Text" property of each label.  NetTiers currently uses the column name for that field. This is rarely useful in a user interface. A small change to the TableEditControlBase.cst template can help the developer utilize more appropriate label references on the user controls.

    Why not let the user utilize a column's extended properties to assign the label text value for each field?  I assign each table's column an extended property called "MS_Description" and use its value property to contain the string I want to place in that column's label text property on the user control. Specifically, I change the following line (~line 218)

    this.<%=dgvColumnName%>Label.Text = "<%=GetPropertyName(column)%>:";

    to this

    this.<%=dgvColumnName%>Label.Text = "<%=((column.ExtendedProperties["MS_Description"]==null)||(column.ExtendedProperties["MS_Description"].Value.ToString().Length==0))?column.Name:column.ExtendedProperties["MS_Description"].Value.ToString()%>:";

    If there is no extended property named MS_Description, or if the property exists but its value is a zero length string, we use the column name. Otherwise we use the extended property ("MS_Description") value.

     Its a simple change and makes use of the Customer Controls much more effective.

     Thanks,

    Joe Rich 

     

    • Post Points: 35
  • 11-26-2007 7:45 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 922
    • Points 34,710

    Re: Minor change to TableEditControlBase.cst

     Joe,

    I've used your idea but instead of the ms_description field I've used the FriendlyName from the mapping.config file which is more consistent with how the web stuff is done.

    Thanks for your contribution.

    Commited in SVN676

    swin 

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems