hello, I have a radgrid with a linkbutton column "Edit". I want to call a modalextenderpopup when a user clicks the Edit button using Javascript. But it is not working:
<
telerik:RadGrid
ID
=
"RadGrid_Search"
runat
=
"server"
AllowPaging
=
"True"
AllowSorting
=
"True"
GroupPanelPosition
=
"Top"
PageSize
=
"30"
ResolvedRenderMode
=
"Classic"
HorizontalAlign
=
"Right"
ondeletecommand
=
"RadGrid_Search_DeleteCommand"
onitemdatabound
=
"RadGrid_Search_ItemDataBound"
oneditcommand
=
"RadGrid_Search_EditCommand"
>
<
MasterTableView
Width
=
"100%"
DataKeyNames
=
"UPC"
>
<
EditFormSettings
>
<
PopUpSettings
Modal
=
"true"
/>
</
EditFormSettings
>
<
Columns
>
<
telerik:GridButtonColumn
UniqueName
=
"DeleteColumn"
Text
=
"Delete"
CommandName
=
"Delete"
ConfirmText
=
"AA"
></
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"EditColumn"
Text
=
"Edit"
CommandName
=
"Select"
></
telerik:GridButtonColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
HeaderStyle
Font-Bold
=
"True"
Font-Names
=
"Verdana"
/>
<
ItemStyle
Font-Names
=
"Verdana"
/>
</
telerik:RadGrid
>
<
cc1:ModalPopupExtender
ID
=
"popup"
BehaviorID
=
"popup1"
runat
=
"server"
DropShadow
=
"false"
PopupControlID
=
"pnlAddEdit"
TargetControlID
=
"lnkDummy"
BackgroundCssClass
=
"modalBackground"
OkControlID
=
"btnYes"
>
</
cc1:ModalPopupExtender
>
Code Behind:
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = e.Item
as
GridDataItem;
string
contactName = dataItem[
"Album Name"
].Text;
LinkButton button = dataItem[
"DeleteColumn"
].Controls[0]
as
LinkButton;
button.Attributes[
"onclick"
] =
"return confirm('Are you sure you want to delete "
+
contactName +
"?')"
;
LinkButton btnEdit = dataItem[
"EditColumn"
].Controls[0]
as
LinkButton;
btnEdit.Attributes[
"onclick"
] =
"return ShowModalPopup()"
;
}
Javascript code :
function
ShowModalPopup() {
try
{
$find(
"popup1"
).show();
}
catch
(err) {
alert(err.message);
}
return
false
;
}
Please advice. Thank you