Hi! I'm working on a project using radgrid, radajaxmanager, radcontextmenu and I've encountered a problem which i cant seem to figure out. The app is ment for tablets so I'm using jquery mobile's taphold event. On taphold i'm showing a radcontextmenu. On taphold I simulate a click on the row (i have a mouse tracking event that sends coordinates of the row I want clicked) so i can take the index number of the row and write it to a hidden field which I use in codebehind to open a radwindow with html query data(based on the data in the row).
The problem is that if I have radajaxmanager enabled that functionality works only the first time. On the second time I get a javascript error that the object is null. I tried alot of things, so in the end I disabled radajaxmanager and found out that everything works out if it's disabled. But ofcourse I like your ajaxmanager so I'd like to use it. So i'm coming to you, the guys that know radajaxmanager best.
And now lets look at the code:
This is my hidden field and my radgrid markup.
This is my radajaxmanager
These are the client settings for radgrid
This is the javascript line that becomes null after only one use if radajaxmanager is on
This is the javascript code that handles the taphold and ajaxstart-end
$(document).mousemove(
function
(e) {
window.x = e.pageX;
window.y = e.pageY;
//console.log(window.x);
});
$(window).load(
function
() {
});
$(document).ready(
function
() {
var
menu = $find(
"<%=RadMenu1.ClientID %>"
)
$(
function
() {
$(
"tr.rgRow"
).bind(
"taphold"
, tapholdHandler);
$(
"tr.rgAltRow"
).bind(
"taphold"
, tapholdHandler);
function
tapholdHandler(e) {
$(document.elementFromPoint(x, y)).click();
menu.showAt(x, y)
}
});
});
$(window).resize(
function
() {
});
function
RowContextMenu(sender, eventArgs) {
var
evt = eventArgs.get_domEvent();
if
(evt.target.tagName ==
"INPUT"
|| evt.target.tagName ==
"A"
) {
return
;
}
var
index = eventArgs.get_itemIndexHierarchical();
// THIS IS WHAT IS NULL AFTER THE FIRST TIME
document.getElementById(
"radGridClickedRowIndex"
).value = index;
}
var
AjaxIsActive =
false
;
function
RequestStart(sender, args) {
if
(!AjaxIsActive) {
AjaxIsActive =
true
;
}
else
{
alert((
typeof
ActiveAJAXMessage ===
'undefined'
) ?
'Wait for ajax to finish'
: ActiveAJAXMessage);
return
false
;
}
document.body.style.cursor =
"wait"
;
//*************************************************************************
if
(args.get_eventTarget().indexOf(
"ExportToExcelButton"
) >= 0 ||
args.get_eventTarget().indexOf(
"ExportToWordButton"
) >= 0 ||
args.get_eventTarget().indexOf(
"ExportToPdfButton"
) >= 0 ||
args.get_eventTarget().indexOf(
"ExportToCsvButton"
) >= 0) {
args.set_enableAjax(
false
);
ResponseEnd();
}
if
(args.get_eventTarget().indexOf(
"btn_Dok_PrikaziDok"
) >= 0) {
args.set_enableAjax(
false
);
ResponseEnd();
}
}
function
ResponseEnd(sender, args) {
AjaxIsActive =
false
;
document.body.style.cursor =
"default"
;
}
EDIT: Forgot to add my RadAjaxManager onAjaxRequest: