Another thing I saw is that you can use the context object in the
callback. In the request and in the callback you are using this code:
var page=parseInt(Form1.txtCurrentPage.value);
What you can do is following in the request:
function LoadCounty(dropdownlist1){
var countryId=dropdownlist1.selectedIndex;
var province=dropdownlist1.options(parseInt(countryId)).text;
var page=parseInt(Form1.txtCurrentPage.value);
if (countryId > 0)
{
//alert('return');
County.ReturnDataTableCounty(province,page,test15_callback, page);
County.ReturnRecordNumber(province,text16_callback, page);
}
}
See the additional "page" argument in the call after the callback
argument. In the callback handler you can access this argument using
following code:
function test15_callback(res){
var dt= res.value;
// var page=parseInt(Form1.txtCurrentPage.value);
var page = res.context;
// ...
}
Regards,
Michael
On 5/2/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi
> I used ajax with asp.net 1.1 and made the following
> javascript code that worked very well.
> (I translated some variables, originally italian style in English.)
>
> When i used the same code in ASP.NET 2.0 with relative new AJAXPRO
> only worked either
> County.ReturnDataTableCounty(province,page,test15_callback) or
> County.ReturnRecordNumber(province,test16_callback), but not both at
> the same time.
> Is there anybody that can helpme?
> best regards and thanx
>
>
>
> function LoadCounty(dropdownlist1){
> //alert('called');
> var countryId=dropdownlist1.selectedIndex;
> var province=dropdownlist1.options(parseInt(countryId)).text;
> var page=parseInt(Form1.txtCurrentPage.value);
> if (countryId > 0)
> {
> //alert('return');
> County.ReturnDataTableCounty(province,page,test15_callback);
> County.ReturnRecordNumber(province,text16_callback);
> }
>
> }
>
> function test15_callback(res){
> var dt= res.value;
> var page=parseInt(Form1.txtCurrentPage.value);
> var mPage="&Page=" +page;
> var event="";
> tableDisplay.innerHTML="";
> if(typeof(res) == 'object' && typeof(dt) == 'object'){
> var s = new Array();
> s[s.length]="<table cellPadding=1 cellSpacing=1 rules=rows
> border=1>";
> s[s.length]="<tr style=background-color:Lightgreen
> ;font-size:X-Small;>";
>
> s[s.length]="<td
> style=width:150px>Description</td><td>Delete</td><td>Modify</td></tr>";
>
> for(var i=0; i<dt.Tables[0].Rows.length; i++){
> s[s.length]="<tr style=font-size:X-Small;>";
>
> s[s.length]="<td style=width:150px;>" +
> dt.Tables[0].Rows[i].descrizione + "</td>";
>
> //
>
> s[s.length]="<td align=center>" + "<a
> HREF=County.aspx?Delete=1&id="
> + dt.Tables[0].Rows[i].id_tipocomune + "&idProvincia=" +
> dt.Tables[0].Rows[i].id_regione + mPage + "><img src=images/trash.gif
> alt='' border=0 style=font-size:Small></A></td>";
> s[s.length]="<td align=center>" + "<a
> HREF=County.aspx?Edit=1&id=" +
> dt.Tables[0].Rows[i].id_tipocomune + "&idProvincia=" +
> dt.Tables[0].Rows[i].id_regione + mPage + ">Go!</A></td>";
> s[s.length]="<tr>";
> }
> s[s.length]="</table>";
> tableDisplay.innerHTML=s.join("");
> }
>
> }
> function test16_callback(res){
> //
> Form1.txtNoComuni.value=res.value;
> var PageCount;
> PageCount=Math.ceil(res.value/5);
> var s="";
> if (0==PageCount){
> pager.innerHTML=s ;
> return;
> }
> pager.innerHTML=s ;
> var CurrentPage;
> CurrentPage=parseInt(Form1.txtCurrentPage.value);
> if (CurrentPage>1)
> s= s + SinglePage(CurrentPage -
> 1,"<b><<</b>","County.aspx");
> //le altre pagine
> for (var i = 0; i<PageCount; i++){
> s= s + SinglePage(i+1, "","County.aspx");
> }
> if (CurrentPage < PageCount)
> s=s+ SinglePage(CurrentPage + 1,
> "<b>>></b>","County.aspx");
> pager.innerHTML=s ;
> }
>
> function SinglePage(Page,Text,Url){
> if (Text == "")
> Text = Page;
> var ThePage;
> ThePage = "?Page=" + Page;
> var CurrentPage;
> CurrentPage=Form1.txtCurrentPage.value;
> var TheRegion;
> TheRegion="&Regione=" + document.Form1.regioni.value;
> TheRegion=TheRegion.replace(" ","%20")
> var TheProvince;
> TheProvince="&Provincia=" + document.Form1.provincie.value;
> TheProvince=TheProvince.replace(" ","%20")
> if (CurrentPage == Page)
> return "<b>[" + Page + "]</b>";
> else
> return " <a id=" + "A" + Page + " href=" + Url + ThePage +
> TheRegion + TheProvince + ">" + Text + "</a>";
> }
>
>
> >
>
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---