I am attempting to create a change log when a radgrid item has been deleted. I would like to take the current values and write them to a different table. How can I access the values before they are deleted? I am using the methods below.
end if
<
asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')"
runat
="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Img/Delete.gif" />Delete selected customers</asp:LinkButton>
If e.CommandName = "DeleteSelected" Then
......
end if
5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 29 Apr 2009, 01:13 PM
Hello Philip,
You can access the items in the Delete Command before you perform the delete operation:
c#:
Thanks
Princy.
You can access the items in the Delete Command before you perform the delete operation:
c#:
protected void RadGrid2_DeleteCommand(object source, GridCommandEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem dataItem = (GridDataItem)e.Item; |
string strtxt1 = dataItem["ContactName"].Text; |
string strtxt2 = dataItem["ContactTitle"].Text; |
} |
// code to delete |
} |
Thanks
Princy.
0

Monica
Top achievements
Rank 1
answered on 01 Mar 2012, 07:15 PM
Princy,
If the column have a bool value; the property Text doesn´t work for get the value; ( text=" ")
What I can do to get the value?
Thanks in advance
If the column have a bool value; the property Text doesn´t work for get the value; ( text=" ")
What I can do to get the value?
Thanks in advance
0

Princy
Top achievements
Rank 2
answered on 02 Mar 2012, 07:55 AM
Hello,
You can access the bool value as shown below.
C#:
Thanks,
Princy.
You can access the bool value as shown below.
C#:
bool
strtxt1 =Convert.ToBoolean(dataItem[
"UniqueName"
]);
Thanks,
Princy.
0

Monica
Top achievements
Rank 1
answered on 02 Mar 2012, 03:28 PM
Hello Princy
If it is a GridCheckBoxColumn a get the value as follows:
That it is correct?
Have a nice day!
If it is a GridCheckBoxColumn a get the value as follows:
bool
checkbox;
if
(e.Item
is
GridDataItem)
{
GridDataItem deletedItem = e.Item
as
GridDataItem;
checkbox =
bool
.Parse((deletedItem[
"UniqueName"
].Controls[0]
as
CheckBox).Checked.ToString());
}
That it is correct?
Have a nice day!
0
Hello Monica,
You are accessing the CheckBox control inside GridCheckBoxColumn properly. Note that you could access the CheckBox Checked properly directly without the need of parsing.
Additionally, you could go through the help article below for more in depth information on the topic:
Regards,
Antonio Stoilkov
the Telerik team
You are accessing the CheckBox control inside GridCheckBoxColumn properly. Note that you could access the CheckBox Checked properly directly without the need of parsing.
bool
checkbox;
if
(e.Item
is
GridDataItem)
{
GridDataItem deletedItem = e.Item
as
GridDataItem;
checkbox = (deletedItem[
"UniqueName"
].Controls[0]
as
CheckBox).Checked;
}
Additionally, you could go through the help article below for more in depth information on the topic:
Regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.