We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Jump to a certain record

Thread ID:

Created:

Updated:

Platform:

Replies:

106533 Jan 11,2013 05:01 PM Jan 24,2013 07:10 AM ASP.NET Web Forms (Classic) 5
loading
Tags: GridGroupingControl
Randy Wang
Asked On January 11, 2013 05:01 PM

I am using v10.4.0.71 under vs2012.
 
I have a grid with a scroll bar.  The grid has about 100 rows and the height of the grid allows it to display about 10 rows.
 
I would like to be able to jump (on Not IsPostBack) to a record in the middle of the grid (let say the 25th records). 
 
The best way is to somehow do it with the primary key value.  If that is not possible I can translate the key value to a row number.
 
Thanks for any help in advance.

Maithiliy K [Syncfusion]
Replied On January 16, 2013 06:28 AM

Hi Randy Wang ,

Thanks for your interest in Syncfusion products.

Please have the below sample to achieve your requirement of “Jump to a certain record”.  We are selecting the row based on the value entered in the textbox and the scrollbar is scrolled automatically based on the selected row. Please refer the below code snippet for selecting the particular row.

Code snippet:

this.GridGroupingControl1.CurrentTable.Records[s].SetCurrent();

Sample link:  http://www.syncfusion.com/downloads/Support/DirectTrac/95417/simple sample grid web-368499202.zip


Please let us know if you have any concerns.

Regards,

Maithiliy K


Randy Wang
Replied On January 21, 2013 06:03 PM

I am still having problem with the jump.
 
I added a simple line in my form PreRender event and the grid does not jump.

    Me.GridGroupingControl2.CurrentTable.Records(30).SetCurrent()

The only different, I can see between the sample code and mine is that mine uses a SQL datasource and the sample does not.  Mine is done in PreRender and the sample is in Load (which I cannot do).

Unfortunately I cannot run the sample code or any code downloaded from the site because the projects reference controls with version 10.404.0.53 while my install version is 10.404.0.71.  I tried to replace the assembly in web.config but that didn't work either.

I was provided a javascript by support and that seems to work but I think the SetCurrent solution is better.  I would rather used that than sending javascript to the client to set the position.  The javascript is:

<script type='text/javascript'>

$(document).ready(function () {

$(__TableScrollerCollection.scrollers[0].vscrollDiv).scrollTop    (__gridTable.tableElement.rows[row#].offsetTop);

});

</script>

 


Bala Murugan A.S [Syncfusion]
Replied On January 23, 2013 07:07 AM

Hi Randy Wang,

Thanks for your update.

We suggest you to set ReCreateChildControls property as true in order to resolve your reported issue. Please refer the below code snippet.

[C#]

protected void Page_PreRender(object sender, EventArgs e)

    {

      

        if (!string.IsNullOrEmpty(txtbox.Text))

        {

            if ((Convert.ToInt16(txtbox.Text) > 30))

                MessageBox.Show("Enter the row index value with 30");

            else

            {

                s = Convert.ToInt16(txtbox.Text);

                this.GridGroupingControl1.CurrentTable.Records[s].SetCurrent();

            }

        }

        this.GridGroupingControl1.ReCreateChildControls = true;

      

    }

Please try the above code and let me know if you have any concerns.

Regards,

Bala Murugan A.S


Randy Wang
Replied On January 23, 2013 04:19 PM

Adding RecreateChildControls did not work.  The code is boiled down to very simple steps.  In page load I did this which loads 100 records to the grid.
Me.GridGroupingControl2.DataSource = GenerateDataSource()
Me.GridGroupingControl2.DataBind()
In PreRender I have these two lines to position the records.  That is it for code behind.
Me.GridGroupingControl2.CurrentTable.Records(30).SetCurrent()Me.GridGroupingControl2.ReCreateChildControls = True
And this is the rest of the control definition in aspx.
 
<Syncfusion:GridGroupingControl ID="GridGroupingControl2" runat="server"
DataMember="DefaultView" DataSourceCachingMode="ViewState" BorderCollapse="Separate" ShowGroupDropArea="False"  AutoSaveChildControlChanges="True" ClientObjectID="__essentialGrid" FrozenRows="1" Height="600px" JsonActionMapper="JsonAction" PageSize="0"
ReCreateChildControls="True" SaveEmpty="True" ClientSideColumnResizing="False"
DragSelectionBackColor="Yellow" GroupDropAreaText="Drag columns here" ShowWaitingPopupOnPostBack="True" EnableCallbacks="False" >
<TableOptions AllowSortColumns="True" ShowRowHeader="false" ShowTableRowHeaderAsCoveredRange="False"
AllowDragColumns="False" ListBoxSelectionMode="none" RecordMouseHoverColor='Gray' />
          

<TableDescriptor AllowNew="false" AllowEdit="false" TopLevelGroupOptions-ShowCaption="false">

<Columns>
<syncfusion:GridColumnDescriptor HeaderText="Customer ID" MappingName="CustomerID" Width="100">
<Appearance>
<AnyRecordFieldCell CssClass="EG_RowCell" HorizontalAlignment="Center" />
<AlternateRecordFieldCell CssClass="EG_AlternateRowCell" HorizontalAlignment="Center" />
</Appearance>
</syncfusion:GridColumnDescriptor>
<syncfusion:GridColumnDescriptor HeaderText="Customer Name" MappingName="CustomerName" Width="100">
</syncfusion:GridColumnDescriptor>

<syncfusion:GridColumnDescriptor HeaderText="Contact Name" MappingName="ContactName" Width="100"></syncfusion:GridColumnDescriptor>

</Columns>
</TableDescriptor>
<Appearance>
<ColumnHeaderCell HorizontalAlignment="Center" VerticalAlignment="Bottom" CssClass="EG_HeaderCell" ShowButtons="Hide"/>
<AnyRecordFieldCell CssClass="EG_RowCell" TextMargins-Left="10" TextMargins-Top="5" TextMargins-Right="10" />
<AlternateRecordFieldCell CssClass="EG_AlternateRowCell" TextMargins-Left="10" TextMargins-Top="5" TextMargins-Right="10"/>
</Appearance>

</syncfusion:GridGroupingControl>


Bala Murugan A.S [Syncfusion]
Replied On January 24, 2013 07:10 AM

Hi Randy Wang,

Thanks for your update.

We regret for the inconvenience caused. We are unable to reproduce your reported issue in our end. We have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

Sample: JumpToRecord.zip

Please try the above sample and if still issue exist, could you please try to reproduce your issue in the above sample and send back to us.

Please let us know if you have any concerns.

Regards,

Bala Murugan A.S


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;