We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl NavigatorBar

Hi,

I need to log the event when edit the content of the grid. How can I trigger an event when press the "delete row" and "edit row" button in the navigator bar?

Another question is how to code the DeleteParameters and UpdateParameters etc. in C# instead of in asp?

Thanks,
Rebecca


5 Replies

GB Gokul B Syncfusion Team July 3, 2007 09:21 PM UTC

Hi Rebecca,

Here is my answer for your query.

* You can trigger the event once the EditRow/DeleteRow of the ButtonBarItem is pressed using the GridGroupingControl OnBarButtonItemClicked event. Please refer to the below code snippet.

In the GridGroupingControl BarButtonItemClicked event

//Execute the code if the DeleteRow/EditRow BarButtonItem is pressed.
if (e.ButtonBarItem.ButtonBarItemType == ButtonBarItemType.DeleteRow)
{
}
else if (e.ButtonBarItem.ButtonBarItemType == ButtonBarItemType.EditRow)
{
}

* If your intentions is to code the DeleteParameters of the DataSource Control from the code behind then please refer to the below code snippet.

AccessDataSource1.DeleteParameters.Add(@stringname,type of parameter,value);

Let us know if it helps.

Thanks for using Syncfusion products.

Regards,
Gokulkumar B


RE rebecca July 5, 2007 04:20 PM UTC

Hi GokulKumar,

Thank you for your reply! New problems come up...

1. In the GridGroupingControl BarButtonItemClicked event, when i code only

if (e.ButtonBarItem.ButtonBarItemType == ButtonBarItemType.DeleteRow)
{
}
else if (e.ButtonBarItem.ButtonBarItemType == ButtonBarItemType.EditRow)
{
}

then other button such as "ChangePageSize","MoveNextPage","MoveLast" will not work properly, it seems I need to code for each button.

How can I only code for the button "EditRow" and "DeleteRow" and have other buttons work properly?

2. Can you give me an example for using AccessDataSource1.DeleteParameters.Add(@stringname,type of parameter,value); as in aspx, we only need to write 2 values like




3. How can I get the field value for current record in C# (i.e. when I delete or edit a row, i need to get the info of the row thus I can log it)?

Thanks,
Rebecca




GB Gokul B Syncfusion Team July 5, 2007 09:20 PM UTC

Hi Rebecca,

Here is my response to your query.

1) We afraid we are not able to reproduce the issue as you mentioned. Could you please send us your sample which causes this issue. So that we could sort out the cause of the issue and provide you a solution.

2) After specifying the valid Delete command to DatasourceControl, you can call the below code snippet in the BarButtonItemClicked event.

if (e.ButtonBarItem.ButtonBarItemType == ButtonBarItemType.DeleteRow)
{
Record r = this.GridGroupingControl1.Table.CurrentRecord;
this.AccessDataSource1.DeleteParameters.Add("@id", r.GetValue("EmployeeID").ToString());
//Will automatically deletes the current record once the DeleteRow ButtonBarItem is pressed
this.AccessDataSource1.Delete();
}

3) You can read the value of the Current record row once the Save button of the ButtonBarItem is clicked using the below code snippet.

In the GridGroupingControl's CurrentRecordContextChange event

//Update the database once the editing is called.
if(e.Action == CurrentRecordAction.EndEditCalled)
{
//Ensures that AddNewRow is affected.
if(r.GetSourceIndex() == -1)
{
String str=r.GetValue("Columnname").ToString();
}
}

Attached is the sample in which the Current record value is retrieved at runtime.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/F63391/GridGroupingControl_Forum63391/main.htm

Sample Description
------------------
* In our sample, we bind the GridGroupingControl with the AccessDatasourceControl.
* In the CurrentRecordContextChange event We have displayed the value of the AddnewRow in the ListBox once the Editing is completed.

Please try running the above sample and let me know if this helps.

Regards,
Gokulkumar B


IS Ivan Siew September 28, 2007 03:51 PM UTC

Hi there,

have you guys tried getting the EndEditCalled event to fire when inserting a new row into a blank grid? It doesn't work. You get an exception. All your online samples show adding a new row to a grid that already has data. Try adding a new row to a blank grid. As I step through the code, I noticed that e.Action doesn't trap for the EndEditCalled event.

Please let me know how I can trap for that inserting a new row with no data already in the grid.

Ivan


RS Rajarajeswari S Syncfusion Team October 8, 2007 05:29 AM UTC


Hi Ivan,

Please follow up with the Incident.

Regards,
S.Rajarajeswari

Loader.
Live Chat Icon For mobile
Up arrow icon