J
Jakob Lithner
I have a web page where I search some information.
I tried to AJAX enable the page to avoid postbacks.
I tried to use 3 UpdatePanels: updateSearch, updateList and updateDetail.
In updateSearch I use several controls to decide what to search.
Some of the DropDownLists will have dynamic content based on other
DropDownLists, thats why I need to enclose this in one UpdatePanel.
In updateList I list the main result in a user control. It basically holds a
repeater where one column has a LinkButton. The LinkButton triggers a custom
Event named TextID_Clicked. The repeater is put in a DIV tag with "overflow:
auto" to ensure a long result is scrolled.
The last panel is updateList where I display the detailed information of the
clicked Text record in a second user control. The reason I put these controls
in one UpdatePanel each is that I would like the left record list NOT to
scroll when I click a record to display the details.
Everything works excellent except that the record list will move to the top
every time a record is clicked, which means the clicked record might
disappear out of sight. In my understanding AJAX should not allow this list
to be updated.
Did I misunderstand something? Should the panels be nested?
Is there a possible workaround to get the wished "freezing" of the list when
it is clicked?
Note: I have put breakpoints to ensure the list is not regenerated from
code. It is not. It looks more like a browser problem.
Code included below. All formatting is deleted to make it easier to read.
<asp:UpdatePanel ID="updateSearch" runat="server">
<ContentTemplate>
<asp
ropDownList ID="cboSystem" runat="server" AutoPostBack="True" />
<asp
ropDownList ID="cboTextType" runat="server"
AutoPostBack="True" />
<asp
ropDownList ID="cboAttribute" runat="server" />
<asp:Button ID="btnSearch" runat="server" Text="Search" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cboSystem"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="cboTextType"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="updateList" runat="server">
<ContentTemplate>
<uc1:ucTextList ID="myTextList" Visible="false" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="updateDetail" runat="server">
<ContentTemplate>
<uc2:ucTextDetail ID="myTextDetail" Visible="false" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="myTextList"
EventName="TextID_Clicked" />
</Triggers>
</asp:UpdatePanel>
I tried to AJAX enable the page to avoid postbacks.
I tried to use 3 UpdatePanels: updateSearch, updateList and updateDetail.
In updateSearch I use several controls to decide what to search.
Some of the DropDownLists will have dynamic content based on other
DropDownLists, thats why I need to enclose this in one UpdatePanel.
In updateList I list the main result in a user control. It basically holds a
repeater where one column has a LinkButton. The LinkButton triggers a custom
Event named TextID_Clicked. The repeater is put in a DIV tag with "overflow:
auto" to ensure a long result is scrolled.
The last panel is updateList where I display the detailed information of the
clicked Text record in a second user control. The reason I put these controls
in one UpdatePanel each is that I would like the left record list NOT to
scroll when I click a record to display the details.
Everything works excellent except that the record list will move to the top
every time a record is clicked, which means the clicked record might
disappear out of sight. In my understanding AJAX should not allow this list
to be updated.
Did I misunderstand something? Should the panels be nested?
Is there a possible workaround to get the wished "freezing" of the list when
it is clicked?
Note: I have put breakpoints to ensure the list is not regenerated from
code. It is not. It looks more like a browser problem.
Code included below. All formatting is deleted to make it easier to read.
<asp:UpdatePanel ID="updateSearch" runat="server">
<ContentTemplate>
<asp
<asp
AutoPostBack="True" />
<asp
<asp:Button ID="btnSearch" runat="server" Text="Search" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cboSystem"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="cboTextType"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="updateList" runat="server">
<ContentTemplate>
<uc1:ucTextList ID="myTextList" Visible="false" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="updateDetail" runat="server">
<ContentTemplate>
<uc2:ucTextDetail ID="myTextDetail" Visible="false" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="myTextList"
EventName="TextID_Clicked" />
</Triggers>
</asp:UpdatePanel>