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