custom action on UniGrid XML

M B asked on April 17, 2018 08:43

Hello Guys,

Is there a way to register a custom action when using the UniGrid's XML definitions? Ideally something similar to UniGrid.UniGridTransformations.Global.RegisterTransformation

Cheers!

Recent Answers


Dragoljub Ilic answered on April 17, 2018 09:45 (last edited on April 17, 2018 10:44)

Hi,

I think you can find what you need in this example. Here, you can see how we create new action in xml called 'deleteaction', and then, how it in 'OnAction' method handle what should be done:

userGrid.OnAction += OnAction;

private void OnAction(string actionName, object actionArgument)
{
    switch (actionName.ToLower())
    {
        case "deleteaction":
        // Code for deleting the user by the actionArgument which is the passed UserID
        UserInfoProvider.DeleteUser(ValidationHelper.GetInteger( actionArgument, 0)); 
        // Repopulate the UniGrid with the new data             
        userGrid.DataSource = (CMS.SiteProvider.UserInfoProvider.GetAllUsers());
        break;
    }
}

Best regards, Dragoljub

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on April 17, 2018 12:48 (last edited on April 17, 2018 13:12)

Here is a good tutorial how to implement action button, take a look as well at custom functionality i.e. creating custom actions. Or you are talking about massactions?

0 votesVote for this answer Mark as a Correct answer

M B answered on April 18, 2018 01:02

Thank you for Dragoljub & Peter for taking time in answering my question. All of your inputs were helpful but i decided to go with Extenders

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.