hello,
i have a page "Picture.aspx?PictureID=4"
i have a FormView witch shows details about that picture and uses a stored procedure with input parameter the "@.PictureID" token from query string
the Pictures table has among other rows "PictureID", "UserID" - uniqueidentifier - from witch user the picture belongs to
i have a second FormView on the same page, witch should show "other pictures from the same user" and uses a Stored Procedure
how should i write that stored procedure...frist to take the UserID from the picture with PictureID=4, then to pass it as input parameter and select the pictures witch has as owner the user with that UserID, and if can be done, to avoid showing the PictureID=4 again
a solution should be to add at querry the UserID too, but i want to avoid that
any sugestion is welcomed, please help me
THANKS
CREATE PROCEDURE GetPictures
@.UserId uniqueidentifier,
@.DisplayedPictureId int
AS
BEGIN
SELECT * FROM Pictures
WHERE UserId = @.UserId AND PictureID <> @.DisplayedPictureId
END
hey, thanks for code
the DisplayedPictureId i take it from querry string, but how should i take the UserId trying to avoid puting it on querry string too
i heard something about Sesion or Cookie, is it good, but how should i use that?
|||If you are using asp.net membership you can use Membership.GetUser().ProviderUserKey.ToString() to get UserId for logged in users.
yes, but a visitor is not the "owner" of the picture...and the page is public to anonymous visitors too
|||hey, i figured out how to do that
i save the UserId in a hiddenField (from the first formView) and then i use it as input parameter to second formView
thanks for help
No comments:
Post a Comment