表有两列A,B
怎么在选择A列(下拉框)中数据时,B列显示相应的内容
比如,A中有学生a,但选择a时,B列显示学生a,出生于...,即相关描述
此描述为针对A中数据的,可以在程序中写

解决方案 »

  1.   

    没太明白你的意思选了学生名字A  对应的下拉列表也就取到了key或者其他的什么什么可以做条件的东西
    然后  select b from table where key=“key”这样就取到B了   你想怎么处理就怎么处理呗?
      

  2.   

    A列的值是可以编辑或者添加的么如果不是,swtich解决!A,B的键值设为有关系的即可
      

  3.   


    这是我写的部分代码
    private void AfterRowColChange(object sender, EventArgs e)
            {
                object[] args = new object[] { "学生1", "学生2", "学生3" };                 
                string flag = this.student.Rows[0]["A"].ToString();
                switch (flag)
                {
                    case "1":
                        this.student.Rows[0]["B"] = args[0];
                        break;
                    case "2":
                        this.student.Rows[0]["B"] = args[1];
                        break;
                    case "3":
                        this.student.Rows[0]["B"] = args[2];
                        break;
                }
            }
    我要的是A中数据选择时,比如选1,B列自动显示 学生1 的描述,而不是从表中去读
      

  4.   

    http://blog.csdn.net/pvfhv/archive/2010/12/24/6095534.aspx
      

  5.   

    dropdownlist中绑定数据,autopostbak=true
    <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
      <div>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
      <asp:DropDownList ID="ddlLB" runat="server" Width="15%" AutoPostBack="True" OnSelectedIndexChanged="ddlLB_SelectedIndexChanged">
      </asp:DropDownList>
      <asp:DropDownList ID="ddlChild" runat="server" Width="20%">
      </asp:DropDownList>
      </ContentTemplate>
      </asp:UpdatePanel>
      </div>  
      protected void ddlLB_SelectedIndexChanged(object sender, EventArgs e)
      {
      if(this.ddlLB.SelectedValue!=null)
      {
      BindChild(this.ddlLB.SelectedValue);
      }
      }DropDownList2.DataSource=lst;
    DropDownList2.DataValueField="name";
    DropDownList2.DataTextField="name";
    DropDownList2.DataBind();
      

  6.   

     private void yytdictGrid1_AfterSelChange(object sender, C1.Win.C1FlexGrid.RangeEventArgs e)
            {
                object[] args = new object[] { "一级公司", "二级公司", "三级公司" };
                string flag = "";
                dictReference1.SelectedValue = flag;
                if (this.dictReference1.SelectedValue != null)
                {
                    switch (flag)
                    {
                        case "甘肃金轮文化传媒有限公司武威分公司":
                            this.ps_perm.Rows[0]["SLEVELDESC"] = args[0];
                            break;
                        case "2":
                            this.ps_perm.Rows[0]["SLEVELDESC"] = args[1];
                            break;
                        case "3":
                            this.ps_perm.Rows[0]["SLEVELDESC"] = args[2];
                            break;
                    }
                }
            }这样行吗?
      

  7.   

    还有列A的下拉框是用参照做的,事件是应该写参照的还是grid的
      

  8.   

    for (int i = 0; i < yytdictGrid1.Grid.Rows.Count; i++)
                {
                    if (this.dictReference1.SelectedValue != null)
                    {
                        string flag = "";
                        flag = dictReference1.SelectedValue;
                        switch (flag)
                        {
                            case "2LA110260Q":
                                this.yytdictGrid1.Grid.Rows[i]["SLEVELDESC"] = args[0];
                                break;
                            case "2":
                                this.yytdictGrid1.Grid.Rows[i]["SLEVELDESC"] = args[1];
                                break;
                            case "3":
                                this.yytdictGrid1.Grid.Rows[i]["SLEVELDESC"] = args[2];
                                break;
                        }
                    }
                }怎么在加载的时候列名也该了呢?只要列的数据变咋整?