Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 774
  • Last Modified:

Datalist loses page position on postback...

I have a datalist in my ASP.Net webform.  It is inside
a <div> with style="OVERFLOW: auto; to create a scrollable
area when the datalist is too large for the page.

Within the datalist I have a SelectedItemTemplate for displaying
additional information about the row.

When I select an item, the additional information is displayed
correctly, but on postback the datalist always goes back to the
top of the list.  You have to scroll down to see the item you selected.

I have smartNavigation set to true for the page but it doesn't
seem to affect it.

Help!  HTML code posted below:

<%@ Register TagPrefix="custom" Namespace="CustomControlLibrary.DJJ.DotNet.CustomControl" Assembly="CustomControlLibrary" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DetentionDatalistTest.aspx.vb" Inherits="JJISBusinessProcess.DetentionDatalistTest" smartNavigation="true"%>
<%@ Register TagPrefix="cc2" Namespace="RealGrid" Assembly="RealGrid" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>Detention Youth Information</title>
            <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
            <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
            <!--Include the two stylesheets(below) in all the WebForms -->
            <!--This is the style sheet which has the styles for individual webforms --><LINK href="djjstyles.css" type="text/css" rel="stylesheet">
            <!--Modify this only if you want the style for menu items on the main page to be changed --><LINK href="menu.css" rel="stylesheet">
            <script language="JavaScript" src="Cal.js"></script>
            <script language="JavaScript" src="_maximize.js"></script>
            <!--Cal.js should be included here if calendar control is required -->
            <SCRIPT language="javascript" id="clientEventHandlersJS">
                        <!--
                        

            
                                                                                    
            //-->
            </SCRIPT>
      </HEAD>
      <body>
            <A href="top"></A>
            <form id="frmDetentionYouthInformation" method="post" runat="server">
                  <script language="JavaScript" src="subfr.js"></script>
                  <table style="WIDTH: 600px; HEIGHT: 500px" cols="5" width="550" align="left" border="0">
                        <TBODY>
                              <tr>
                                    <td style="WIDTH: 50px" align="left"><i class="main_Title">Detention Youth Information</i>
                                    </td>
                                    <td align="left" colSpan="1"><asp:button id="btnBackToReferral2" runat="server" cssclass="button_Text" Width="70px" Text="Back"
                                                CausesValidation="False"></asp:button></td>
                                    <td colSpan="2"></td>
                              </tr>
                              <tr height="18">
                                    <td class="main_background" vAlign="top" align="center" width="100%" colSpan="5" height="18">
                                          <!-- Summary of all the errors to be displayed here --><asp:validationsummary id="allErrs" runat="server" ShowSummary="True" DisplayMode="BulletList" HeaderText="Before continuing, please resolve the errors listed below. "
                                                EnableClientScript="True" CssClass="error_Text"></asp:validationsummary><br>
                                          <asp:label id="lblError" CssClass="error_Text" Runat="server"></asp:label></td>
                              </tr>
                              <tr>
                                    <td style="COLOR: silver; HEIGHT: 25px">
                                          <TABLE cols="6" width="750" bgcolor="silver" style="COLOR: blue; BACKGROUND-COLOR: silver">
                                                <TBODY>
                                                      <TR>
                                                            <TD width="150"><asp:label id="Label6" runat="server">Name</asp:label></TD>
                                    </td>
                                    <TD width="100"><asp:label id="Label7" runat="server">DJJID</asp:label></TD>
                                    <TD width="50"><asp:label id="Label8" runat="server">Sex</asp:label></TD>
                                    </TD>
                                    <TD width="200"><asp:label id="Label9" runat="server">Status</asp:label></TD>
                                    </TD>
                                    <TD width="100" align="left"><asp:label id="Label10" runat="server">Begin Date</asp:label></TD>
                                    </TD></tr>
                        </TBODY>
                  </table>
                  </TD></TR>
                  <tr vAlign="top">
                        <td style="HEIGHT: 157px" vAlign="top" colSpan="5">
                              <div style="OVERFLOW: auto; WIDTH: 750px; HEIGHT: 275px" DESIGNTIMEDRAGDROP="4015"><asp:datalist id="dlYouthInformation" runat="server" Width="726px" Height="275px" BorderColor="Black"
                                          BorderWidth="2px">
                                          <SelectedItemStyle Font-Size="XX-Small" BackColor="#CCFFFF"></SelectedItemStyle>
                                          <SelectedItemTemplate>
                                                <TABLE cols="6" width="700">
                                                      <TR>
                                                            <TD colSpan="6">
                                                                  <HR>
                                                            </TD>
                                                      </TR>
                                                      <TR>
                                                            <TD width="150"><%# DataBinder.Eval(Container.DataItem, "YOUTHNAME") %></TD>
                                                            <TD width="100"><%# DataBinder.Eval(Container.DataItem, "DJJID") %></TD>
                                                            <TD width="50"><%# DataBinder.Eval(Container.DataItem, "YOUTHSEX") %></TD>
                                                            <TD width="200"><%# DataBinder.Eval(Container.DataItem, "SUBPROGDESC") %></TD>
                                                            <TD width="100"><%# DataBinder.Eval(Container.DataItem, "LOCBEGINDATE") %></TD>
                                                      </TR>
                                                      <TR>
                                                            <TD colSpan="6">
                                                                  <HR>
                                                            </TD>
                                                      </TR>
                                                      <TR align="left">
                                                            <TD align="left" width="100" colSpan="1">Status</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox12 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "SUBPROGDESC") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1">Race</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox13 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "YOUTHRACE") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1">Module</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox14 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "MODDESCR") %>'>
                                                                  </asp:TextBox></TD>
                                                      </TR>
                                                      <TR align="left">
                                                            <TD align="left" width="100" colSpan="1">Date Admitted</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox15 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "LOCBEGINDATE") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1">Age</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox16 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "YOUTHAGE") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1">Room #:</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox17 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "PROGROOMNUM") %>'>
                                                                  </asp:TextBox></TD>
                                                      </TR>
                                                      <TR align="left">
                                                            <TD align="left" width="100" colSpan="1">Time Admitted</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox18 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "LOCBEGINTIME") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1">DOB</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox19 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "YOUTHDOB") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1">Storage Unit(s)</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox20 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "STORAGELOCKERDESC") %>'>
                                                                  </asp:TextBox></TD>
                                                      </TR>
                                                      <TR align="left">
                                                            <TD align="left" width="100" colSpan="1">Projected Release Date</TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:TextBox id=Textbox21 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "PROJRELEASEDATE") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1"># of Referrals</TD>
                                                            <TD align="left" width="100" colSpan="1">
                                                                  <asp:TextBox id=Textbox22 Width="100px" Runat="server" ReadOnly="True" text='<%# DataBinder.Eval(Container.DataItem, "NUMREFERRALS") %>'>
                                                                  </asp:TextBox></TD>
                                                            <TD align="left" width="100" colSpan="1"></TD>
                                                            <TD align="left" width="125" colSpan="1">
                                                                  <asp:Button id="Button1" runat="server" Text="Close" CssClass="button_text" CommandName="CLOSE"></asp:Button></TD>
                                                      </TR>
                                                      <TR>
                                                            <TD colSpan="6">
                                                                  <HR>
                                                            </TD>
                                                      </TR>
                                                </TABLE>
                                          </SelectedItemTemplate>
                                          <AlternatingItemStyle Font-Size="XX-Small" CssClass="Content" BackColor="Silver"></AlternatingItemStyle>
                                          <ItemStyle Font-Size="XX-Small" HorizontalAlign="Left" Height="20px" BackColor="White"></ItemStyle>
                                          <ItemTemplate>
                                                <TABLE>
                                                      <TR>
                                                            <TD width="150">
                                                                  <asp:LinkButton id="LinkButton1" runat="server" CommandName="SELECT">LinkButton</asp:LinkButton></TD>
                                                            <TD width="100"><%# DataBinder.Eval(Container.DataItem, "DJJID") %></TD>
                                                            <TD width="50"><%# DataBinder.Eval(Container.DataItem, "YOUTHSEX") %></TD>
                                                            <TD width="200"><%# DataBinder.Eval(Container.DataItem, "SUBPROGDESC") %></TD>
                                                            <TD width="100"><%# DataBinder.Eval(Container.DataItem, "LOCBEGINDATE") %></TD>
                                                      </TR>
                                                </TABLE>
                                          </ItemTemplate>
                                          <HeaderStyle Font-Size="X-Small" CssClass="CategoryHeader" VerticalAlign="Middle"></HeaderStyle>
                                    </asp:datalist></div>
                        </td>
                  </tr>
                  </TBODY></TABLE></TD></TR></TABLE></form>
      </body>
</HTML>
 
0
JeffDrummond
Asked:
JeffDrummond
1 Solution
 
RejojohnyCommented:
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now