webform中获取repeat控件列表下的checkbox选中的值:

码农上代码:

public static string getSelectedIDs(Repeater Rpt_)
        {
            string res = string.Empty;
            foreach (RepeaterItem rtpItem in Rpt_.Items)
            {
                HtmlInputCheckBox obj = rtpItem.FindControl("checkbox") as HtmlInputCheckBox;
                if (obj != null)
                {
                    if (obj.Checked == true)
                    {
                        res += obj.Value.ToString() + ",";
                    }
                }
            }
            if (!string.IsNullOrEmpty(res))
            {
                res = res.Remove(res.LastIndexOf(','));
            }
            return res;
        }

 

相关文章:

  • 2022-12-23
  • 2021-12-23
  • 2021-07-30
  • 2021-12-23
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2022-01-18
  • 2022-01-10
  • 2021-05-31
  • 2021-12-23
  • 2021-04-23
  • 2022-01-18
相关资源
相似解决方案