update panel and user control problem

Last post 05-13-2008 7:20 AM by rajak. 4 replies.

Sort Posts:

  • update panel and user control problem

    05-11-2008, 7:57 PM
    • Loading...
    • FutureGuru
    • Joined on 06-22-2006, 2:50 PM
    • Fairfield IOWA
    • Posts 61

     I have an update panel with a button control and label control. This update panel is basically in a user control. On the button click (which is inside the update panel - and this update panel is in a user control) i want to change the text of the label control. but it does not work. No error as well. I tried the conditional thing as well.

    Akber Ali
    2000 North Court, 9A
    Utopia Park
    Fairfield, IOWA
  • Re: update panel and user control problem

    05-12-2008, 12:50 AM
    • Loading...
    • FutureGuru
    • Joined on 06-22-2006, 2:50 PM
    • Fairfield IOWA
    • Posts 61

     to add few more lines to the above question let me clarify that the update mode is "Always". When I step into code I do reach to the Button_Click event i.e. the button inside the update panel. The value is successfully assigned to label control (this label control is inside the update panel), but not refreshed.

     

    An immediate help would be highly appreciated. 

    Akber Ali
    2000 North Court, 9A
    Utopia Park
    Fairfield, IOWA
  • Re: update panel and user control problem

    05-12-2008, 2:24 AM
    • Loading...
    • rajak
    • Joined on 07-17-2007, 3:49 AM
    • Posts 82

    Hi there,

        Can you post ur code here. So that it would be easy to find out the issue.

    Thanks & Regards,

    Rajak Shaik.

  • Re: update panel and user control problem

    05-12-2008, 12:10 PM
    • Loading...
    • FutureGuru
    • Joined on 06-22-2006, 2:50 PM
    • Fairfield IOWA
    • Posts 61
                 <asp:UpdatePanel ID="UpdatePanel1" runat="server"  UpdateMode="Always"  >
                        <ContentTemplate>
                            <span style="color: silver;">Rate this entry</span>
                            <cc1:Rating ID="ExistingRating" runat="server" StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar"
                                FilledStarCssClass="filledRatingStar" EmptyStarCssClass="emptyRatingStar" OnChanged="ItemRating_Changed"
                                AutoPostBack="True">
                            </cc1:Rating>
                            <asp:Label ID="lblTotal" runat="server" Font-Size="10px"></asp:Label><br />
                            <span style="color: Red;">
                                <asp:Label ID="lblMessage" runat="server"></asp:Label></span>
                            <div>
                                <table style="table-layout:fixed; width:200px;">
                                    <tr>
                                        <td style="font-size: 10px; width: 60px;">
                                            <asp:Label ID="lblUName" runat="server" Text="User Name" Visible="False"></asp:Label>
                                        </td>
                                        <td style="font-size: 10px;width:90px;">
                                            <asp:TextBox ID="txtUName" runat="server" Visible="False" Width="80px" Font-Size="10px" ></asp:TextBox>
                                        </td>
                                        <td style="width:60px;">
                                            <asp:Button ID="btnLogin" runat="server" Text="Go" OnClick="btnLogin_Click" Visible="False"   /></td>
                                    </tr>
                                    <tr>
                                        <td style="font-size: 10px; color:Red;" colspan="3" >
                                            <asp:Label ID="lblLoginMsg" runat="server" Visible="False">Valid user name is required before rating</asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </ContentTemplate>
                       
                    </asp:UpdatePanel>

      while the following c# code behind is

     protected void btnLogin_Click(object sender, EventArgs e)
      {

            if (condition)

                {

    		lblLoginMsg.Visible=true;

                     lblLoginMsg.Text = "sssssssssssssssssss";

                } 

     } 

     

    and it does not work 

    Akber Ali
    2000 North Court, 9A
    Utopia Park
    Fairfield, IOWA
  • Re: update panel and user control problem

    05-13-2008, 7:20 AM
    Answer
    • Loading...
    • rajak
    • Joined on 07-17-2007, 3:49 AM
    • Posts 82

    Hi Akber,

         The button click event should be an asynchronous event. To do that add the following code..

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

    <Triggers>

    <asp:AsyncPostBackTrigger ControlID="btnLogin" EventName="Click" />

    </Triggers>

    </asp:UpdatePanel>

       Hope this will help you.. If not please let me knw.

    Thanks & Regards,

    Rajak Shaik.

Page 1 of 1 (5 items)