سؤال

a have a listview and a DataPager in my asp.net form. this is my datapager:

 <asp:DataPager ID="GelleryImagesPager" runat="server" PagedControlID="GelleryImagesListView" PageSize="9">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Image" NextPageImageUrl="~/Image/next_16x16.png" PreviousPageImageUrl="~/Image/previous_16x16.png"  FirstPageImageUrl="~/Image/first_16x16.png" LastPageImageUrl="~/Image/last_16x16.png"  ShowFirstPageButton="True" ShowLastPageButton="True" />
                        </Fields>
                    </asp:DataPager>

clicking on datapager's imagebutton cause full postback.this is my question: in page_load event how can I know if datapager cause postback? I'v tried this:

Request.Form["__EVENTTARGET"]

but it returne string.empty, what can I do?

هل كانت مفيدة؟

المحلول

problem resolved, I added following to Page_load event:

for (int i = 0; i < page.Request.Form.Keys.Count; i++)
        {
            if (page.Request.Form.Keys[i].Contains("GelleryImagesPager"))
            {
               ...
                break;
            }
        }

this helped me.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top