首页 > 代码库 > girdview 中的radiobutton 的逐行触发checkedselected事件

girdview 中的radiobutton 的逐行触发checkedselected事件

  <asp:TemplateField>                                    <HeaderTemplate>                                        <asp:Label runat="server" Text="Acc"></asp:Label>                                    </HeaderTemplate>                                    <ItemTemplate>                                        <asp:RadioButton ID="RadSelect" runat="server" Text="" GroupName="IsSelect" Checked=‘<%#(Eval("accstatus").ToString()=="1"?true:false)%>‘ EnableViewState="true" AutoPostBack="true" OnCheckedChanged="RadSelect_CheckedChanged" />                                    </ItemTemplate>                                    <ItemStyle HorizontalAlign="Center" />                                </asp:TemplateField>                                <asp:TemplateField>                                    <HeaderTemplate>                                        <asp:Label runat="server" Text="Rej"> </asp:Label>                                    </HeaderTemplate>                                    <ItemTemplate>                                        <asp:RadioButton ID="RadSelect1" runat="server" Text="" GroupName="IsSelect" EnableViewState="true" AutoPostBack="true" OnCheckedChanged="RadSelect1_CheckedChanged" />                                    </ItemTemplate>                                    <ItemStyle HorizontalAlign="Center" />                                </asp:TemplateField>

  

  protected void RadSelect_CheckedChanged(object sender, EventArgs e)        {            RDFunc();        }        protected void RadSelect1_CheckedChanged(object sender, EventArgs e)        {            RDFunc();        }        protected void RDFunc()        {            dbTotalHrs = 0;            double douHrs = 0;            for (int i = 0; i < gvwJOList.Rows.Count; i++)            {                RadioButton rbox = (RadioButton)gvwJOList.Rows[i].FindControl("RadSelect");                if (rbox.Checked == true)                {                    HiddenField hf = (HiddenField)gvwJOList.Rows[i].FindControl("mrrhrs");                    douHrs = (string.IsNullOrEmpty(hf.Value.ToString())) ? 0 : Convert.ToDouble(hf.Value);                    dbTotalHrs += douHrs;                }            }            ScriptManager.RegisterStartupScript(gvwJOList, GetType(), "Get", "processEnd();", true);        } 

  

girdview 中的radiobutton 的逐行触发checkedselected事件