方法从一页到另一页

方法从一页到另一页

本文介绍了调用所需的函数(方法从一页到另一页)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一页上有一个链接按钮..以及每个链接按钮事件.我想输入一个代码

i have a link buttons on one page.. and again each link button event. i want to put a code

while (dr.Read())
{
  // i am putting the code in different linkbutton events i.e linkbutton1,linkbutton 2
   if(proid == String.Empty)
   {
      proid =  dr["ProductID"].ToString();
   }
   else
   {
      proid += "," + dr["ProductID"].ToString();
   }
Response.Redirect("ProductCatalog.aspx?ID="+proid);
//here i want to call a fuction which i have programmed on productcatalog.aspx page..

}



在productcatalog.aspx页面上

我有不同的功能



on productcatalog.aspx page

i have different functions

public void less()
{
/*  block of code i use for loading data in grid view */
"Select * from Products where ProductID in ('" + Request.QueryString["ID"].ToString().Substring(1) +"') AND UnitCost <5000;
}







public void more()
{
/*  block of code  i use for loading data in grid view */
"Select * from Products where ProductID in ('" + Request.QueryString["ID"].ToString().Substring(1) +"') AND UnitCost between 5000 and 10000";



如何从主页上的不同链接按钮调用不同的所需方法



how can i call the different the desired method from different linkbuttons on main page

推荐答案

using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;

public static class GeneralUtilities
    {
    public static MyReturnValue Less(MyParameterType myParam)
        {
        ...
        }
    }

然后您就可以在两个页面中访问它.

You can then access it in both pages.


If(Request.QueryString["less"] !=null)
{
if(Convert.ToBoolean(Request.QueryString["less"]))
{
less();
}
else
{
more();
}
}



希望这会有所帮助:)

谢谢
Vinod



Hope this will help :)

Thanks
Vinod


这篇关于调用所需的函数(方法从一页到另一页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 01:47