Is there a way to use one field template for inserts and another for edit? RRS feed

  • Question

  • User1694517121 posted

    Having a little trouble with the UIHint attribute.  Specifically I need to use one field template during the insert and another during the edit.  Is there a way to do this with the UIhint attribute?  I've tried modifying one template to detect when the action is insert and do one thing and when it's edit do another.  However, doing this in the template always returns the action as a null result.  The code I'm using in the field template is this

    RouteData route = DynamicDataRouteHandler.GetRequestContext(Context).RouteData; 
    DynamicDataRoute ddRouteData = route.Route as DynamicDataRoute; 
    string action = ddRouteData.Action; 

    from here:  http://justgeeks.blogspot.com/2010/11/getting-action-or-dynamicdataroute-from.html

     But, it would work equally well to simply have one template that acts like an edit template on insert but not on edit and another that works as an edit on the edit and not on insert.

    Any way to specify which mode a UIHint works for?

    Thanks in advance.

    Tuesday, July 17, 2012 10:24 AM


  • User1694517121 posted

    Sorry, I posted prematurely.  The suffix determines this.  If you need what I need you simply add a suffice consisting of _edit and _insert respectively to the user control base name.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 17, 2012 10:32 AM