Hi,
I'm trying to develop an auditing system to keep track of all our stock. I'd like to be able to edit data but the RowUpdating event is not firing after data is changed. I use a dynamic data source and have included some of the code.
SqlDataSource3.ConnectionString =
].ConnectionString;
)
{
SqlDataSource3.SelectCommand =
;
}
else
"SELECT vw_" + _Type + ".* FROM vw_" + _Type + ""
WebDataGrid1.DataSource = SqlDataSource3;
WebDataGrid1.DataKeyFields =
"CableID"
"HardDriveID"
"KeyboardMouseID"
"MiscID"
"MemoryID"
"NetworkID"
"PhoneID"
"VideoCardID"
this.WebDataGrid1.Behaviors.CreateBehavior<EditingCore>();
this.WebDataGrid1.Behaviors.EditingCore.Behaviors.CreateBehavior<RowEditingTemplate>();
this.WebDataGrid1.Behaviors.EditingCore.Behaviors.RowEditTemplate.EditModeActions.MouseClick = EditMouseClickAction.Double;
this.WebDataGrid1.Behaviors.EditingCore.Behaviors.RowEditTemplate.OKButton = "OkButton";
this.WebDataGrid1.Behaviors.EditingCore.Behaviors.RowEditTemplate.CancelButton = "CancelButton";
if (_Type == "Computers")
this.WebDataGrid1.Behaviors.EditingCore.Behaviors.RowEditTemplate.Template = new ComputerCustomRowEditingTemplate();
daColumns =
new SqlDataAdapter("SELECT column_name FROM information_schema.columns WHERE table_name = 'vw_Computers'", sqlConnection);
dsColumnNames =
new DataSet();
sqlConnection.Open();
daColumns.Fill(dsColumnNames,
"Columns");
sqlConnection.Close();
RowEditingClientBinding item = new RowEditingClientBinding();
foreach (DataRow row in dsColumnNames.Tables["Columns"].Rows)
item =
new RowEditingClientBinding();
item.ColumnKey = row[
"column_name"].ToString();
item.ControlID =
"WebDataGrid1_ctl00_txt" + row["column_name"].ToString();
item.GetValueJavaScript =
"$get('WebDataGrid1_ctl00_txt" + row["column_name"].ToString() + "').value";
item.SetValueJavaScript =
"$get('WebDataGrid1_ctl00_txt" + row["column_name"].ToString() + "').value={value};";
this.WebDataGrid1.Behaviors.EditingCore.Behaviors.RowEditTemplate.ClientBindings.Add(item);
SqlDataSource3.UpdateCommand =
"Update [vw_Computers] SET [Machine Name] = '" + MachineName + "' WHERE [ComputerID] = " + ID;
And my asp code
<
ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="32%" Width="100%" DataKeyFields="ComputerID" OnRowUpdating="WebDataGrid1_RowUpdating">
<Behaviors>
<ig:Paging PageSize="50" PagerAppearance="Bottom" Enabled="true" />
<ig:Selection CellClickAction="Row" RowSelectType="Single">
</ig:Selection>
<ig:EditingCore>
<ig:RowEditingTemplate>
<EditModeActions MouseClick="Double" RowSelectorMouseClick="None" />
</ig:RowEditingTemplate>
</Behaviors>
</ig:EditingCore>
<ig:RowSelectors>
</ig:RowSelectors>
<ig:Activation>
</ig:Activation>
</ig:WebDataGrid>
Nothing is getting updated and if I put a break point in the function it is not even being called. Any help would be much appreciated
Hi Alex.
I've the same problem. The wdg_RowUpdated event does not fire up though the Activation behavior is enabled.
I've the exact same issue as in this thread:
https://es.infragistics.com/community/forums/f/ultimate-ui-for-asp-net/23524/problem-with-server-side-rowupdating-event-on-webdatagrid
and apparently this comment help the guy:
You can trigger commiting of the updates at any point by calling grid.get_behaviors().get_editingCore().commit();
But I don't get where I should put that piece of code? I tried on the OnClientClick of the button in my Row Editing Template (which works well), but the wdg_RowUpdated event still does not fire ;-(
Where would you put that piece of code?
Thanks a lot
Yvan
Hello,
Couple of threads regarding this. Hopefully they will help you out:
https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/80305/apply-xamcurrencyeditor-for-float-value-as-a-style-to-apply-for-entire-project#80305
https://es.infragistics.com/community/forums/f/ultimate-ui-for-asp-net/23524/problem-with-server-side-rowupdating-event-on-webdatagrid#86134