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.
Unfortunately, activation email could not send to your email. Please try again.

Confirm delete from GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

88127 Jul 15,2009 05:35 PM Nov 12,2009 01:24 AM ASP.NET Web Forms (Classic) 7
loading
Tags: GridGroupingControl
John Taylor
Asked On July 15, 2009 05:35 PM

GridGroupingControl v7.203.0.37

What is the recommended method of prompting the user to confirm an action taken (ie: Delete) on a row in the GridControl when using the GridRowEditUpdateLink control?

If using an , I would add a handler to the OnClick event to "return confirm('Are you sure you want to delete?')". The GridRowEditUpdateLink has a "Click" event that I could use in the same manner, but there does not appear to be any way to add a handler for the event.

There is an GridRowEditUpdateEventArgs class, but no corresponding GridRowEditUpdateLinkClickEventHandler. Also, a named GridRowEditUpdateLink control (ie: GridRowEditUpdateLink1) does not show up in intellisense in the code-behind, so I cannot see what class members are available for use.

Rekha P [Syncfusion]
Replied On July 16, 2009 09:12 AM

Hi John,

Thank you for your interest in Syncfusion Products.

We suggest you to enable client side confirmation while deleting the data using GridRowEditUpdateLink ItemTemplate. Please refer the code snippet below to achieve this.



DeleteLinkText="Delete" ShowDeleteLink="true" ShowEditLink="True" runat="server"
CssClass="GridRowEditUpdateTemplate" />






- Add a css class to GridRowEditUpdateLink in order to tag the Delete link.
- Using JQuery, tag the class name for click event.
- Check for the clicked link as "Delete" which is given for DeleteLinkText.
- Return the confirmation.

Refer a sample below which illustrates the above.
http://files.syncfusion.com/support/GGC.Web/7.2.0.37/56853/main.htm

Since, the GridRowEditUpdateLink is embedded as ItemTemplate, we need to access its properties and events by finding the TemplateControls through RowDataBound event using FindControl method. Refer the below code snippet which illustrates this.

void GridGroupingControl1_RowDataBound(object sender, RowDataBoundEventArgs e)
{
if (e.Element.Kind == DisplayElementKind.Record)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
//"Template" is the column name for GridRowEditUpdateLink template.
if (((Syncfusion.Web.UI.WebControls.Grid.Grouping.GridCell)(e.Row.Cells[i])).ColumnDescriptor.Name == "Template")
{
GridRowEditUpdateLink = (GridRowEditUpdateLink)e.Row.Cells[i].FindControl("GridRowEditUpdateLink1");
if (GridRowEditUpdateLink != null)
{
GridRowEditUpdateLink.Click += new EventHandler(GridRowEditUpdateLink_Click);
}
}
}
}
}

void GridRowEditUpdateLink_Click(object sender, GridRowEditUpdateEventArgs e)
{
switch (e.CommandLinkType)
{
case "Delete":
//your code
break;
}
}


Let me know if these helps you out.

Thanks,
Rekha

John Taylor
Replied On July 16, 2009 04:17 PM

Hell Rekha,

Thank you for the example. However, the example does not prompt for a delete. I presumed it was supposed to?

Balaji M [Syncfusion]
Replied On July 20, 2009 10:07 AM

Hi John,

Thank your for your interest in Syncfusion Products.

We are sorry for the inconvenience caused.

Please refer the javascript code snippet below to achieve this.



Please refer the updated sample from below link.
http://files.syncfusion.com/support/GGC.Web/7.2.0.37/88127/main.htm


Please let me know if you have any concerns.

Regards,
M. Balaji

Martin Kappl
Replied On November 3, 2009 08:34 AM

Any news on that problem? It´s still not working that way.

And I´am shocked, that this should be the only way to achieve a simple delete confirmation...

Rekha P [Syncfusion]
Replied On November 4, 2009 07:23 AM

Hi Martin,

I am afraid that I am unable to reproduce the stated issue with the previous updated sample. Could you please try to reproduce it in the above sample and sent us detailed reproducing steps, so that we could able to sort out the cause of the issue and provide you a solution?

Kindly let me know if you have any questions.

Thanks,
Rekha

Martin Kappl
Replied On November 11, 2009 05:16 AM

This line of code is not working for us:

if (e.srcElement.innerText == "Delete") ...

In our case innerText is null, because we are not using the text but an icon.

I changed the JavaScript to look for the icon rather than the text and it works.

But it would be nice, if the grid could support a delete message out of the box without "hacks" like this.

But thanks for the support.

Gowri Manohari D [Syncfusion]
Replied On November 12, 2009 01:24 AM

Hi Martin,

Sorry for the inconvenience caused to you.

We have created sample for your requirement. The sample which already provided you works only when we add "DeleteLinkText". Thats why you could not get the solution. We have modified the sample and mentioned the link here. Please check it.

http://files.syncfusion.com/support/GGC.Web/7.3.0.20/F88127/Sample.zip

Let me know the above sample helps you out.

Regards,
Gowri

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;