C# HtmlGenericControl

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coder Coder

    #1

    C# HtmlGenericControl

    Hi.

    I have an aspx page which has a datagrid sitting inside of DIV tags.

    The users can now scroll down to look at the all the items in the
    datagrid.
    The only problem is that when a selection is made and the page is
    reloaded the scrollbar of the DIV tag goes back up to the top. So the
    user has to scroll back down again to see the previous selection.

    I have tried SmartNavigation but that didnt do the trick.
    I have used:

    Control cont = null;
    cont = Page.FindContro l ("mydiv");
    if (cont == null)
    {
    alert.Text = "control not found";
    }
    else
    {
    alert.Text = "control found";
    }

    mydiv = (HtmlGenericCon trol) cont;

    This tells me that the control was FOUND so, I then do the
    following:

    int newLocation = DataGrid.Select edIndex * 20;
    mydiv.Attribute s.Add ("scrollTop" , newLocation);


    However the scroll bars of the DIV dont move.

    In javascript if you do the following:

    var sp = document.getEle mentById('mydiv ');
    sp.scrollTop = 150;

    It moves the scrolls.

    But I need to do it in the code behind to see which index was
    selected.

    - Thanks
  • Natty Gur

    #2
    Re: C# HtmlGenericCont rol

    Hi,

    Consider using scrollintoview DHTML method. You can embed it into the
    html using RegisterStartup Script.

    http://msdn.microsoft.com/library/de...p/author/dhtml
    /reference/methods/scrollintoview. asp

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    • Natty Gur

      #3
      Re: C# HtmlGenericCont rol

      Hi,

      Consider using scrollintoview DHTML method. You can embed it into the
      html using RegisterStartup Script.

      http://msdn.microsoft.com/library/de...p/author/dhtml
      /reference/methods/scrollintoview. asp

      Natty Gur, CTO
      Dao2Com Ltd.
      28th Baruch Hirsch st. Bnei-Brak
      Israel , 51114

      Phone Numbers:
      Office: +972-(0)3-5786668
      Fax: +972-(0)3-5703475
      Mobile: +972-(0)58-888377

      Know the overall picture


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...