HtmlInputRadioButton具有静态ID's-ClientIDmode = static不起作用

时间:2018-10-19 08:47:35

标签: c# asp.net

      HtmlInputRadioButton radioInput = new HtmlInputRadioButton();
        radioInput.Attributes["title"] = x + "," + j;
        radioInput.ID = "radioBtn" + direction + boundIndex;
        radioInput.Value = i.ToString();
        radioInput.Name = "radio" + (isMultiSearch ? direction + i + "," + x : direction + i);
        radioInput.Checked = !String.IsNullOrEmpty(strChecked);
        radioInput.ClientIDMode = System.Web.UI.ClientIDMode.Static;

        phRadioBtn.Controls.Add(radioInput);

您好,即使我指定了ClientIDMode =“ Static”,单选按钮也会显示如下:

 <div style="display:block;">
 <input value="0" name="ctl00$BodyPlaceHolder$ucFlightOuterBox0$ctl04$radioLeave0" type="radio" id="radioBtnLeave5" title="0,4">
</div>

代码位于webUserControl中,并且我们还有一个母版页。“ phRadioBtn”是ascx页中的占位符。

0 个答案:

没有答案