在单选按钮上单击显示模式弹出窗口

时间:2013-09-26 11:50:23

标签: c# asp.net c#-4.0 c#-3.0 c#-2.0

<tr>
    <td align="left">Have you asked the employee to leave without serving the notice period</td>
    <td align="left">
        <asp:RadioButton ID="rdoBtnleaveWoNoticeyes" runat="server" GroupName="Replacement" 
             Text="Yes" Font-Names="Arial" Font-Size="Small" AutoPostBack="true" 
             oncheckedchanged="rdoBtnleaveWoNoticeyes_CheckedChanged" /> &nbsp;
        <asp:RadioButton ID="rdoBtnleaveWoNoticeno" runat="server" GroupName="Replacement" 
             Text="No" Font-Names="Arial" Font-Size="Small"  AutoPostBack="true"
             oncheckedchanged="rdoBtnleaveWoNoticeno_CheckedChanged" />
    </td>
    <td align="left" colspan="2"><%--Remark--%>
    </td>
</tr>
<cc1:ModalPopupExtender ID="cc18_ModalPopupExtender" 
     runat="server" BackgroundCssClass="modalBackground" TargetControlID="rdoBtnleaveWoNoticeyes" PopupControlID="Panel18" CancelControlID="btnwonoticeperiod">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel18" runat="server" CssClass="modalPopup" Style="display: none;top:50px">
    <table width="90%" border="0" style="border-collapse:collapse;font-family: Arial; font-size: small" cellpadding="2" cellspacing="2">
        <tr><td align="left">
            <asp:Label ID="lbl_leaveWoNotice" runat="server" ></asp:Label>
             </td>
        </tr>
        <tr><td align="center">
            <asp:Button ID="btnwonoticeperiod" runat="server"  Text="Save" OnClick="btnPLAdjSave_Click" CssClass="clsButtonpopup" />&nbsp;
            <asp:Button ID="Button2" runat="server" Text="Cancel" CssClass="clsButtonpopup" />
        </td></tr>
    </table>
</asp:Panel>

我想在上面选中的单选按钮上显示模态弹出窗口是设计。下面是代码。我没有得到输出,请建议做什么

protected void rdoBtnleaveWoNoticeyes_CheckedChanged(object sender, EventArgs e)
{
    if (rdoBtnleaveWoNoticeyes.Checked == true)
    {
        lbl_leaveWoNotice.Text = "As you have asked the employee to leave without serving notice, there will be no Notice recovery from employee and employee will receive his PL encashment treating this as “Ask to leave” case.";
        trNoticePayRecovery.Visible = true;
        cc18_ModalPopupExtender.TargetControlID = "rdoBtnleaveWoNoticeyes";
        cc18_ModalPopupExtender.Show();
    }
}

protected void rdoBtnleaveWoNoticeno_CheckedChanged(object sender, EventArgs e)
{
    lbl_leaveWoNotice.Text = "As process there will be Notice period shortfall recovery with PL bal adjustment from employee.";               
    trNoticePayRecovery.Visible = false;
    cc18_ModalPopupExtender.TargetControlID = "rdoBtnleaveWoNoticeno";
    cc18_ModalPopupExtender.Show();
}

1 个答案:

答案 0 :(得分:0)

您没有获得所需的输出,因为您将在事件被触发后分配TargetControlID。 只需删除行:

cc18_ModalPopupExtender.TargetControlID = "rdoBtnleaveWoNoticeno";


cc18_ModalPopupExtender.TargetControlID = "rdoBtnleaveWoNoticeyes";

可能会帮助你。