开发者

RequiredFieldValidator

case "4": //Enumeration RadioButton
  c = new HtmlTableCell();
  RdSecimler = new RadioButtonList();
  RdSecimler.ID = "Rdl_" + item.new_survey_questionid.ToString();
  RdSecimler.RepeatDirection = RepeatDirection.Horizontal;
  RdSecimler.CellPadding = 2;

  c.Align = "center";
  RdSecimler.Attributes.Add("class", "TblCss");

  for (int i = Convert.ToInt32(item.new_min_enumerator); 
           i <= Convert.ToInt32(item.new_max_enumerator); i++)
  {
    LiSecim = new ListItem();
    LiSecim.Text = i.ToString();
    RdSecimler.Items.Add(LiSecim);
  }
  c.Controls.Add(RdSecimler);


  RequiredFieldValidator Rfv_Rd_Btn = new RequiredFieldValidator();
  Rfv_Rd_Btn.ControlToValidate = "Rdl_" 
                                + item.new_survey_questionid.ToString();

  Rfv_Rd_Btn.ErrorMessage = lbl_survey_error_msg.Text;
  plch.Controls.Add(Rfv_Rd_Btn);

ScreenShot

RequiredFieldValidator

I've a survey dynam开发者_Go百科ically generated and this part generates radiobuttonlist for the specified question types. I want to validate it but I've 11 questions for that part and it shows me 9 error messages for 9 empty, but I want only one error message overall.

How can I do that?


You can use a ValidationSummary Control to show them all in one place.

http://msdn.microsoft.com/en-us/library/dd5c6s6h(v=VS.100).aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜