1. Are you want to disable the toolbar item based on the HeaderText/Field name or particular cell value of the selected column?
2. You have mentioned like code behind, did you expect to disable the tool bar items using server side events?
3. Kindly explain your scenario clearly and share the code example that you have tried in your application.
4. Screenshot of the your requirement.
The provided information will help to analyze the issue and provide you the response as early as possible.
Regards,
Gowthami V.
<ej:Grid ID="Grid" runat="server" AllowPaging="True"> <EditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" AllowEditOnDblClick="false"/> <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,delete,cancel"/> <ClientSideEvents RowSelecting="rowselect"/> function rowselect(args) { //Gets the ToolBar. var $toolbar = $("#<%= Grid.ClientID %>_toolbarItems"); if (!args.data.Verified) { // Enables or disables the call based on the status. $toolbar.ejToolbar("disableItem", $("#<%= Grid.ClientID %>_edit")); $toolbar.ejToolbar("disableItem", $("#<%= Grid.ClientID %>_delete")); } else { // Enables or disables the call based on the status. $toolbar.ejToolbar("enableItem", $("#<%= Grid.ClientID %>_edit")); $toolbar.ejToolbar("enableItem", $("#<%= Grid.ClientID %>_delete")); } } |
<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowGrouping="true" AllowFiltering="true" AllowSorting="true"> <EditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" AllowEditOnDblClick="false"/> <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,delete,cancel"/> <Columns> <ej:Column HeaderText="Manage Column" IsUnbound="True" Width="130"> <Command> <ej:Commands Type="edit"> <ButtonOptions ContentType="ImageOnly" PrefixIcon="e-edit" Text="Edit"></ButtonOptions> </ej:Commands> <ej:Commands Type="delete"> <ButtonOptions ContentType="ImageOnly" PrefixIcon="e-delete" Text="Delete"></ButtonOptions> </ej:Commands> <ej:Commands Type="save"> <ButtonOptions ContentType="ImageOnly" PrefixIcon="e-update" Text="Save"></ButtonOptions> </ej:Commands> <ej:Commands Type="cancel"> <ButtonOptions ContentType="ImageOnly" PrefixIcon="e-cancel" Text="Cancel"></ButtonOptions> </ej:Commands> </Command> </ej:Column> <ej:Column Field="OrderID" IsPrimaryKey="true" Width="90" /> <ej:Column Field="Verified" Width="100" /> <ClientSideEvents RowDataBound="dataBound" Create="create" ActionComplete ="complete"/> </ej:Grid> <script type="text/javascript"> function dataBound(args) { //Adding custom class for the ejButton based on the field Verified if (args.data.Verified) args.row.find("td.e-unboundcell").find(".e-button").addClass("greenClass"); else args.row.find("td.e-unboundcell").find(".e-button").addClass("redClass"); }
function customizeButton() { //Customize the background-colur and text for the ejButton $(".greenClass").ejButton({ enabled:true }); $(".redClass").ejButton({ enabled:false }); } function create(args) { customizeButton(); } function complete(args) { customizeButton(); } </script> |
Hi Alavudeen,
Query 1: I got an answer is perfectly fit to my requirement.
Thanks for your update.
Get back to us if you need further assistance.
Query 2: how to create a tabitems using sql server.
We have provided solution for this query in F123476. So kindly follow-up with the specified forum for more details.
Regards,
Gowthami V.