post back control outside update panel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asemon83
    New Member
    • Dec 2012
    • 2

    #1

    post back control outside update panel

    i have a radio button list out of update panle and i have a button in update panle and i want to change selected value my radio when i click on button
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    We need to see your code.

    Comment

    • asemon83
      New Member
      • Dec 2012
      • 2

      #3
      Code:
      protected void MyLinkButton_Click(object sender, EventArgs e)
          {
              rdo.SelectedValue = "2";
             
          }
      ///////////
       <div>
              <asp:RadioButtonList ID="rdo" runat="server" AutoPostBack="True" RepeatDirection="Horizontal">
                  <asp:ListItem Value="1" Selected="True">1</asp:ListItem>
                  <asp:ListItem Value="2"></asp:ListItem>
              </asp:RadioButtonList>
              <asp:ScriptManager ID="sm1" runat="server">
              </asp:ScriptManager>
              <asp:UpdatePanel ID="up1" runat="server">
                  <ContentTemplate>
                      <%= DateTime.Now %>
                      <asp:LinkButton ID="MyLinkButton" runat="server" Text="Click me" OnClick="MyLinkButton_Click" />
                  </ContentTemplate>
                  <Triggers>
                      <asp:AsyncPostBackTrigger ControlID="MyLinkButton" EventName="Click" />
                  </Triggers>
              </asp:UpdatePanel>
              <asp:PlaceHolder ID="plc" runat="server"></asp:PlaceHolder>
              <br />
              This will refresh only first page load time:
              <%= DateTime.Now %>
          </div>
      Last edited by Rabbit; Dec 14 '12, 06:35 PM. Reason: Please use code tags when posting code.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Place the RadioButtonList inside the UpdatePanel.
        The UI will not update the selected value unless it is part of the same asynchronous request.

        -Frinny

        Comment

        Working...