zoukankan      html  css  js  c++  java
  • asp.net中根据数据库中数据自动设置dropdownlist中选中的值

    //前台

     <asp:DropDownList ID="ddlmodel" runat="server" AutoPostBack="True"
                      onselectedindexchanged="ddlmodel_SelectedIndexChanged">
                   <asp:ListItem Value="2">两</asp:ListItem>
                        <asp:ListItem Value="3" Selected="True">三</asp:ListItem>
                  </asp:DropDownList>

    //后台

    SqlSen ss = new SqlSen();//调用APP_CODE中函数

                string text1, text2, text3, size1, size2, size3, width1, width2, width3;
                ss.SELIDData(id, out text1, out text2, out text3, out size1, out size2, out size3, out width1, out width2, out width3);

                this.t1.Text = text1;
                this.t2.Text = text2;
                this.t3.Text = text3;
                if (this.t3.Text.Equals(""))
                {
                    ddlmodel.SelectedValue = "2";
                    this.t3.Enabled = false;
                }
                if (this.t3.Text != "")
                {
                    ddlmodel.SelectedValue = "3";
                    this.t3.Enabled = true;
                }
                ddlSize1.SelectedValue = ddlSize1.Items.FindByValue(size1).ToString();//将数据库中的数据调给dropdownlist中,使其有自动选择效果
                ddlSize2.SelectedValue = ddlSize2.Items.FindByValue(size2).ToString();
                ddlSize3.SelectedValue = ddlSize3.Items.FindByValue(size3).ToString();

  • 相关阅读:
    pytorch报错:AttributeError: 'module' object has no attribute '_rebuild_tensor_v2'
    python运行报错:cannot import name 'InteractiveConsole'
    sudo pip3找不到命令
    pytorch入门1——简单的网络搭建
    caffe训练时报错
    python滴啊用caffe时的小坑
    求两个字符串的编辑距离
    归并排序
    复杂度n求数组的第K大值
    牛顿法与拟牛顿法学习笔记(一)牛顿法
  • 原文地址:https://www.cnblogs.com/QiuJL/p/4524344.html
Copyright © 2011-2022 走看看