Can you please tell me if programatic databinding with manual CRUD handling is even possible with the WebDataGrid? I can honestly say I have never in my 15 years as a software developer come across a comercial product that had so many bugs in it or contained such poor functionality and event handling as this control. The only part of the editing core that seems to be handled accurately is the RowAdding behaviour. Every time I turn a corner I am faced with another bug and it is driving me crazy!
Even though I have turned all ViewState handling on the control off, it still seems to be caching data on the client even after a rebind. The delete I have coded on the ItemCommand event deletes the correct item from the database but after rebinding the refreshed data source, the client seems to rebind the previously requested datasource and for some reason drops the last record off and the one I deleted is still visible even though its not part of the new datasource. After a full refresh (Ctrl+F5) of the page this is immediatley evident.
As for the RowUpdating event, it doesn't get fired until another completely separate control on the page causes a full postback even though the RowUpdated event (which doesn't contain the row values) fires as soon as the selected row is changed. Is this a joke?! Please explain to me the rationalle behind this because I am baffled by it.
Next, if I try and add an AjaxControlToolkit ConfirmButtonExtender to a template column I get an error telling me that I have duplicate control id's after a postback.
These are obviously known problems as there are numerous posts about all the issues I have come across on this forum for which you fail to provide a valid solution. Can these problems be resolved or should I just get my money back?
-------------------------------------------------------------------------------------------------------------------------------------Markup : -------------------------------------------------------------------------------------------------------------------------------------
<asp:ScriptManager runat="server"></asp:ScriptManager> <span class="TitleText">TEST TEST TEST</span><br /><br />
<ig:WebDataGrid ID="grdClients" runat="server" EnableViewState="false" EnableAjaxViewState="false" EnableDataViewState="false" DataKeyFields="ClientId" StyleSetName="Office2007Black" Height="375px" Width="100%" AutoGenerateColumns="False" OnRowAdding="grdClients_RowAdding" OnRowUpdating="grdClients_RowUpdating" OnItemCommand="grdClients_ItemCommand"> <Columns> <ig:BoundDataField DataFieldName="ClientName" Key="ClientName"> <Header Text="Client"></Header> </ig:BoundDataField> <ig:TemplateDataField Key="Delete" Width="20px"> <ItemTemplate> <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("ClientId") %>' AlternateText="Delete" ImageUrl="~/images/btn_close2.png" /> </ItemTemplate> </ig:TemplateDataField> </Columns> <Behaviors> <ig:Activation Enabled="true" /> <ig:Sorting Enabled="true" /> <ig:ColumnResizing Enabled="true" /> <ig:EditingCore AutoCRUD="false" > <Behaviors> <ig:RowAdding> <EditModeActions MouseClick="Double" /> </ig:RowAdding> <ig:CellEditing> <CellEditingClientEvents ExitedEditMode="grdClients_ExitedEditMode"/> <EditModeActions MouseClick="Double" /> </ig:CellEditing> </Behaviors> </ig:EditingCore> </Behaviors> </ig:WebDataGrid>
-------------------------------------------------------------------------------------------------------------------------------------Codebehind :-------------------------------------------------------------------------------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e) { this.InitialisePage(!Page.IsPostBack); }
public void InitialisePage(bool refresh) { if (refresh) { MPE.dOOdads.PayloadData.Clients clients = new MPE.dOOdads.PayloadData.Clients(HttpContext.Current.Server.MachineName, Common.Tools.GetApplicationDataBase());
clients.LoadAll();
this.grdClients.DataSource = clients.DefaultView.Table; this.grdClients.DataBind();
this.ViewState.Add("grdClients.DataSource", clients.DefaultView.Table); } else { this.grdClients.DataSource = this.ViewState["grdClients.DataSource"]; } }
protected void grdClients_ItemCommand(object sender, Infragistics.Web.UI.GridControls.HandleCommandEventArgs e) { try { MPE.dOOdads.PayloadData.Clients clients = new MPE.dOOdads.PayloadData.Clients(HttpContext.Current.Server.MachineName, Common.Tools.GetApplicationDataBase());
clients.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString())); clients.DeleteAll(); clients.Save();
this.InitialisePage(true); } catch { MPE.Common.Tools.MessageBox(this.Page, "Client is in use and cannot be deleted."); } }
protected void grdClients_RowAdding(object sender, Infragistics.Web.UI.GridControls.RowAddingEventArgs e) { MPE.dOOdads.PayloadData.Clients clients = new MPE.dOOdads.PayloadData.Clients(HttpContext.Current.Server.MachineName, Common.Tools.GetApplicationDataBase());
clients.AddNew(); clients.UserClientId = Common.Session.GetUserAccount().ClientId; clients.ClientName = e.Values["ClientName"].ToString(); clients.Save();
this.InitialisePage(true); }
protected void grdClients_RowUpdating(object sender, Infragistics.Web.UI.GridControls.RowUpdatingEventArgs e) { MPE.dOOdads.PayloadData.Clients clients = new MPE.dOOdads.PayloadData.Clients(HttpContext.Current.Server.MachineName, Common.Tools.GetApplicationDataBase());
clients.LoadByPrimaryKey((int)((object[])e.RowID["key"])[0]); clients.ClientName = e.Values["ClientName"].ToString(); clients.Save();
Hello Steve,
I apologize for the inconvenience you are having while using the product. The behavior you are experiencing doesn't sound right like the updating event not firing, while the updated event gets fired everytime you switch a row. Also, the viewstate disabled should not render any grid viewstate. There is also a 'dataviewstate' property, that holds the data. You may want to try out disabling that as well.
I would like to let you know that the support team are looking deeper into the issues, and will soon get in touch with you to provide proper resolution.
I request your patience while we try and help you out. You can also direct any other product concerns or suggestions directly to me at : murtazaa@infragistics.com
Best Regards,
Taz.
Steve,
I have looked into why you are getting the behavior that you are using the code that you have provided and I have attached a sample page that shows the desired behavior for Updating and Deleting.
For deleting, an additional line of code is needed in the ItemCommand event to clear the values that are loaded from the datasource before the call to InitialisePage. For this, add the following line of code before this call:
grdClients.ClearDataSource();
For editing the data, with Manual CRUD, the RowUpdating event should be used as the RowUpdated event will not fire. As far as the timing of RowUpdating, in my testing this was fired when I moved off of the row in the grid to another row. Is this behavior consistent with what you see?
Note that I changed the sample so that the DataSource for the WebDataGrid isn't stored in the ViewState of the page. This has been done because the ViewState of the page will not be updated during the AJAX calls for RowUpdating. While the state is sent from the client to the server it will not be sent back to the client and this can cause issues where updates would be lost because the DataSource that was saved on the last full post back would be used for later updates.
I still need to test the AjaxControlToolkit ConfirmButtonExtender and will send another update when I have done testing on this.
Let me know if you have any questions with this matter.