I have radgrid which I am binding with a Webservice on the client side.
This is what I want to do:
I want to create a GridTemplateColumn or a GridButtonColumn, when clicked should show a RadConfirm and when clicked "YES/OK" on radconfirm should call another javascript function without doing a postback(or page refresh). Other wise should not do anything.
This is what I have done:
Mark up for the grid template column.
Javascript on Row DataBound:
This is the showDeleteConfirm method:
But everytime I click on the button, it does a postback without calling the javascript function. Help will be appreciated :)
Thank you.
This is what I want to do:
I want to create a GridTemplateColumn or a GridButtonColumn, when clicked should show a RadConfirm and when clicked "YES/OK" on radconfirm should call another javascript function without doing a postback(or page refresh). Other wise should not do anything.
This is what I have done:
Mark up for the grid template column.
<
telerik:GridTemplateColumn
FilterControlAltText
=
"Filter TemplateColumn column"
UniqueName
=
"DeleteColumn"
HeaderText
=
"Delete"
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"btTrash"
ImageUrl
=
"/BSS/Admin/resources/Trash.png"
runat
=
"server"
OnClientClick
=
"DeleteEntry"
></
asp:ImageButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Javascript on Row DataBound:
function
rgUpdateConfigSummary_OnRowDataBound(sender, args) {
//var dataItem = args.get_gridDataItem();
var
SiteID = glbl_SiteID;
var
prodID = args.get_dataItem().ProductID;
var
GenID = args.get_dataItem().GenerationID;
var
DeleteLink = args.get_item().get_cell(
"DeleteColumn"
).getElementsByTagName(
'input'
)[0];
var
attrib_href = document.createAttribute(
'href'
);
attrib_href.value =
'#'
;
DeleteLink.setAttributeNode(attrib_href);
DeleteLink.removeAttribute(
"onclick"
);
var
attrib_onClick = document.createAttribute(
'onclick'
);
attrib_onClick.value =
'showDeleteConfirm('
+ prodID +
','
+ GenID +
',"'
+ SiteID +
'"); '
;
DeleteLink.setAttributeNode(attrib_onClick);
}
This is the showDeleteConfirm method:
function
showDeleteConfirm(prodID, GenID, SiteID) {
radconfirm(
'Client radconfirm: Are you sure?'
,
function
() { confirmDelete(prodID, GenID, SiteID); }, 330, 100,
null
,
'Client RadConfirm'
, imgUrl);
return
false
;
}
function
confirmDelete(prodID, GenID, SiteID) {
var
service =
new
tempuri.org.ImyService();
alert(prodID + GenID + SiteID);
service.Delete(SiteID, prodID, GenID, rebindandclose);
return
false
;
}
But everytime I click on the button, it does a postback without calling the javascript function. Help will be appreciated :)
Thank you.