簡體   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