2013-06-26 49 views
0

我有以下的标记:RUNAT =服务器无法正常工作HTML单选按钮

<div class="control-group"> 
    <label class="control-label" for="rdbActive">Active</label> 
    <div class="controls"> 
     <label class="radio inline" for="rdbActive0"> 
     <input name="rdbActive" id="rdbActive0" value="Yes" checked="checked" type="radio">Yes 
     </label> 
     <label class="radio inline" for="rdbActive1"> 
     <input name="rdbActive" id="rdbActive1" value="No" type="radio">No 
     </label> 
    </div> 
</div> 

如何让我这个RUNAT =服务器?

对于文本输入所有我能做的就是:

<div class="control-group"> 
    <label class="control-label" for="txtDescription">Description</label> 
    <div class="controls"> 
     <input id="txtDescription" runat="server" name="txtDescription" placeholder="" class="input-large" type="text"> 
    </div> 
</div> 

..和我能够从代码中访问它的后面。如果我将它添加到任何单选按钮,我会得到一个500服务器错误。

回答

3

您可以创建单选按钮runat="server"为:

<asp:RadioButton id="RadioButton1" AutoPostBack="True|False" Checked="True|False" GroupName="GroupName" Text="label" TextAlign="Right|Left" OnCheckedChanged="OnCheckedChangedMethod" runat="server" /> 

哪里OnCheckedChangedMethod是代码隐藏方法时,单选按钮被选中时被调用。

在MSDN网站上查看此reference