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

Auto Horizontal Scroll at runtime

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anzar
Top achievements
Rank 2
Anzar asked on 12 Sep 2012, 05:55 AM
Hi,
I have a telerik rad grid with batch insert and update. In this grid some columns are template columns. Columns width are sett on aspx page.  So i got Horizontal scroll. When clicking on the save button validate the grid  columns fields and set focus to empty column fields. I need to change the horizontal scroll (focused empty column fields) to that column.

Thanks & Regards
Anzar.M
Software Engineer
SBN // Technologics
Ernakulam.

1 Answer, 1 is accepted

Sort by
0
Anzar
Top achievements
Rank 2
answered on 12 Sep 2012, 10:38 AM
Hi Telerik Admin,

I solve this issue by using javascript.

javascript

function scrollDiv(sender, eventArgs) {
           var scroller = document.getElementById(sender.get_element().id + "_GridData");
           var masterTable = sender.get_masterTableView();
           var clName = document.getElementById('hdFirst').value;
           if (clName != null && clName.length > 0) {
                var pixLeft = masterTable.getColumnByUniqueName(clName).get_element().offsetLeft;
               scroller.scrollLeft = Number(pixLeft);
               var pixTop = masterTable.getColumnByUniqueName(clName).get_element().offsetTop;
               scroller.scrollTop = Number(pixTop);
               document.getElementById('hdFirst').value = null;


           }
           
       }

call this javascript at 
  <ClientEvents   OnGridCreated ="scrollDiv"  />

and create a hiden field

   <asp:HiddenField ID="hdFirst" runat="server" Value=""  />

set value of hidden fielld at run time through code behind
  this.hdFirst.Value = "colDepartment"; //Grid Column unique name


Thanks & Regards
Anzar.M
Tags
Grid
Asked by
Anzar
Top achievements
Rank 2
Answers by
Anzar
Top achievements
Rank 2
Share this question
or