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
195
Disallow editing rows based on condition
posted

Hi team,

   I'm using a XamDataPresenter and one of the column in that is a username column. When a user logs in to the UI he will be seeing a list of rows with username and many other fields.

   What I want is the user who has logged in (say Jackson) should only be allowed to edit rows whose  username column value has  Jackson. If a row has a different username (say Michael) then he should not be able to edit any column in that row. 

   The next requirement is to display the rows which has the logged in username always at the top. In our example display all rows that has username as Jackson first and then the rest.

 

Thanks,

Ranjith

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello Ranjith,

    The fastest way of doing this is to handle the EditModeStarting event and check all of the cells in the record that is to start edit mode and check their values for the current user. If the user has a different name, then you can cancel the event by calling e.Cancel = True;

    Regarding your second requirement, the XamDataPresenter(Grid) will visualize the elements the same way as they are in the data source. So what you can do is to move them inside the data source so that users with the current user name are at the top.

    Hope this helps.

Children
No Data