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. "Lock" Gridview row

"Lock" Gridview row

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadminquestion
2 Posts 2 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.
  • G Offline
    G Offline
    GermanDM
    wrote on last edited by
    #1

    Hi, I am writing a web app in ASP.Net 2.0 and server side C#. what i am trying to achieve is this: multiple users work of a gridview and user A selects a row in the gridview to work with, now when user B selects the same row while user A is still busy with that row, user B must be notified that that specific row is in use by another user. A notify message or a row lock or anything to prevent user B from working with the same record as User A. Does anyone have any idea how i could work around this one? :doh: Thanks alot Kind Regards GermanD

    T 1 Reply Last reply
    0
    • G GermanDM

      Hi, I am writing a web app in ASP.Net 2.0 and server side C#. what i am trying to achieve is this: multiple users work of a gridview and user A selects a row in the gridview to work with, now when user B selects the same row while user A is still busy with that row, user B must be notified that that specific row is in use by another user. A notify message or a row lock or anything to prevent user B from working with the same record as User A. Does anyone have any idea how i could work around this one? :doh: Thanks alot Kind Regards GermanD

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      Yeah, here is what I do. First of all, here are two sql procs create proc [dbo].[uspLockItem] (@workItemId int, @User varchar(50)) as update dbo.workItems set lockedBy = @User, lockedTime = getdate() where workItemId = @workItemId create proc [dbo].[uspUnLockItems] (@User varchar(50)) as update dbo.workItems set lockedBy = null, lockedTime = null where lockedBy is not null and ( lockedBy = @User or datediff(minute, lockedTime, getdate()) > 20 ) Lock the first record when the user loads the page to work on it. Unlock right before you get data for your grid. On item databound method or whereever you bind your grid LinkButton lb = (LinkButton)e.Item.FindControl("lbEdit"); if (drv["lockedBy"] != DBNull.Value) { lb.Enabled = false; lb.ToolTip = "Policy locked by " + drv["lockedBy"].ToString(); }

      GameFly free trial

      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