开发者

6kb of Nonsense from UpdatePanel Asp.net Ajax Toolkit

net ajax update panel + Aasp.net 2.0, quickly coming to point. The update panel seems to get/post nonsense data for each async postback. i will quickly run into the code, i mean just to display a updated grid with 6-10 records and takes 6Kb with all the viewstate turned off sheesh.. the code-markup:

<div id="categoryGrid" class="category-grid">
                        <p>
                            <input type="hidden" value="" runat="server" id="hdnCategoryEditor" />
                        </p>
                        <asp:LinkButton runat="server" id="lnkUpdateGrid" onclick="lnkUpdateGrid_Click" enableviewstate="false"
                            style="display: none;"></asp:LinkButton>
                        <asp:UpdatePanel runat="server" id="upGvCategories" enableviewstate="false" childrenastriggers="false"
                            updatemode="Conditional">
                            <ContentTemplate>
                                <asp:GridView runat="server" enableviewstate="false" id="gv_CategoryList" autogeneratecolumns="False"
                                    width="100%">
                                    <HeaderStyle cssclass="tableheader" />
                                    <RowStyle cssclass="ItemStyle" />
                                    <AlternatingRowStyle cssclass="AlternateItemStyle" />
                                    <Columns>
                                        <asp:TemplateField headertext="S.no" sortexpression="Rid">
                                            <ItemTemplate>
                                                <%#Container.DataItemIndex + 1%>
                                            </ItemTemplate>
                                            <HeaderStyle horizontalalign="Center" verticalalign="Middle" width="50px" />
                                            <ItemStyle horizontalalign="Center" verticalalign="Middle" width="50px" />
                                        </asp:TemplateField>
                                        <asp:BoundField headertext="CategoryName" datafield="Category">
                                            <HeaderStyle horizontalalign="left" verticalalign="top" />
                                            <ItemStyle horizontalalign="left" verticalalign="top" />
                                        </asp:BoundField>
                                    </Columns>
     开发者_开发百科                           </asp:GridView>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>

and in page load i do this, to do _doPostback("AsyncControl as trigger") from javascript

  if (!IsPostBack)
            {
                ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(this.lnkUpdateGrid);


This was due to the unnecessary viewstate that was shipped along with the east post and get requests. Solved it by disabling viewstate on unnecessary controls

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜