?
Solved

Datalist loses page position on postback...

Posted on 2005-03-20
3
Medium Priority
?
767 Views
Last Modified: 2010-08-05
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
Comment
Question by:JeffDrummond
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 26

Accepted Solution

by:
Rejojohny earned 1500 total points
ID: 13590376
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question