<table width="800" border="0" cellspacing="0" cellpadding="0">
   <tr>
     <td width="100" height="30" align="right">
      <asp:RadioButtonList ID="rblProposalExecute" runat="server" RepeatDirection="Horizontal"Width="200px" AutoPostBack="True" OnSelectedIndexChanged="rblProposalExecute_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="0">已实施</asp:ListItem>
<asp:ListItem Value="1">待实施</asp:ListItem>
       </asp:RadioButtonList>
      </td>
   </tr>
<tr>
       <td height="30" >
          <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
           <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
              <Triggers>
                  <asp:AsyncPostBackTrigger ControlID="rblProposalExecute" EventName="SelectedIndexChanged" />
               </Triggers>
                <ContentTemplate>
                   <table border="0" cellspacing="0" cellpadding="0">
                      <tr>
                         <td width="100" align="right">
                            <asp:Label ID="lbOverDate" runat="server" Visible="False">实施完成日期</asp:Label>
                          </td>
                          <td>
                            <input type="text" value="" id="txtOverDate" onclick="SelectDate(this,'yyyy-MM-dd')" readonly="true" style="width: 77px; cursor: pointer" runat="server" visible="False" />
                           </td>
                       </tr>
                   </table>
                </ContentTemplate>
           </asp:UpdatePanel>
</td>
</tr>
</table>执行的事件:
        protected void rblProposalExecute_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.rblProposalExecute.SelectedValue == "1")
            {
                this.lbOverDate.Visible = true;
                this.txtOverDate.Visible = true;
            }
            else
            {
                this.lbOverDate.Visible = false;
                this.txtOverDate.Visible = false;
            }
        }单步调试为什么if条件可以执行,else却不能执行?是不是要设置什么?

解决方案 »

  1.   

    什么意思 既然if执行了 else为什么还执行
      

  2.   


    <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
      <ContentTemplate>
    <table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td width="100" height="30" align="right">
      <asp:RadioButtonList ID="rblProposalExecute" runat="server" RepeatDirection="Horizontal"Width="200px" AutoPostBack="True" OnSelectedIndexChanged="rblProposalExecute_SelectedIndexChanged">
    <asp:ListItem Selected="True" Value="0">已实施</asp:ListItem>
    <asp:ListItem Value="1">待实施</asp:ListItem>
      </asp:RadioButtonList>
      </td>
      </tr>
    <tr>
      <td height="30" >
        <table border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td width="100" align="right">
      <asp:Label ID="lbOverDate" runat="server" Visible="False">实施完成日期</asp:Label>
      </td>
      <td>
      <input type="text" value="" id="txtOverDate" onclick="SelectDate(this,'yyyy-MM-dd')" readonly="true" style="width: 77px; cursor: pointer" runat="server" visible="False" />
      </td>
      </tr>
      </table>
     
    </td>
    </tr>
    </table>
     </ContentTemplate>
      </asp:UpdatePanel>
    这样可行呢?
      

  3.   

    建议不要学微软的ajax控件
    我想应该没有公司会用它来开发所以这技能学会了 也被无视 甚至被鄙视还是js+jQuery把
      

  4.   

    如果按照:chuzhaowei的方法,去掉下面这段
    <Triggers>
      <asp:AsyncPostBackTrigger ControlID="rblProposalExecute" EventName="SelectedIndexChanged" />
    </Triggers>程序执行正常,就是起不到异步更新的效果.
      

  5.   

    四楼说的对,内部或后台管理的话,可以用微软的AJAX解决方案。如果真是在项目中应用的话,性能会让人感觉很不爽。。
      

  6.   

    <asp:RadioButtonList ID="rblProposalExecute" runat="server" RepeatDirection="Horizontal"Width="200px" AutoPostBack="True" OnSelectedIndexChanged="rblProposalExecute_SelectedIndexChanged">
    <asp:ListItem Selected="True" Value="0">已实施</asp:ListItem>
    <asp:ListItem Value="1">待实施</asp:ListItem>0的时候会执行。 选个1 在选0
      

  7.   

    还是不要用updatepanel把,曾经被它弄得抓狂,有时候改一点东西很有可能破坏了另一个东西。可以考虑用微软的客户端ajax,或者jquery ajax