|
protected void Page_Load(object sender, EventArgs e)
{
BindDataSource();
}
private void BindDataSource()
{
this.FlatGrid.DataSource = order;
this.FlatGrid.DataBind();
this.FlatGrid.ToolbarSettings.ShowToolbar= false;
this.FlatGrid.EditSettings.AllowEditing = false;
this.FlatGrid.EditSettings.AllowAdding= false;
this.FlatGrid.EditSettings.AllowDeleting= false;
}
Client side:-
<button type="button" onclick="refreshData()">Enable Editing</button>
<ej:Grid ID="FlatGrid" runat="server" AllowPaging="True" >
</ej:Grid>
<script type="text/javascript">
function refreshData() {
$('#<%= FlatGrid.ClientID %>').ejGrid("option", { editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] } })
}
</script> |