Wednesday, March 21, 2012

Ajax and GridView Sorting or paging

Hello,

I have a main page , it's contain a call page with gridview (with features sorting and paging)

But when I click on link PAGE1, and I click on sorting, It's my page'myPageGridview.aspx' that load.

My aspx page

<head>

<title>Untitled Page</title>

<scriptlanguage=JavaScriptsrc="JavaScript/Ajax.js"></script>

</head>

<body>

<Aclass=parchemin_suite_linkonclick=javascript:show_entry('myPageGridview.aspx');href="#">Page 1</A>

<DIVid=parchemin_zonestyle="DISPLAY: none; LEFT: 102px; POSITION: absolute; TOP: 44px">

<Aonclick=javascript:hide_entry();href="#">Hidden page</A><DIVid=parchemin></DIV>

</DIV>

</body>

</html>

My Javascript page :

var ajax=false;

try

{

// All

ajax =new ActiveXObject("Msxml2.XMLHTTP");

}catch (e) {

try {

// IE

var MSXML_XMLHTTP_PROGIDS =new Array(

'MSXML2.XMLHTTP.5.0',

'MSXML2.XMLHTTP.4.0',

'MSXML2.XMLHTTP.3.0',

'MSXML2.XMLHTTP',

'Microsoft.XMLHTTP'

);

for (var i=0; i < MSXML_XMLHTTP_PROGIDS.length ; i++) {

try {

ajax =new ActiveXObject(MSXML_XMLHTTP_PROGIDS[i]);

//alert(MSXML_XMLHTTP_PROGIDS[i]);

}

catch (e)

{

ajax =false;

}

}

}

catch (E) {

ajax =false;

}

}

// Mozilla / Safari

if (!ajax &&typeof(XMLHttpRequest)!='undefined') {

ajax =new XMLHttpRequest();

}

function getMyHTML(serverPage, objID) {

ajax.open("GET", serverPage);

ajax.onreadystatechange =function() {

//alert("Status : " + ajax.status);

if (ajax.readyState == 4 && ajax.status == 200) {

document.getElementById(objID).innerHTML = ajax.responseText;

document.getElementById('parchemin_zone').style.display='';

}

}

ajax.send(null);

}

function show_entry(entry_id)

{

getMyHTML(entry_id,'parchemin');

}

function hide_entry()

{

document.getElementById('parchemin_zone').style.display='none';

}

function view_entry()

{

document.getElementById('parchemin_zone').style.display='inline';

}

function ismaxlength(obj){

var mlength = obj.getAttribute ? parseInt(obj.getAttribute("maxlength")) :""

if (obj.getAttribute && obj.value.length > mlength)

obj.value = obj.value.substring(0, mlength)

}

nobody has idea ?

when I use an Autopostback, I have this error.

For exemple, I have a main page width 3 page include in Ajax.

when I use autopostback, my page reload width only my table.


Instead of using Ajax I would recommend that you use Atlas. What's the difference? Well Atlas is based on Ajax, at least the idea of Ajax anyway, but it does all the hard work for you. If you download the December release of Atlas (http://www.asp.net/default.aspx?tabindex=7&tabid=47) and visit this blog (http://www.nikhilk.net/AtlasM1.aspx) you will see how easy it is to use. It will virtually eliminate any XML or JavaScript that you have to write. But to answer you question directly. I have no idea what could be wrong with your code. I think that your question would be best served on an Ajax specific forum.

Good luck.

No comments:

Post a Comment