HI,
i am having grid with edit mode(update ,delete , automatic insert) and i want a validation using rad window that sure to delete if client select yes then record will be deleted otherwise not,
and after thar success msg apper on insert data
Thanks
i am having grid with edit mode(update ,delete , automatic insert) and i want a validation using rad window that sure to delete if client select yes then record will be deleted otherwise not,
and after thar success msg apper on insert data
Thanks
3 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 09 Oct 2013, 11:57 AM
Hi Swapnil,
If you are using a GridButtonColumn for Delete operation,please try the following code snippet.
ASPX:
In case if you are using AutoGenerateDeleteColumn,please try the following code snippet.
C#:
Thanks,
Princy
If you are using a GridButtonColumn for Delete operation,please try the following code snippet.
ASPX:
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this product?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"DeleteColumn"
>
</
telerik:GridButtonColumn
>
In case if you are using AutoGenerateDeleteColumn,please try the following code snippet.
C#:
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
LinkButton lnkBtnDelete = (LinkButton)item[
"AutoGeneratedDeleteColumn"
].Controls[0];
lnkBtnDelete.Attributes[
"onclick"
] =
"javascript:return confirm(\'Do you want to delete this item?\')"
;
}
}
Thanks,
Princy
0
Swapnil
Top achievements
Rank 1
answered on 09 Oct 2013, 12:18 PM
After deletion How can i show that record deleted successfully?
and i also want to show the success msg for data insertion
THANKS
and i also want to show the success msg for data insertion
THANKS
0
Accepted
Princy
Top achievements
Rank 2
answered on 10 Oct 2013, 04:56 AM
Hi Swapnil,
I guess you are using Automatic CRUD operation.Please try the following code snippet to open confirm window for you operations.
ASPX:
C#:
Thanks,
Princy
I guess you are using Automatic CRUD operation.Please try the following code snippet to open confirm window for you operations.
ASPX:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
EnableAJAX
=
"true"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadWindowManager1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
</
telerik:RadWindowManager
>
C#:
protected
void
RadGrid1_ItemInserted(
object
source, GridInsertedEventArgs e)
{
if
(e.Exception !=
null
)
{
e.ExceptionHandled =
true
;
RadWindowManager1.RadConfirm(
"New product is not inserted"
,
null
, 300, 200,
null
,
"Insert"
);
}
else
{
RadWindowManager1.RadConfirm(
"Successfully New product is inserted"
,
null
, 300, 200,
null
,
"Insert"
);
}
}
protected
void
RadGrid1_ItemDeleted(
object
source, GridDeletedEventArgs e)
{
GridDataItem dataItem = (GridDataItem)e.Item;
String id = dataItem.GetDataKeyValue(
"ProductID"
).ToString();
if
(e.Exception !=
null
)
{
e.ExceptionHandled =
true
;
SetMessage(
"Product with ID "
+ id +
" cannot be deleted. Reason: "
+ e.Exception.Message);
}
else
{
RadWindowManager1.RadConfirm(
"Product with ID "
+ id +
" is deleted!"
,
null
, 300, 200,
null
,
"Delete"
);
}
}
Thanks,
Princy