Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Scroll/navigate /focus datagrid to the row in which edit was clicked [modified]

Scroll/navigate /focus datagrid to the row in which edit was clicked [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptcssasp-nettools
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sakshi Smriti
    wrote on last edited by
    #1

    Hi All, I am using a datagrid in a ASP.NET page. The data grid is inside a div tag.

    There is edit option in each row of the data grid and the user can edit on a few fields. The grid has many records and the user has to scroll down.After scrolling to the record and clicking on edit there is a post back ,and the grid is set back to the top and he again has to scroll back to the row in which now fields are editable. What I want here is that after he clicks on edit the same row must come at the top and the user need not scroll it again. I have used the following code in dgEditResource_EditCommand to set focus to the editable text box in the particular scroll row ,Although it gets the focus but again we need to scroll down . Dim descTB As TextBox descTB = dgEditResource.Items(e.Item.ItemIndex).Cells(2).FindControl("sdate_edit") 'Set the script to focus and select the TextBox RegisterStartupScript("focus", "<script language=""JavaScript""> vbTab & "Form2." & descTB.ClientID & ".focus();" vbCrLf & vbTab & "Form2." & descTB.ClientID & ".select();" & "<" & "/script>") descTB = dgEditResource.Items(e.Item.ItemIndex).Cells(2).FindControl("percent_Edit") If we press tab or space bar the record comes up as focus is already in the text box. But I need that row to scroll up or navigate by itself after edit is clicked. Thanks in advance. Regards, Sakshi :)

    modified on Saturday, January 26, 2008 7:47:32 AM

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups