protected void Page_Load(object sender, EventArgs e)
    {
        Liter.Text = GetTop();
    }
GetTop(string compname)
{
}我GetTop()这个方法  里面有个参数  在上面调用的时候 怎么往里头写参数啊   对于Page_Load(object sender, EventArgs e) 这个方法不太了解

解决方案 »

  1.   

    string str="abc";
    Liter.Text = GetTop(str);楼主还是学学基础吧
      

  2.   


    但是参数是从前台输入进来的传过来的  不是固定的参数  正常传参不应该是这样的吗  举个例子public string asdf(string ddd)
    {
        GetTop(ddd);
    }
    只是 我不知道  Page_Load(object sender, EventArgs e)  这个方法 怎么写参数  
      

  3.   

    Quote: 引用 3 楼 s3136958 的回复:

    参数是从前台输入进来的传过来的
    Quote:

    get方式就用Request.QueryString,post方式就用Request.Form获取
      

  4.   


    传字符串要用双引号GetTop(”ddd“);
    串数字就不用了GetTop(123);
    记住传数字或者字符串  跟你下面定义的接收参数必须对应。
    GetTop(string compname)
      

  5.   

    string str=TextBox1.Text;
     Liter.Text = GetTop(str);这里的str是个变量,不需要双引号
      

  6.   

    如果是当前页面加载 :  Control ctrl = FindControl("txt");
      HtmlInputText txtCtrl= (HtmlInputText)ctrl;
      txtCtrl.Value
      Liter.Text = GetTop(txtCtrl.Value);如果是其他页面加载:  Liter.Text = GetTop(Request["提交页面参数名字"]);
    或者:
      Liter.Text = Request.Form["控件名称"]