Append text in post_render event RRS feed

  • Question

  • I want to display a related entity's name in parentheses next to the current entity's name on the browse screen.  I have the field on the list but have not found a simple solution to enclose it in parentheses.  I've tried changing it to a custom control and altering the render event.  I also tried working with it on the row template.

    My issue may have to do with it being a related entity and it seems to load a little later than the rest of the data on the screen.

    Any suggestions?



    Wednesday, May 1, 2013 7:44 PM


  • See:


    myapp.AddEditOrder.RowTemplate_render = function (element, contentItem) {
        // We need to wait until the Products for the Order Detail are loaded
        // so we create a binding to "value.Product.ProductName"
        // When the data is loaded the binding will be raised
        // We will then have all the data required for our display
        contentItem.dataBind("value.Product.ProductName", function (newValue) {
            // clear the element
            element.innerHTML = "";
            // Create a template
            var itemTemplate = $("<div></div>");
            // Get the Product name and quantity
            var ProductName = contentItem.value.Product.ProductName;
            var ProductQuantity = contentItem.value.Quantity;
            // Create the final display
            var FinalName = $("<h2>" + ProductName + ' [' + ProductQuantity + ']' + "</h2>");
            // Complete the template

    The Visual Studio LightSwitch Marketplace


    • Marked as answer by Brian Kidd Wednesday, May 1, 2013 7:53 PM
    Wednesday, May 1, 2013 7:47 PM

All replies