<ej:Grid ID="GridProduct" runat="server" ClientIDMode="Static" AllowPaging="True" AllowFiltering="false" Width="920px">
<ClientSideEvents ActionComplete="productcomplete" EndAdd="endAdd" EndDelete="endDelete" EndEdit="endEdit" ActionBegin="begin" />
<Columns>
<ej:Column Field="str_product_code" HeaderText="str_product_code" IsPrimaryKey="true" TextAlign="Right" Visible="false" />
<ej:Column Field="str_product_name" HeaderText="str_product_name" IsPrimaryKey="true" TextAlign="Left" Visible="false" />
</Columns>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings></ej:Grid>
Thanks
Pratheep
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<input id="hfproduct" type="hidden" class="hfproduct" runat="server" />
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<ej:Grid ID="FlatGrid" runat="server" ClientIDMode="Static" AllowPaging="True" AllowFiltering="false" Width="920px">
<ClientSideEvents ActionComplete="productcomplete" EndAdd="endAdd" EndDelete="endDelete" EndEdit="endEdit" ActionBegin="begin" DataBound="databound" />
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
<EditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" />
---------------------------------------
</ej:Grid>
</div>
<script type="text/javascript">
function databound(args) {
if($(".hfproduct").val().length == 0)
$("#" + this.element.attr("id") +"_add").addClass("e-disable");
}
</script>
</asp:Content>
|
#Button").click(function(){
<input type="button" id="Button" value="Button"></input>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<ej:Grid ID="FlatGrid" runat="server" ClientIDMode="Static" AllowPaging="True" AllowFiltering="false" Width="920px">
<ClientSideEvents ------ DataBound="databound" />
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
--------------------------------------
</ej:Grid>
</div>
<script type="text/javascript">
function databound(args) {
if ($(".hfproduct").val().length == 0)
var $toolbar = $("#" + this.element.attr("id") + "_toolbarItems");
var toolbar = $("#" + this.element.attr("id") + "_add");
$toolbar.ejToolbar("disableItem", toolbar);
}
$("#Button").click(function () {
var grid = $("#FlatGrid").ejGrid("instance");
var $toolbar = $("#" + grid.element.attr("id") + "_toolbarItems");
var toolbar = $("#" + grid.element.attr("id") + "_add");
$toolbar.ejToolbar("enableItem", toolbar);
});
</script>
</asp:Content>
|