带有if语句的web方法

时间:2015-03-31 19:49:41

标签: c# jquery asp.net

我有转发器,在向下滚动后通过分页获取数据,并在用户点击按钮后获得相同的功能(通过分页获取数据)。

我有webmethod获取如下所述的参数

   [WebMethod]
   public static string GetCustomers(int pageIndex)
   {
    System.Threading.Thread.Sleep(2000);
    return GetCustomersData(pageIndex,false,"").GetXml();
   }

相同的函数GetCustomersData();点击按钮后正在运行

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
    rptCustomers.DataSource = GetCustomersData(1,true,"22");
    rptCustomers.DataBind();
}

第一个webmethod在jquery调用之后运行,第二个webmethod在用户单击按钮后运行。

问题是,在向下滚动后的Javascript文件中,webmethod正在运行。

如何阻止,我的意思是如果用户点击按钮。我想禁用javascript或停止webmethod。即使javascript检测到向下滚动并且webmethod运行

imageButton点击是

 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
    rptCustomers.DataSource = GetCustomersData(1,true,"22");
    rptCustomers.DataBind();
}

感谢adivse

0 个答案:

没有答案