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>
Is there some different action required for row-adding on the child band level? The problem might be unique as my parent doesn't allow adding...but my child does. I have 'enable inheritence=false' on the parent and child, row adding is enabled, and the following is my code-behind.
-----------------------------------------
Private Sub WebForm1_Init(sender As Object, e As System.EventArgs) Handles Me.Init AddHandler gridlog.Bands(0).RowAdded, AddressOf gridlog_RowAdded End Sub
Private Sub gridlog_RowAdded(sender As Object, e As Infragistics.Web.UI.GridControls.RowAddedEventArgs) End Sub
-------------------------------------------------------------
Hello,
There is no different action for row-adding on the child band level.
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
WebHierarchicalDataGrid1.Bands["SqlDataSource2_DefaultView"].RowUpdating += new RowUpdatingHandler(WHDGEdit_RowUpdating);
WebHierarchicalDataGrid1.Bands["SqlDataSource2_DefaultView"].RowAdding += new RowAddingHandler(WHDGEdit_RowAdding);
}
protected void WHDGEdit_RowAdding(object sender, RowAddingEventArgs e)
//TO DO
public void WHDGEdit_RowUpdating(object sender, RowUpdatingEventArgs e)
P.S: I appologize I have added the event to the GridView instead to the band in the previos post
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>
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 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?
Thank you for your 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
Private Sub gridlog_RowUpdated(sender As Object, e As Infragistics.Web.UI.GridControls.RowUpdatedEventArgs) Handles gridlog.RowUpdated 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.