Auto Horizontal Scroll at runtime

2 posts, 0 answers
  1. Anzar
    Anzar avatar
    62 posts
    Member since:
    Sep 2012

    Posted 12 Sep 2012 Link to this post

    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.
  2. Anzar
    Anzar avatar
    62 posts
    Member since:
    Sep 2012

    Posted 12 Sep 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top