locked
generic way to provide UI-friendly-field-descriptions RRS feed

  • Question

  • User-1614457691 posted

    All --

    Please help. 

    I just need to figure out a generic way to provide UI-friendly-field-descriptions.

    I guess that I could make a lookup-map based on the key="TableName+FieldName" and value="PersistedDescriptionText".

    I think the options for storing the data are a database-driven, XML resource, resource file, or compiled meta-data.

    I am not sure exactly how this would work; but, maybe somehow make the calls to get the descriptions in the templates, maybe have some templates that display just field names and others that display field names plus descriptions. Maybe.

    The design goal is provide inline help text when the requirement is "show the name of the field but also a short description of what the field is and why it is and etc".

    If you have ideas please post them.

    Thank you.

    -- Mark Kamoski

    Tuesday, August 26, 2008 7:22 AM

Answers

  • User1641955678 posted

    Hi Mark,

    If you put a Description attribute on a field, it will show up by default as a tooltip in the edit box for that field.  Also, if you don't want to use a compiled CLR attribute, you can look at using a custom metadata provider, as described in this post by Marcin.

    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 26, 2008 11:28 AM

All replies

  • User1641955678 posted

    Hi Mark,

    If you put a Description attribute on a field, it will show up by default as a tooltip in the edit box for that field.  Also, if you don't want to use a compiled CLR attribute, you can look at using a custom metadata provider, as described in this post by Marcin.

    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 26, 2008 11:28 AM
  • User-1614457691 posted

     

    Hi Mark,

    If you put a Description attribute on a field, it will show up by default as a tooltip in the edit box for that field.  Also, if you don't want to use a compiled CLR attribute, you can look at using a custom metadata provider, as described in this post by Marcin.

    David

    That is great that the Description can be used that way.

    I do not much like ToolTips, however-- they are too flaky (flicker, blink in and out too easily, etc).

    However, now that I know the technique I can simply do this...

     

    public partial class DateTime_EditField : System.Web.DynamicData.FieldTemplateUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //old
            //TextBox1.ToolTip = Column.Description;

            //new
            this.DescriptionLabel.Text = "<br />" + Column.Description;

     ...

     

    ...and that works just great to put the description below the edit textbox...

    ...that is OK but not great...

     ...what I really want is to put the description underneath the field-label that preceeds the textbox...

     ...but I cannot see how to do that...

    ...do you have any hints???

     

     

     

    Tuesday, August 26, 2008 11:41 PM
  • User1641955678 posted

    Hmmm, I'm not sure I understand what field-label you are referring to.  Can you provide more details?

    thanks,
    David

    Wednesday, August 27, 2008 1:00 AM
  • User-1614457691 posted

    Hmmm, I'm not sure I understand what field-label you are referring to.  Can you provide more details?

    thanks,
    David

    Here is what I mean.

    In a standard case, with the out-of-the-box templates for Dynamic Data...

     ...when the edit-view builds, it puts the field-label (a literal control or a label control) on the the left and the input control (a textbox, etc) on the right...

    ...I can insert the description below the input-control on the right, but I do not know how to put it under the field-label-control on the left...

    ...I think that I need to programmatically set the description when the DetailsView gets built, on the Details1 DetailView in the file ..\DynamicData\PageTemplates\Edit.aspx.cs , but I do know how to do that right now...

    ...below is a picture that shows what I can do and what I want to do...

     http://www.netbrainer.com/Images/DynamicDataScreenshot1.JPG

    If you have any suggestions, then please let me know.

    Thank you.

    -- Mark Kamoski

    Wednesday, August 27, 2008 7:38 AM
  • User1641955678 posted

    Now, I understand what you mean. It's likely not something that can be solved from inside the field template, because the field template only renders what's inside the cell (and apply equally in Lists and Details).  I think this comes down to a more general question about how to customize the left column in a DetailsView (independently from DynamicData), and I'm not sure that there is a very straightforward way of doing it.  FormView gives an alternative to DetailsView that provides much more control over the rendering (though it is less 'automatic').

    David

    Thursday, August 28, 2008 1:48 AM
  • User-1614457691 posted

    Now, I understand what you mean. It's likely not something that can be solved from inside the field template, because the field template only renders what's inside the cell (and apply equally in Lists and Details).  I think this comes down to a more general question about how to customize the left column in a DetailsView (independently from DynamicData), and I'm not sure that there is a very straightforward way of doing it.  FormView gives an alternative to DetailsView that provides much more control over the rendering (though it is less 'automatic').

    David

    I appreciate the reply and understand the case.

    For now, I have simply set the DetailsView.Width=100%, left-column-width=25% and right-column-width=75% (which is what I want anyway, so the form fills the page, and now after doing that the description looks pretty good underneath the field (not ideal but GEFN).

    If you have more ideas, then please post them.

    Thank you.

    -- Mark Kamoski

    Thursday, August 28, 2008 7:23 AM