locked
update panel does not work! RRS feed

  • Question

  • User-646613277 posted

    im trying to get the value of a dropdownlist and insert it into a label inside an update panel like the following:

        <asp:UpdatePanel ID="udpTutorialDropDown" runat="server">
            <ContentTemplate>
                <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="TutorialSeries" DataTextField="SeriesName" DataValueField="VideoSeriesNameID" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList><br />
                <asp:SqlDataSource ID="TutorialSeries" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" SelectCommand="ViewSeasonName" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
                <asp:Label ID="lblEpisode" runat="server" Text="Label"></asp:Label><br />
                <asp:TextBox ID="tbxURL" runat="server"></asp:TextBox><br />
                <asp:TextBox ID="tbxDiscription" runat="server"></asp:TextBox><br />
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>

    and at code behind i have:

            protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            {
                lblEpisode.Text = DropDownList1.SelectedValue.ToString();
                udpTutorialDropDown.Update();
            }

    but i dont know why it doesnt update the label!! the text of the label remains the same as when it loads which is "Label" !!! can someone spot the problem??

    Tuesday, June 10, 2014 3:38 AM

Answers

  • User-1360095595 posted

    Try adding autopostback=true to the ddl.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 10, 2014 3:41 AM

All replies

  • User-1360095595 posted

    Try adding autopostback=true to the ddl.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 10, 2014 3:41 AM
  • User-646613277 posted

    OMG .... U JUST SAVED MY LIFE...THANK YOU

    Tuesday, June 10, 2014 3:43 AM
  • User-646613277 posted

    okay now i have a bigger problem!!! this update panel is inside a ascx file (usercontrol) which is loaded dinamically into another update panel. now it changes the label text and gets the value of the dropdownlist for the first time but if i change the main update panel to another ascx file and come back and try to change it again, it still wont work!

    Tuesday, June 10, 2014 3:47 AM
  • User-417640953 posted

    okay now i have a bigger problem!!! this update panel is inside a ascx file (usercontrol) which is loaded dinamically into another update panel. now it changes the label text and gets the value of the dropdownlist for the first time but if i change the main update panel to another ascx file and come back and try to change it again, it still wont work!

    Hi VEBMAX,

    If you have an answer about the origin issue, please mark currect thread and post the new issue to new thread.

    That will make every thread focus single issue, and many people will focus your new issue in new thread.

    Thanks for your understanding.

    Best Regards!

    Wednesday, June 11, 2014 5:36 AM