This is a migrated thread and some comments may be shown as answers.

set focus first item in each page

2 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Le Danh
Top achievements
Rank 1
Le Danh asked on 29 Nov 2010, 01:36 PM
Hi all,

Now, i want to set focus first item in each pages of Grid. My grid is below:
1. ASPX page:
            <telerik:RadGrid  
            Width="99.8%" ID="radGridControl"
            runat="server"
            AutoGenerateColumns="true"
            AllowPaging="True"  
            AllowMultiRowSelection="True"  
            CellPadding="0" PageSize="10"  
            AllowFilteringByColumn="true"
            OnPreRender ="radGridControl_PreRender"
            >
            <MasterTableView IsFilterItemExpanded="false" Font-Bold="False" TableLayout="Fixed">
                <Columns>
                <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkItem" runat="server" />
                    </ItemTemplate>
                    <HeaderTemplate>
                        <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True"/>                      
                    </HeaderTemplate>
                </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings  EnableRowHoverStyle="True">
                <Selecting AllowRowSelect="True" />
                <ClientEvents  OnRowSelected="RowSelected" />
                <Scrolling
                            AllowScroll="True"
                            ScrollHeight="320"  
                            EnableVirtualScrollPaging="True"
                            UseStaticHeaders="True" />
            </ClientSettings>
            <AlternatingItemStyle    Height="20px" />
            <ItemStyle  Height="20px"  />
            <HeaderStyle Height="20px"  CssClass="hoanguyen-GridStyleRow" Font-Bold="True"  />
            </telerik:RadGrid>
2. Code-behid:

protected void Page_Load(object sender, EventArgs e)
{
        if (!IsPostBack)
        {
            radGridControl.Rebind();
            if (radGridControl.MasterTableView.Items[0] != null)
            {
                radGridControl.MasterTableView.Items[0].Focus();
            }
        }
}
3. I only focus first item with "CheckBox" column of first page. This column can't focus when page Scrolling is next page.
Can you help me to implement this problem?

Thank you!

Mr PhuongLD

2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 29 Nov 2010, 06:32 PM
Hello Le Danh,

This scenario is not supported by RadGrid. Calling focus() on an HTML element means you would change the current scroll position in RadGrid's data container. However, RadGrid calculates the current page index based on the scroll position of the data container. Changing the position programmatically would introduce miscalculations in RadGrid's virtual scroll paging.

Regards,
Veli
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Le Danh
Top achievements
Rank 1
answered on 30 Nov 2010, 04:12 AM
Hi Veli,

can you implement sample coding for this problem from HTML focus?

Thanks,

Mr PhuongLD
Tags
Grid
Asked by
Le Danh
Top achievements
Rank 1
Answers by
Veli
Telerik team
Le Danh
Top achievements
Rank 1
Share this question
or