This question is locked. New answers and comments are not allowed.
Hi Team,
I have a scenario wherein I'm using a telerik grid with ajax. I have a command column that displays Update and Delete button. Now, I want to show the Update button for certain scenarios, say if a field is true, show the Update button, otherwise don't.
I have gone through some of your threads where you have suggested to hide a command button in JS using CSS, but I don't want that. The drawback of using this approach is that the button will still be rendered even though it is hidden. So, one can open the developer toolbar find the hidden button and change the visibility to true and hence he'll be able to see and click the command button.
I want that the Update button should not render altogether if the condition is not satisfied. Can you please suggest something?
Here's my piece of code:
@(Html.Telerik().Grid<Campaign>()
.LibraryGrid()
.Name(CampaignController.IndexGridName)
.DataKeys(d => d.Add(k => k.CampaignId))
.ToolBar(t =>
{
t.AddButton("Campaign");
t.ClearAllButton("Campaign");
})
.DataBinding(binding =>
{
binding.Ajax()
.Select("Select", "Campaign")
.Delete("Delete", "Campaign");
})
.Columns(columns =>
{
columns.Command(commands =>
{
commands.UpdateButton("Campaign");
commands.Delete().ButtonType(GridButtonType.ImageAndText);
}).Width(230);
columns.WordBreakAllColumns();
})
)
I have a scenario wherein I'm using a telerik grid with ajax. I have a command column that displays Update and Delete button. Now, I want to show the Update button for certain scenarios, say if a field is true, show the Update button, otherwise don't.
I have gone through some of your threads where you have suggested to hide a command button in JS using CSS, but I don't want that. The drawback of using this approach is that the button will still be rendered even though it is hidden. So, one can open the developer toolbar find the hidden button and change the visibility to true and hence he'll be able to see and click the command button.
I want that the Update button should not render altogether if the condition is not satisfied. Can you please suggest something?
Here's my piece of code:
@(Html.Telerik().Grid<Campaign>()
.LibraryGrid()
.Name(CampaignController.IndexGridName)
.DataKeys(d => d.Add(k => k.CampaignId))
.ToolBar(t =>
{
t.AddButton("Campaign");
t.ClearAllButton("Campaign");
})
.DataBinding(binding =>
{
binding.Ajax()
.Select("Select", "Campaign")
.Delete("Delete", "Campaign");
})
.Columns(columns =>
{
columns.Command(commands =>
{
commands.UpdateButton("Campaign");
commands.Delete().ButtonType(GridButtonType.ImageAndText);
}).Width(230);
columns.WordBreakAllColumns();
})
)