2013-06-26 47 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