Readonly Column at run time

2 posts, 0 answers
  1. Syed
    Syed avatar
    36 posts
    Member since:
    Nov 2013

    Posted 14 Sep 2015 Link to this post

    Hi There
    I have a bit odd requirement inside a grid. What I am looking for is.
    I have grid which consist of Year column and all the 12 month(July, August,….June) and total Budget amount.
    This grid could have many rows for different phases of the project (Concept, Design, Construction etc)
    Now my task is do the phasing for that budget at runtime.
     At run time I know which months (based on Dates Stored somewhere) I need to put the budget and based on that I have to divide this amount into these months and make all other month as read only.
    I have to make sure that sum of all the month should be equal to total budget amount at client side
    For example first row might be Design which might start from August and finish at October so remaining column for other months should be read only
    Second row might be construction which might start from October and finish at December so remaining column for other months should be read only.
    I hope this would be clear enough
    Please let me know how to achieve this.
    I will really appreciate that and look forward to hear from you all
    Many thanks
    Syed
  2. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 17 Sep 2015 Link to this post

    Hello Syed,

    You can achieve this requirement using the ItemDataBound event handler provided by RadGrid. Just access the generated controls in edit mode:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-editinsert-mode

    And get the information you need to determine whether the column should be readonly or not:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-raw-field-data-and-key-values

    Then, depending on this information, you can set the hide the controls or their parent cells altogether.

    Hope this helps. Please give it a try and let me know if it works for you.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top