0

I am using the below code to read the page control.Its working fine. I read the specific control but the control is check box, I want to check the checked status of the control. But i can't do this please help me to do this.

foreach (string key in Request.Form)
{
  if (!key.StartsWith("win_")) continue; //win_11 is control id
  string str_val = Request.Form[key];
}

Request.Form[key] return the value of the control. But i want to check the checked status.

4

1 回答 1

0

正如你所说,你找到了复选框的 id,,,所以你可以试试这个......

  foreach (string key in Request.Form)
    {
      if (!key.StartsWith("win_")) continue; //win_11 is control id
      CheckBox cb = this.Page.FindControl("key") as CheckBox;
    if(cb.checked==true)
    {
    Your logic
    }
    else
    {
    your logic
    }
    }
于 2013-04-13T11:59:08.970 回答