1

我有一个网格视图,其项目模板如下

<ItemTemplate>
    <asp:RadioButton ID="rdoSel" runat="server"  />     
</ItemTemplate>

它被渲染为

    <input id="rdoSel" type="radio" name="ctl00$MainContent$tabFund$TabPanel3$gvAutoMatchFund$ctl06$rdoSel" value="rdoSel" />

在 gridview rowdatabound 事件中,当我将此值设置为某个新值时,

    protected void gvAutoMatchFund_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            USP_MDM_SUGGESTED_AUTOMATCH_FUNDResult objUSP_MDM_SUGGESTED_AUTOMATCH_FUNDResult = (USP_MDM_SUGGESTED_AUTOMATCH_FUNDResult)e.Row.DataItem;


            string sValue = "rdoSel_" + objUSP_MDM_SUGGESTED_AUTOMATCH_FUNDResult.DYNAMO_FUNDID
                        + "_" + objUSP_MDM_SUGGESTED_AUTOMATCH_FUNDResult.INVESTRAN_SYSTEMFUNDID
                        + "_" + objUSP_MDM_SUGGESTED_AUTOMATCH_FUNDResult.INVESTRAN_FUNDID;

            RadioButton rdoSel = (RadioButton)e.Row.FindControl("rdoSel");         
            rdoSel.InputAttributes["value"] = sValue; 
        }
    }

它被渲染如下,具有两次“值”属性。

    <input id="rdoSel" type="radio" name="ctl00$MainContent$tabFund$TabPanel3$gvAutoMatchFund$ctl06$rdoSel" value="rdoSel" value="rdoSel_DD62E413-603B-4514-8798-FE9F0C478A35_418_1498" />

任何线索为什么会发生以及如何解决它?无法通过许多其他论坛得到答案,所以在这里发布。

4

0 回答 0