PWS. How i can add event/method to Admin/Photos.aspx into GridView ?

Last post 07-02-2008 3:29 AM by sergeos. 1 replies.

Sort Posts:

  • PWS. How i can add event/method to Admin/Photos.aspx into GridView ?

    06-30-2008, 5:15 AM
    • Loading...
    • sergeos
    • Joined on 06-12-2008, 8:23 AM
    • Minsk
    • Posts 6

    I very need edit photo,

    but in Web Site Starter Kit i only can remove foto, or edit caption. How can add button to GridView and as bind method which can replace exiting photo in database?

    P.S. So, i must add stored procedure in database... but i don't know how i can "know" PhotoID select in GridView?
  • Re: PWS. How i can add event/method to Admin/Photos.aspx into GridView ?

    07-02-2008, 3:29 AM
    • Loading...
    • sergeos
    • Joined on 06-12-2008, 8:23 AM
    • Minsk
    • Posts 6

    Please, guys, help...

    At now time i'm adding stored procedure to Personal.mdf

     

    ALTER PROCEDURE UpdatePhoto
      @AlbumID int,
      @Caption nvarchar(50),
      @BytesOriginal image,
      @BytesFull image,
      @BytesPoster image,
      @BytesThumb image,
      @PhotoID int
    AS
    UPDATE [Photos] 
    SET [AlbumID] = @AlbumID,
      [BytesOriginal] = @BytesOriginal,
      [Caption] = @Caption,
      [BytesFull] = @BytesFull,
      [BytesPoster] = @BytesPoster,
      [BytesThumb] = @ByteThumb 
    WHERE [PictureID] = @PhotoID
    RETURN 
     

     also, i want adding button to gridview

     Adding column to GridView

    then, add code to PhotoManager.vb

     
    Public Shared Sub UpdatePhoto(ByVal PhotoID As Integer, ByVal AlbumID As Integer, ByVal Caption As String, ByVal BytesOriginal() As Byte)
            Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString)
                Using command As New SqlCommand("UpdatePhoto", connection)
                    command.CommandType = CommandType.StoredProcedure
                    command.Parameters.Add(New SqlParameter("@PhotoID", PhotoID))
                    command.Parameters.Add(New SqlParameter("@AlbumID", AlbumID))
                    command.Parameters.Add(New SqlParameter("@Caption", Caption))
                    command.Parameters.Add(New SqlParameter("@BytesOriginal", BytesOriginal))
                    command.Parameters.Add(New SqlParameter("@BytesFull", ResizeImageFile(BytesOriginal, 600)))
                    command.Parameters.Add(New SqlParameter("@BytesPoster", ResizeImageFile(BytesOriginal, 198)))
                    command.Parameters.Add(New SqlParameter("@BytesThumb", ResizeImageFile(BytesOriginal, 100)))
                    connection.Open()
                    command.ExecuteNonQuery()
                End Using
            End Using
        End Sub
     
    and, at now time  i want bind my buttons to this code, but i don't know how i can send parameters, how i can known PhotoID which i want to update by pressing button on GridView?  

    how i can do it? ***, i only want replace photo in db.

Page 1 of 1 (2 items)
Microsoft Communities
Page view counter