PDA

View Full Version : [CLOSED] Set button enable true or false MVC



matrixwebtech
Jun 10, 2014, 8:28 PM
My Button code


Html.X().Button()
.ID("btnEdit")
.Text("Edit record")
.Icon(Icon.ApplicationEdit)
.Disabled(_PagePermission.Permission_Edit)
.DirectEvents(de =>
{
de.Click.Action = "Edit";
de.Click.EventMask.ShowMask = true;
de.Click.ExtraParams.Add(new Parameter()
{
Name = "selected",
Value = "App.GridPanel1.getSelectionSubmit().getSelectionMo delField().getValue()",
Mode = ParameterMode.Raw
});
})


currently I do if Permission_Edit is false then I convert it to true and if Permission_Edit true then I convert it to false,I not get any example to do this with Enable property of button.

please help me to do this with enable property

Daniil
Jun 11, 2014, 6:43 AM
Hi @matrixwebtech,

Please clarify do you want the Button not to be on the view at all if _PagePermission.Permission_Edit is false?

If so, then do not add the Button on the view at all.

Or, maybe, you just need this.

.Disabled(!_PagePermission.Permission_Edit)