当前位置:编程学习 > C#/ASP.NET >>

委托事件 新手求助 !急急急急急急急急急急急急急急急急急急急!!!!!!!!!!!!

  protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        result1 = DropDownList1.SelectedValue;
        GetInspectionItem();
        ClearFormControl();
    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        result2 = DropDownList2.SelectedValue;
        GetInspectionItem();
        ClearFormControl();
    }
    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
    {
        result3 = DropDownList3.SelectedValue;
        GetInspectionItem();
        ClearFormControl();
    }
以上的我想用一个方法写要怎么写啊?还要知道是哪个DropDownList选择的,谢谢了 在线等答案 --------------------编程问答-------------------- 将每个DropDownList中嵌入该方发的调用,并且传入相应的id号来区分是哪个DropDownList传来的 --------------------编程问答--------------------
  
static private int i=0;
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
    { 
        i=1;
        result1 = DropDownList1.SelectedValue; 
        GetInspectionItem(); 
        ClearFormControl(); 
    } 
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) 
    { 
        i=2;
        result2 = DropDownList2.SelectedValue; 
        GetInspectionItem(); 
        ClearFormControl(); 
    } 
    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) 
    { 
        i=3;
        result3 = DropDownList3.SelectedValue; 
        GetInspectionItem(); 
        ClearFormControl(); 
    } 

    private int getWhich_Select()
   {
      if(i==1).......
       if(i==2).......
       if(i==3).......
   }
...自己写了 --------------------编程问答--------------------
引用 2 楼 wolf_410 的回复:
C# code  
static private int i=0;
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
    { 
        i=1;
        result1 = DropDownList1.SelectedValue; 
        GetInspectionItem(); 
        ClearFormControl(); 
    } 
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) 
    { 
        i=2;
        result2 = DropDownList2.Sele…



我不是这个意思 ,我是让这三个DropDownList1_SelectedIndexChanged事件写在一个方法里,并且知道是选择哪一个DropDownList
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,