So I'm using UltraWebGrid to display a monthly specimen collection for subjects. The first column is a fixed column of headers, and the remaining 60 are monthly collections. This is a 100% bound grid, and what the user sees is what was created in the database. The fixed column works great, allowing the user to scroll to any month they choose. What we want to do is jump to a current month as the study moves forward so that the user doesn't need to scroll. To do so I'm setting an active cell, but in doing that the data from my header column scrolls, but the border remains stationary. Thoughts?
aspx code:
<DisplayLayout AllowColSizingDefault="Free" AllowSortingDefault="No" BorderCollapseDefault="Separate" HeaderClickActionDefault="SortMulti" Name="UltraWebGrid1" RowHeightDefault="20px" RowSelectorsDefault="No" SelectTypeRowDefault="Extended" StationaryMargins="Header" StationaryMarginsOutlookGroupBy="False" TableLayout="Fixed" Version="4.00" NoDataMessage="No Data to Display"> <FrameStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid" BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt"> </FrameStyle> <Pager MinimumPagesForDisplay="2" PageSize="50"> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </PagerStyle> </Pager> <FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderColor="gray" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </FooterStyleDefault> <HeaderStyleDefault BackColor="#666666" BorderStyle="Solid" BorderColor="gray" BorderWidth="1px" HorizontalAlign="Center" Font-Bold="True" ForeColor="White"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </HeaderStyleDefault> <RowStyleDefault BackColor="Window" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt"> <Padding Left="3px" /> <BorderDetails ColorLeft="Window" ColorTop="Window" /> </RowStyleDefault>
vb.net code:
Private Sub UltraWebGrid_UltraWebGrid_SpecCollectionSummary_InitializeLayout(ByVal sender As Object, ByVal e As LayoutEventArgs) Handles UltraWebGrid_SpecCollectionSummary.InitializeLayout 'Lock first column & set width & left h-align & Bold e.Layout.UseFixedHeaders = True e.Layout.TableLayout = TableLayout.Fixed e.Layout.Bands(0).Columns(0).Header.Fixed = True e.Layout.Bands(0).Columns(0).Width = New Unit("200px") e.Layout.Bands(0).Columns(0).CellStyle.Font.Bold = True e.Layout.Bands(0).Columns(0).CellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#F3EDE0") 'Set Scrollbars e.Layout.ScrollBar = ScrollBar.Always e.Layout.ScrollBarView = ScrollBarView.Horizontal
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Get Variables and connections Dim conn As SqlConnection = New SqlConnection(ConnectionString.getAppropriateString()) Dim PID As Integer = Request.QueryString("PID") If Not Page.IsPostBack Then 'Response.Redirect("SpecimenCollections.aspx?PID=" & PID & "1=1" & "#anchor60") End If '***** Get Enroll Date ***** Dim SQLstrEnrollDate As String = "SELECT * FROM StudyID WHERE PID = '" & PID & "'" Dim cmdEnrollDate As SqlDataAdapter = New SqlDataAdapter(SQLstrEnrollDate, conn) Dim dsEnrollDate As DataSet = New DataSet() cmdEnrollDate.Fill(dsEnrollDate) If dsEnrollDate.Tables(0).Rows.Count >= 1 Then Page.Session("EnrollDate") = dsEnrollDate.Tables(0).Rows(0).Item("dtEntered") End If '***** END Get Enroll Date ***** '***** Get Current Data ***** 'Create Dataset Dim dvCurrent As DataView = DirectCast(SqlDataSource_sp_rs_Lab_ALL_Lab_Results_For_Participant.[Select](DataSourceSelectArguments.Empty), DataView) If Not dvCurrent Is Nothing Then Dim dsCurrent As DataSet = dvCurrent.Table.DataSet '***** END Get Current Data ***** ' ***** Load up Controls with Current DataSet If dsCurrent.Tables(0).Rows.Count >= 1 Then UltraWebGrid_SpecCollectionSummary.DataSource = dsCurrent.Tables(0) UltraWebGrid_SpecCollectionSummary.DataBind() 'make it a fixed size so the scrollbars work Me.UltraWebGrid_SpecCollectionSummary.Width = Unit.Pixel(702) Me.UltraWebGrid_SpecCollectionSummary.Height = Unit.Pixel(85) ' Calculate current month and add 6 (5 months +1 for header column) Dim activeCellMonth As Date = DateAdd(DateInterval.Month, DateDiff("m", Session("EnrolledDate"), Date.Now) + 6, Session("EnrolledDate")) Dim cellsToMove As Integer = DateDiff("m", Session("EnrolledDate"), activeCellMonth) Response.Write(cellsToMove) 'Jump to the cell that corresponds the jump Me.UltraWebGrid_SpecCollectionSummary.DisplayLayout.ActiveCell = Me.UltraWebGrid_SpecCollectionSummary.Rows(3).Cells(cellsToMove)