What is the best way to update the child row? I'm able to update the parent but I'm not sure the best way to update the child. I have the sqldatasources working but when a value in the child of the grid is updated it doesn't update the data.
There aren't any exposed events for the child band, nor is there anything in the csom that lets you rebind the grid and the commit() method (referenced on other posts) doesn't work.
So, I'm not sure. How am I supposed to actually update the data on the child band?
thanks for any help you can provide.
Hi mclingan,
If you get access to the Band in the code behind, you can add Updating server events that the child grids will then fire.
regards,David Young
and update to child band doesn't call anything in code behind....only an update to parent. ((There aren't any events that are fired when the child band is updated). I did ad add a javascript call to child band but there isn't a command to update grid from BLOCKED SCRIPT
<Behaviors> <ig:EditingCore> <EditingClientEvents RowUpdated="gridlog_Editing_Child_RowUpdated" /> <Behaviors> <ig:CellEditing Enabled="true"> <ColumnSettings> ... <snip>... </ColumnSettings> <EditModeActions MouseClick="Single" /> </ig:CellEditing> <ig:RowAdding Enabled="true"> <ColumnSettings> ... <snip>... </ColumnSettings> <EditModeActions MouseClick="Single" /> </ig:RowAdding> <ig:RowDeleting Enabled="true" /> </Behaviors> </ig:EditingCore> </Behaviors>
Hello mclingan ,
As Dave has shared if you get access to the Band in the code behind, you can add Updating server events that the child grids will then fire.
For example :
WebHierarchicalDataGrid1.GridView.RowUpdating += new RowUpdatingHandler(GridView_RowUpdating);
protected void GridView_RowUpdating(object sender, RowUpdatingEventArgs e)
{
// TO DO
}
If you have a RowUpdating behavior handled on the server,
the grid will commit changes on a row by row basis as soon as the active cell leaves every changed row.If you have turned on AutoCRUD and don't handle the RowUpdating event on the server, then the grid will accumulate all of the cell changes on the client and will commit them once on the first full post back.
http://help.infragistics.com/NetAdvantage/ASPNET/2010.3/CLR4.0/?page=Infragistics4.Web.v10.3~Infragistics.Web.UI.GridControls.EditingCore~AutoCRUD.html
Here is a online sample regarding Child Band editing:
http://samples.infragistics.com/2010.3/WebFeatureBrowser/contents.aspx?showCode=true&t=WebHierarchicalDataGrid/WebHierarchicalDataGrid_EditingChildBands.aspx~srcview.aspx?path=~srcview.aspx?path=WebHierarchicalDataGrid/WebHierarchicalDataGrid_EditingChildBands.src
Hope this helps.
"If you have a RowUpdating behavior handled on the server, the grid will commit changes on a row by row basis as soon as the active cell leaves every changed row."
RowUpdating behavior is handled on the server. The grid does commit changes on a row by row basis. It works for the parent. The child never fires an event. However, if I change the parent, it updates the parent and child.
I've gone throught the sample and it behaves just like mine. Changes can be made, but changes aren't saved.
Thank you for your assistance!
Matt
Just to be sure, I did add an updating server event on page_init for the grid. I added two to be sure:
AddHandler gridlog.GridView.RowUpdated, AddressOf gridlog_RowUpdated AddHandler gridlog.GridView.RowUpdating, AddressOf gridlog_RowUpdating
Parent updating and updated events fired fine. Child updating and updated events didn't fire at all.
As I said originally, you need to add the event to the BAND, not the GridView. The Band will allow the event to be propogated to the row islands of that band. So for example.
WHDG1.Bands[0].RowUpdating would be the event.
-Dave
AH. That was it. Thank you guys for your assistance. The child band is now updating as expected. Below is my code-behind for those who are struggling with this. 'Gridlog' is the name of my grid:
----------------------------- Private Sub WebForm1_Init(sender As Object, e As System.EventArgs) Handles Me.Init AddHandler gridlog.Bands(0).RowUpdated, AddressOf gridlog_RowUpdated End Sub
Private Sub gridlog_RowUpdated(sender As Object, e As Infragistics.Web.UI.GridControls.RowUpdatedEventArgs) Handles gridlog.RowUpdated End Sub
------------------------------Of course, the major complaint is that if I have autocrud on and turn on editing at the band level this should be an automatically added handler. The enabeling of the child editing should behave the same as the enabeling of the parent editing.
Thank you again for your time and assistance.
Your sample helped get the adding of my child row to fire correctly. I modified your code to vb below. However, I've run out of development time to continue working on this new grid. Certain things aren't working correctly and I don't have the time to make it work. For instance, I'm using procedures to call the inserts, updates, etc instead of direct access to the tables....and the hierarchial data source wants to call all the fields and pass all of them to the procedure instead of the ones i've specified in my data source. also, the child rows don't contain the keys of the parent which means for the relationship keys i'm going to have to build extra logic in to capture the relationship keys for the child row. in other words, when adding a row to the child the relationship key is missing. The bottom line is that things aren't flowing like they should and i think i'll wait until this product has gone through a few more iterations of change. thank you for your asistance.
here is the modified code (to vb) for getting the chid row to fire an insert.
===================================================
Private Sub gridlog_RowAdded(sender As Object, e As Infragistics.Web.UI.GridControls.RowAddedEventArgs) Handles gridlog.RowAdded End Sub
Protected Sub GridView_RowUpdating(sender As Object, e As Infragistics.Web.UI.GridControls.RowUpdatingEventArgs) End Sub
Private Sub form1_Init(sender As Object, e As System.EventArgs) Handles form1.Init AddHandler gridlog.Bands(0).RowUpdated, AddressOf gridlog_RowUpdated AddHandler gridlog.Bands(0).RowAdded, AddressOf gridlog_RowAdded End Sub
Hello Matt,
I have been thinking all the time that we are discussing RowAdding event.
This is the event that should be handled when AutoCrud is turned off.
I appologize for that.
Regarding RowAdded event I tried to reproduce it with the attached sample (using NorthWind database) but I was not able to.
Please refer to the attachment and feel free to reproduce it in order to encounter the behavior with it.
Hope hearing from you.
Not sure I understand. setting autocrud to false did not cause my events to fire in the code-behind.
If you add your own rowadded handler event to your band shouldn't it fire? My parent band doesn't allow row adding, maybe that is the problem....or is there something else that might be preventing it from firing?
Hello,
In maual CRUD mode RowAdded , RowUpdated and RowDeleted events are not fired.
You should set the AutoCRUD Property to false .
http://help.infragistics.com/NetAdvantage/ASPNET/2010.3?page=Infragistics4.Web.v10.3~Infragistics.Web.UI.GridControls.EditingCore~AutoCRUD.html
Let me know if you need further assistance regarding this.
Not sure what I am doing wrong here. I have the same in my code-behind and it never hits the rowadded event:---------------------------------------------------------------- Private Sub WebForm1_Init(sender As Object, e As System.EventArgs) Handles Me.Init AddHandler gridlog.Bands(0).RowAdded, AddressOf gridlog_RowAddedEnd Sub
Private Sub gridlog_RowAdded(sender As Object, e As Infragistics.Web.UI.GridControls.RowAddedEventArgs)End Sub-------------------------------------------------------------------------------------Below is my grid. I have no idea. Is there a setting or something that I am missing? I took out the columns to conserve space and thought:.----------------------------------------------------------------------------------
<ig:WebHierarchicalDataGrid ID="gridlog" runat="server" Height="98%" Width="100%" DataSourceID="dslog" AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="SegID" DataMember="SqlDataSourceLog_DefaultView" StyleSetName="Pear"> <Bands> <ig:Band AutoGenerateColumns="False" DataKeyFields="SegID, WorkID" DataMember="SqlDataSourceWork_DefaultView"> <Columns> --- 8<----- snip-- </Columns> <Behaviors> <ig:EditingCore> <Behaviors> <ig:CellEditing Enabled="true"> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="EmpID" EditorID="gridlog_DropDownAssignedTo" /> <ig:EditingColumnSetting ColumnKey="isSpellChecked" EditorID="gridlog_DropDownYesNo" /> <ig:EditingColumnSetting ColumnKey="isProofRead" EditorID="gridlog_DropDownYesNo" /> </ColumnSettings> <EditModeActions MouseClick="Single" /> </ig:CellEditing> <ig:RowAdding Enabled="true"> <ColumnSettings> <ig:RowAddingColumnSetting ColumnKey="EmpID" EditorID="gridlog_DropDownAssignedTo" /> <ig:RowAddingColumnSetting ColumnKey="isSpellChecked" EditorID="gridlog_DropDownYesNo" /> <ig:RowAddingColumnSetting ColumnKey="isProofRead" EditorID="gridlog_DropDownYesNo" /> </ColumnSettings> <EditModeActions MouseClick="Single" /> </ig:RowAdding> <ig:RowDeleting Enabled="true" /> </Behaviors> </ig:EditingCore> </Behaviors> </ig:Band> </Bands> <Behaviors> <ig:EditingCore> <EditingClientEvents /> <Behaviors> <ig:CellEditing Enabled="true" EnableInheritance="true"> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="AssignedTo" EditorID="gridlog_DropDownAssignedTo" /> <ig:EditingColumnSetting ColumnKey="SegStatus" EditorID="gridlog_DropDownSegStatus" /> <ig:EditingColumnSetting ColumnKey="isScheduled" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="Jobid" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="SegNumber" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="SegDescr" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="TimeSubmit" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="DateDue" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="TimeDue" ReadOnly="True" /> </ColumnSettings> <EditModeActions MouseClick="Single"></EditModeActions> </ig:CellEditing> <ig:RowAdding Enabled="False"> </ig:RowAdding> <ig:RowDeleting EnableInheritance="True" Enabled="False" /> </Behaviors> </ig:EditingCore> <ig:Selection CellClickAction="Row" RowSelectType="Single"> </ig:Selection> <ig:Activation> </ig:Activation> </Behaviors> <EditorProviders> <ig:DropDownProvider ID="gridlog_DropDownAssignedTo"> <EditorControl ID="EditorControl1" DropDownContainerMaxHeight="200px" Width="200px" EnableAnimations="False" EnableDropDownAsChild="False" runat="server" DataSourceID="dsEmp" TextField="employeename" ValueField="employeeid"> <DropDownItemBinding TextField="employeename" ValueField="employeeid"></DropDownItemBinding> </EditorControl> </ig:DropDownProvider> <ig:DropDownProvider ID="gridlog_DropDownEmpWork"> <EditorControl ID="EditorControl2" DropDownContainerMaxHeight="200px" Width="160px" EnableAnimations="False" EnableDropDownAsChild="False" runat="server" DataSourceID="dsEmp" TextField="employeename" ValueField="employeeid"> <DropDownItemBinding TextField="employeename" ValueField="employeeid"></DropDownItemBinding> </EditorControl> </ig:DropDownProvider> <ig:DropDownProvider ID="gridlog_DropDownSegStatus"> <EditorControl ID="EditorControl3" EnableAnimations="False" EnableDropDownAsChild="False" runat="server" DropDownContainerMaxHeight="150px" DataSourceID="dsSegStatus" TextField="optionitem" ValueField="optionitem"> <DropDownItemBinding TextField="optionitem" ValueField="optionitem" ToolTipField="descr"> </DropDownItemBinding> </EditorControl> </ig:DropDownProvider> <ig:DatePickerProvider ID="gridlog_DatePickerWorkDateReceived"> </ig:DatePickerProvider> <ig:DropDownProvider ID="gridlog_DropDownYesNo"> <EditorControl DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" runat="server"> <Items> <ig:DropDownItem Selected="False" Text="true" Value="true"> </ig:DropDownItem> <ig:DropDownItem Selected="False" Text="false" Value="false"> </ig:DropDownItem> </Items> </EditorControl> </ig:DropDownProvider> </EditorProviders> <Columns> --- 8<----- snip-- </Columns> </ig:WebHierarchicalDataGrid>