Server.Transer and GridView?

Last post 07-23-2006 6:00 PM by Luis Abreu. 3 replies.

Sort Posts:

  • Server.Transer and GridView?

    07-21-2006, 3:24 PM
    • Member
      75 point Member
    • DearMichael
    • Member since 06-18-2002, 8:18 PM
    • Posts 15

    I am trying to user Server.Transfer in the RowCommand event from a gridview (which is inside an UpdatePanel), however I keep getting a javascript error "Object Required".
    I've tried changing the gridview to use templates, button, imagebuttons, etc and cannot find a way to transfer the page.

    Protected Sub gvTest_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvTest.RowCommand
       Select Case UCase(e.CommandName.ToString)
       Case "EDIT"
          aPubProperty = Convert.ToInt32(e.CommandArgument)
    error-->  Server.Transfer("~/toEditPage.aspx",True)
       Case "DELETE"
       End Select
    End Sub


    Then I am attempting to retrieve the property in the PageLoad of the redirected page:


    If Not Page.PreviousPage Is Nothing Then
       If PreviousPage.IsCrossPagePostBack Then
          lblTest.Text = PreviousPage.aPubProperty.ToString
       End If
    End If
      
      
    Has anyone gotten this to work or found a solution?
    Thank You,
    Michael

    www.MasonHolt.com
  • Re: Server.Transer and GridView?

    07-21-2006, 4:02 PM
    • Member
      5 point Member
    • topcat_arg
    • Member since 07-21-2006, 7:57 PM
    • Posts 1

    hi there..

    why the ~/ in front of the page name??

    just remove it...

     

    HTH..

    Gonzalo

  • Re: Server.Transer and GridView?

    07-21-2006, 6:33 PM
    • Member
      75 point Member
    • DearMichael
    • Member since 06-18-2002, 8:18 PM
    • Posts 15

    Gonzalo,

    The "~/" is there to direct the page back to the application root... but the problem occurs with or without the tilde (or as a hardcoded url or as a single page).

    Michael

    www.MasonHolt.com
  • Re: Server.Transer and GridView?

    07-23-2006, 6:00 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 1:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs
    DearMichael:

    I am trying to user Server.Transfer in the RowCommand event from a gridview (which is inside an UpdatePanel), however I

    hello.

    well, this won't work. atlas supports response.redirect, but not server.transfer (which is the expected behavior, when you really think about it). so, if you can change to a response.redirect, you'll get it working...

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
Page 1 of 1 (4 items)