Response of link button inside update panel is too late in asp.net C#

246 views Asked by At

When I click on Flag button all operation to be perform by button click are working very well but it take nearly 7 8 seconds to Show effects on screen..

My Asp.net code:

<asp:ScriptManager runat="server" EnablePartialRendering="true" ID="SC1"></asp:ScriptManager>
    <!-- Get Mile-->
        <div class="row">
            <div class="col-md-2"></div>
            <div class="col-md-7">
                <%--  <asp:UpdatePanel runat="server" ID="UpdatePanel1">
                    <ContentTemplate>--%>
                <ul class="timeline-list">

                    <asp:Repeater runat="server"  ID="repeater_post" OnItemDataBound="repeater_post_ItemDataBound" OnItemCreated="repeater_post_ItemCreated">
                        <ItemTemplate>
                            <li class="media media-clearfix-xs">
                <div class="media-body">
                                    <div class="media-body-wrapper">
                                        <div class="panel panel-default ">
                                            <asp:Image runat="server" ID="img_PostPic" ImageUrl='<%# GetImagePath(Eval("ImagePath").ToString()) %>' CssClass="img-responsive" Style="height: 200px !important; width: 526px !important" />
                                            <%--<asp:Image runat="server" ID="Image1" ImageUrl='<%# GetMood(Eval("Mood").ToString()) %>' class="pull-right" />--%>
                        <div class="view-all-comments">
                                                <asp:UpdatePanel runat="server" ID="upd5" UpdateMode="Always">
                                                    <ContentTemplate>
                                                        <asp:LinkButton runat="server" CommandArgument='<%# Eval("PostID").ToString() %>' ID="lbtn_Flag" CssClass="btn btn-white" ToolTip='<%# GetAllFlagMember(Convert.ToString(Eval("PostID"))) %>' OnClick="lbtn_Flag_Click" Visible='<%# CheckFlag(Eval("PostID"))%>'>
                                                            <i class="fa fa-flag"></i>&nbsp;
                                                        </asp:LinkButton>
                                                        <asp:LinkButton runat="server" CommandArgument='<%# Eval("PostID") %>' ID="lbtn_Unflag" CssClass="btn btn-white" ToolTip='<%# GetAllFlagMember(Convert.ToString(Eval("PostID"))) %>' OnClick="lbtn_Unflag_Click" Visible='<%# CheckUnFlag(Eval("PostID"))%>'>
                                                            <i class="fa fa-flag"></i>&nbsp;Unflag
                                                        </asp:LinkButton>
                                                        <strong>&nbsp;&nbsp;<%# GetFlagCount(Eval("PostID").ToString())%> &nbsp;Flag</strong>
                                                    </ContentTemplate>
                                                    <Triggers>
                                                        <asp:AsyncPostBackTrigger ControlID="lbtn_Flag" EventName="Click" />
                                                        <asp:AsyncPostBackTrigger ControlID="lbtn_Unflag" EventName="Click" />
                                                    </Triggers>
                                                </asp:UpdatePanel>
                                                <%--<asp:LinkButton runat="server" ID="lbtnflagmember" CommandArgument='<%# Eval("PostID")%>' Text='<%# GetFlagCount(Eval("PostID").ToString())%>'></asp:LinkButton>--%>
                        <!-- Go to www.addthis.com/dashboard to customize your tools -->
                                                <div class="addthis_sharing_toolbox" style="float: right"></div>
                                                <asp:LinkButton runat="server" CommandArgument='<%# Eval("Lat")+"$"+Eval("Long")+"$"+Eval("PostAutorID")+"$"+Eval("Destination") %>' ID="lbtn_MapCanvas" ToolTip="Map" OnClick="lbtn_MapCanvas_Click" CssClass="pull-right" CausesValidation="false"> <i class="fa fa-map-marker"></i>&nbsp;Navigate
                                                </asp:LinkButton>
                                                <asp:LinkButton runat="server" CommandArgument='<%# Eval("PostID")+"$"+Eval("Destination") %>' ID="lbtn_ReportAbuse" ToolTip="Report Abuse" OnClick="lbtn_ReportAbuse_Click" CssClass="pull-right"> <i class="fa fa-share-square-o "></i>&nbsp;Report Abuse
                                                </asp:LinkButton>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>

                </ul>

My C# Back end Code on link buttons is :

   protected void lbtn_Flag_Click(object sender, EventArgs e)
    {
        //lbtn_Flag.Enabled = false;
        //lbtn_Unflag.Enabled = true;
        LinkButton btn = (LinkButton)sender;
        int _PostId = Convert.ToInt32(btn.CommandArgument);
        WStblFlag wsFlag = new WStblFlag();
        string res = wsFlag.AddFlag(_PostId, Functions.ParseInteger(Convert.ToString(Session["ProfileID"])));
        GetPost();

        //UpdatePanel up = repeater_post.FindControl("upd5") as UpdatePanel;
        //up.Update();

        //UpdatePanel inner_rpt = (UpdatePanel)repeater_post.Items.FindControl("repeater_Comment");

    }
    /// <summary>
    /// UnFlag the post
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lbtn_Unflag_Click(object sender, EventArgs e)
    {

        //lbtn_Flag.Enabled = true;
        //lbtn_Unflag.Enabled = false;
        LinkButton btn = (LinkButton)sender;
        int _PostId = Convert.ToInt32(btn.CommandArgument);
        WStblFlag wsFlag = new WStblFlag();
        string res = wsFlag.UnFlagPost(_PostId, Functions.ParseInteger(Convert.ToString(Session["ProfileID"])));
        GetPost();
    }

I already try many things to reduce response time but it wont succeed... Ty..

0

There are 0 answers