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. Thread: Data List delete button problem. [modified]

Thread: Data List delete button problem. [modified]

Scheduled Pinned Locked Moved ASP.NET
helpquestion
3 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.
  • A Offline
    A Offline
    Albert83
    wrote on last edited by
    #1

    Hello, I am trying to implement the data list delete feature with a linkbutton. I have different users who login and can view a message posts. I want to give the ability to delete a message only to the one who posted it. So I am trying to loop through the datalist and check if the logged in user has a posted message show the delete link button otherwise don't show the delete button. I declared a session for the logged in user Session["UserID"] and I am trying to retrieve the userId from the table like this: ]]> } else { %> } } %> It works correct if there is only one post. Meaning the user who posted the message can delete it and others can't because the delete button is not visible. But once I add another record it gets messed up. Does anybody see the problem or has another solution for this? Thank you.

    modified on Sunday, January 06, 2008 6:23:08 PM

    N 1 Reply Last reply
    0
    • A Albert83

      Hello, I am trying to implement the data list delete feature with a linkbutton. I have different users who login and can view a message posts. I want to give the ability to delete a message only to the one who posted it. So I am trying to loop through the datalist and check if the logged in user has a posted message show the delete link button otherwise don't show the delete button. I declared a session for the logged in user Session["UserID"] and I am trying to retrieve the userId from the table like this: ]]> } else { %> } } %> It works correct if there is only one post. Meaning the user who posted the message can delete it and others can't because the delete button is not visible. But once I add another record it gets messed up. Does anybody see the problem or has another solution for this? Thank you.

      modified on Sunday, January 06, 2008 6:23:08 PM

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      I guess DataList provides a FindControl() method which you can use for finding hyper link and changing visibility instead of mixing markup and server side coding at one place. If you do so, you would be able to step into the code and findo ut which is making problem.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      A 1 Reply Last reply
      0
      • N N a v a n e e t h

        I guess DataList provides a FindControl() method which you can use for finding hyper link and changing visibility instead of mixing markup and server side coding at one place. If you do so, you would be able to step into the code and findo ut which is making problem.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        A Offline
        A Offline
        Albert83
        wrote on last edited by
        #3

        Thank you for the response. I can use the step into in the html as well. When you use <% %> it lets create break points, which I did. The problem is that it loops through the same record and doesn't go further than the first record. I don't know why.

        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