繁体   English   中英

GridView1:如何保存下拉列表中的选定值并使之可见

[英]GridView1: How to save the selected value from the dropdownlist and make it visible

  • 我有一个下拉列表。
    • 名为id的列具有控件下拉列表(我已将文本框更改为下拉列表)。
    • 下拉列表包含2个值:是/否。

在gridview行更新中,我要保存在下拉列表中选择的值。 我怎样才能做到这一点? 另外,如何使在下拉列表中选择的值在gridview中可见。

s

试试这个

   protected void GridViewRowUpdating(object sender, GridViewUpdateEventArgs e)
    {
          var rowIndex = e.RowIndex;
          var row = GridView.Rows[rowIndex];
          var ddl = row.FindControl("YOURDROPDOWN") as DropDownList;
          if(ddl != null)
          var value = ddl.SelectedValue;
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM