RowDataBound
イベントのgridviewでGridViewRow
の中にHtmlInputRadioButton
の名前を設定しています。問題は、asp.netが自動的に名前をユニークにし、ラジオボタンをグループ解除することです。ASP.NET GridViewのHtmlInputRadioButtonの名前をコードの後ろから設定します
これを無効にする方法はありますか?
編集 - ここで私は名前を設定しています方法は次のとおりです。
Private Sub gvFoo_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSecPos.RowDataBound
If Not (e.Row.RowType = DataControlRowType.DataRow) OrElse (e.Row.Cells(0) Is Nothing) Then
Return
End If
Dim drFoo As DataRowView = CType(e.Row.DataItem, DataRowView)
Dim rbFoo As HtmlInputRadioButton = CType(e.Row.FindControl("rbFoo"), HtmlInputRadioButton)
rbFoo.Name = "Foo" 'ASP.NET makes this unique which I do not want
rbFoo.Value = "A Value"
End Sub
は「 "106" により番号に代わり
<input type="radio" id="ctl00_ContentPlaceHolder1_ucFoo_gvFoo_ctl06_rbFoo" name="Foo" value="A Value">
<input type="radio" id="ctl00_ContentPlaceHolder1_ucFoo_gvFoo_ctl07_rbFoo" name="Foo" value="A Value">
のこのHTML
<input type="radio" id="ctl00_ContentPlaceHolder1_ucFoo_gvFoo_ctl06_rbFoo" name="ctl00$ContentPlaceHolder1$ucFoo$gvFoo$ctl06$Foo" value="A Value">
<input type="radio" id="ctl00_ContentPlaceHolder1_ucFoo_gvFoo_ctl07_rbFoo" name="ctl00$ContentPlaceHolder1$ucFoo$gvFoo$ctl07$Foo" value="A Value">
を生成し、それぞれのラジオボタンの名前に「107」を入力すると、グループが解除されます。
での例を参照してください。名? – jrummell
クライアント側の入力名 – Drahcir
どのようにユニークなのですか?それは何が外に出るのですか? –