Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
AllowUpdate mixed with editng existing grid data and adding new rows...
posted

I have a WebGrid that is being bound to data, and some of that data is editable. The first two columns are not editable though, and I have added the AllowUpdate="No" in order to stop the user from changing those two values....

however, I also have AddNewRow set to visible, and I'm allowing the user to add a row of data at a time to the same grid... the problem is, when they add data, I need the user to have control over those first two columns that for existing data, they should not be able to change...

there does not seem to be a AllowInsert property of the UltraGridColumn, so there is no way for me to let the user enter these two values...

either I have to turn AllowUpate to "Yes" and risk them changing the two column's worth of data for existing records they should NOT change, or set it to No, and not allow the adding of rows to the current grid...

any idea around this problem?

  • 335
    posted

    A quick solution could be,

    - Set AllowUpdate="Yes" for all the columns

    - Handle BeforeEnterEditMode client side event and in this event handler return true for existing rows. Returning true will cancel the event and will not allow user to change the data for existing rows.

    Please let me know it this helps you.