-
asp.net & scrolling
I have a very wide user control and I need to implement a scroller. I have also applied the SmartNavigation, but when I leave a text field the form updates and leaves at the beginning of this field. Is it possible to use a .net scroller whick ensures that I will placed exactly the same place when the form reloads? Maybe its possible with the placeholder?
-
I've found a scrolling panel http://metabuilders.com/Tools/ScrollingPanel.aspx that works very well.
Also a static scroll back position control that works for the majority of browsers (haven't had a chance to test this yet) - http://aspalliance.com/articleViewer...aId=356&pId=-1 .
I don't know if these will help at all.
DJ
-
Thanks, that's exactly what I needed, but I can't find out how to implement this. I have downloaded the code, but I can't find an aspx-file for running the app and I can't open the project file directly
-
I have implemented this code, should't that be working?
Code:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Scrolling.WebForm1"%>
<%@ Register TagPrefix="mbsp" Namespace="MetaBuilders.WebControls" Assembly="ScrollingPanel"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<form runat="server" ID="Form1">
<mbsp:ScrollingPanel id="ScrollingPanel1" runat="server" Height="270px" Width="660px" ScrollbarVisibility="Visible">
This text is inside a panel with a scrollbar.
</mbsp:ScrollingPanel>
</form>
</body>
</html>
-
In the files downloaded there should be a folder called bin. Copy the contents of this folder into the bin directory in the root of your web application (if a bin directory doesn't exist create one). Basically the scrolling panel control is contained within a file called MetaBuilders.WebControls.ScrollingPanel.dll - it is precompiled.
Inside your aspx page you want a scrolling panel simply register the control at the top of the page using:
Code:
<%@ Register TagPrefix="mbsp" Namespace="MetaBuilders.WebControls" Assembly="MetaBuilders.WebControls.ScrollingPanel" %>
and then use:
Code:
<mbsp:ScrollingPanel id="TreePanel" runat="server" ScrollbarVisibility="Auto" Width="158px" Height="150px">
</mbsp:ScrollingPanel>
wherever you want a scrolling panel to appear. Obviously change the properties as you need - these are all documented with the files you downloaded. This ScrollingPanel inherits the built in .net panel so it works in much the same way.
HTH
DJ
-
Great, forgot to copy the files to Bin, thanks a lot!
-
Everything works fine, except one thing. I have a table with drop lists, text field and one button. The scrolling is keeping the same place when I change the drop lists and the text fields, but when I click the button the scrolling is placed in the middle of the width??? My code is placed in a user control.
Here is my html-code.
Code:
<%@ Register TagPrefix="mbsp" Namespace="MetaBuilders.WebControls" Assembly="MetaBuilders.WebControls.ScrollingPanel" %>
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Komponenter.ascx.vb" Inherits="Prisberegning2004.Komponenter" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<tr>
<td align="center">
<table cellSpacing=0 bgColor=black border=0>
<tr>
<td>
<!--<DIV style="OVERFLOW-X: auto; WIDTH: 700px">-->
<mbsp:ScrollingPanel id="ScrollingPanel1" runat="server" ScrollbarVisibility="Auto" BorderWidth="2px" Width="700px" Height="150px">
<TABLE cellSpacing=1 cellPadding=0 width=700 bgColor=#efefef>
<TR>
<TD align=middle bgColor=#224899 colSpan=25><asp:label id=lblHead Runat="server" CssClass="overtext"></asp:label></TD></TR>
<TR bgColor=silver>
<TD align=middle colSpan=9>Karakteristika</TD><asp:panel id=PanelT Runat="server" Visible="false">
<TD align=middle colSpan=3>Afgrening</TD></asp:panel><asp:panel id=PanelSpc Runat="server" Visible="false">
<TD align=middle colSpan=6>Priser</TD>
<TD align=middle colSpan=1>Densitet</TD></asp:panel>
<TD align=middle colSpan=6>Kalkulation</TD></TR>
<TR bgColor=#dedede>
<TD align=middle>Type</TD>
<TD align=middle>Medierør</TD>
<TD align=middle>Komponent</TD>
<TD align=middle>Komp.nr</TD>
<TD align=middle>Dim.</TD>
<TD align=middle>Serie</TD>
<TD align=middle>Kappe</TD><asp:panel id=panelLgd1 Runat="server" Visible="true">
<TD align=middle>Lgd</TD></asp:panel>
<TD align=middle>Meldetråd</TD><asp:panel id=panelT1 Runat="server" Visible="False">
<TD align=middle>Lgd</TD>
<TD align=middle>Afg.</TD>
<TD align=middle>Kappe</TD></asp:panel><asp:panel id=PanelSpc2 Runat="server" Visible="false">
<TD align=middle>Stål</TD>
<TD align=middle>PEH</TD>
<TD align=middle>PUR</TD>
<TD align=middle>Løn</TD>
<TD align=middle>Spild</TD>
<TD align=middle>Dk 2004</TD>
<TD align=middle>PUR</TD></asp:panel>
<TD align=middle>Beregn</TD>
<TD align=middle>Kost</TD>
<TD align=middle>Dk</TD>
<TD align=middle>DG Dk</TD>
<TD align=middle>Exp</TD>
<TD align=middle>DG Exp</TD>
</TR>
<TR height=8>
<TD class=small align=middle>[-]</TD>
<TD class=small align=middle>[-]</TD>
<TD class=small align=middle>[-]</TD>
<TD class=small align=middle>[-]</TD>
<TD class=small align=middle>[mm]</TD>
<TD class=small align=middle>[-]</TD>
<TD class=small align=middle>[-]</TD><asp:panel id=panelLgd3 Runat="server" Visible="true">
<TD class=small align=middle>[m]</TD></asp:panel>
<TD class=small align=middle>[-]</TD><asp:panel id=panelT3 Runat="server" Visible="False">
<TD class=small align=middle>[mm]</TD>
<TD class=small align=middle>[mm]</TD>
<TD class=small align=middle>[mm]</TD></asp:panel><asp:panel id=PanelSpc3 Runat="server" Visible="False">
<TD class=small align=middle>[kr/m]</TD>
<TD class=small align=middle>[kr/kg]</TD>
<TD class=small align=middle>[kr/kg]</TD>
<TD class=small align=middle>[kr]</TD>
<TD class=small align=middle>[-]</TD>
<TD class=small align=middle>[kr/m]</TD>
<TD class=small align=middle>[kg/m³]</TD></asp:panel>
<TD class=small align=middle>[-]</TD>
<TD class=small align=middle>[kr/m]</TD>
<TD class=small align=middle>[kr/m]</TD>
<TD class=small align=middle>[%]</TD>
<TD class=small align=middle>[kr/m]</TD>
<TD class=small align=middle>[%]</TD>
</TR>
<TR bgColor=#dedede>
<TD align=middle><asp:checkbox id=CheckBox1 tabIndex=1 enabled="False" runat="server" Text="Std" Checked="True" AutoPostBack="True"></asp:checkbox></TD>
<TD align=middle><asp:dropdownlist id=lstMat tabIndex=2 Runat="server" AutoPostBack="True"></asp:dropdownlist></TD>
<TD align=middle><asp:dropdownlist id=lstKomp tabIndex=3 Runat="server" AutoPostBack="True"></asp:dropdownlist></TD>
<TD align=middle><asp:textbox id=txtNr tabIndex=4 Runat="server" width="40px" cssclass="resfelt" ReadOnly="True"></asp:textbox></TD>
<TD align=middle><asp:dropdownlist id=lstDim tabIndex=5 Runat="server" CssClass="TastFelt" AutoPostBack="True" BackColor="White"></asp:dropdownlist></TD>
<TD align=middle><asp:dropdownlist id=lstSerie tabIndex=6 Runat="server" CssClass="TastFelt" AutoPostBack="True" BackColor="White"></asp:dropdownlist></TD>
<TD align=middle><asp:textbox id=txtKappe tabIndex=7 Runat="server" width="30" cssclass="resfelt" ReadOnly="True"></asp:textbox></TD><asp:panel id=panelLgd4 Runat="server" Visible="true">
<TD align=middle><asp:textbox id=txtLgd tabIndex=8 Runat="server" width="30" cssclass="resfelt" ReadOnly="True"></asp:textbox></TD></asp:panel>
<TD align=middle><asp:dropdownlist id=lstMelde tabIndex=9 Runat="server" AutoPostBack="True"></asp:dropdownlist></TD><asp:panel id=PanelT4 Runat="server" Visible="False">
<TD align=middle><asp:textbox id=txtLgdA tabIndex=10 Runat="server" width="50" cssclass="tastfelt"></asp:textbox></TD>
<TD align=middle><asp:dropdownlist id=lstDimAfg tabIndex=11 Runat="server" CssClass="TastFelt" AutoPostBack="True" BackColor="White"></asp:dropdownlist></TD>
<TD align=middle><asp:textbox id=txtKapAfg tabIndex=12 Runat="server" width="50" cssclass="tastfelt"></asp:textbox></TD></asp:panel><asp:panel id=PanelSpc4 Runat="server" Visible="False">
<TD align=middle><asp:textbox id=txtSteel tabIndex=13 Runat="server" AutoPostBack="True" width="40" cssclass="tastfelt"></asp:textbox></TD>
<TD align=middle><asp:textbox id=txtPeh tabIndex=14 Runat="server" AutoPostBack="True" width="40" cssclass="tastfelt"></asp:textbox></TD>
<TD align=middle><asp:textbox id=txtPur tabIndex=15 Runat="server" AutoPostBack="True" width="40" cssclass="tastfelt"></asp:textbox></TD>
<TD align=middle><asp:textbox id=txtArb tabIndex=16 Runat="server" AutoPostBack="True" width="40" cssclass="tastfelt"></asp:textbox></TD>
<TD align=middle><asp:textbox id=txtSpild tabIndex=17 Runat="server" width="40" cssclass="tastfelt"></asp:textbox></TD>
<TD align=middle><asp:textbox id=txt2004 tabIndex=18 Runat="server" width="40" cssclass="resfelt"></asp:textbox></TD>
<TD align=middle><asp:textbox id=txtDens tabIndex=19 Runat="server" width="40" cssclass="resfelt"></asp:textbox></TD></asp:panel>
<TD align=middle><asp:button id=btnBeregn tabIndex=20 Runat="server" CssClass="knap2" Text="Beregn"></asp:button></TD>
<TD align=middle><asp:textbox id=txtKost tabIndex=21 Runat="server" width="50" cssclass="resfelt2" ReadOnly="True"></asp:textbox>
<TD align=middle><asp:textbox id=txtDk tabIndex=22 Runat="server" width="50" cssclass="resfelt2" ReadOnly="True"></asp:textbox>
<TD align=middle><asp:textbox id=txtDg tabIndex=23 Runat="server" width="50" cssclass="resfelt2" ReadOnly="True"></asp:textbox>
<TD align=middle><asp:textbox id=txtExp tabIndex=24 Runat="server" width="50" cssclass="resfelt2" ReadOnly="True"></asp:textbox>
<TD align=middle><asp:textbox id=txtDgExp tabIndex=25 Runat="server" width="50" cssclass="resfelt2" ReadOnly="True"></asp:textbox></TD>
</TR>
</TABLE>
</mbsp:ScrollingPanel>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
-
And if I go to the design view it only shows the Error Creating the control - ScrollingPanel, no html-code at all.
-
Firstly I believe you must be using Visual Studio .NET - you need to register the scrolling panel in your toolbox (I don't use VS.NET so I'm not sure how to do this) - this should fix the error in Design view.
Could explain the scrolling problem again perhaps with some screen shots?
DJ
-
1 Attachment(s)
Here are two pics, test1 shows the screen before I click the button and test2 is the screen right after I click "Beregn" (Calculate in danish).
-
Hmm strange.
I'm have not experienced that problem at all. The only I can think of off hand is that perhaps the width of the table contained within the scrolling panel is changing onclick. The scrollbar size doesn't seem to show this however.
Might be worth dropping a quick email to the control's writer to see if he has encountered this bug before (include the screen shots - a picture says a thousand words).
Sorry I can't help further.
DJ
-
OK, I have dropped the writer a email. Thanks for your patience :wave: