将gridview选中的行数据重定向到两个不同的页面,点击两个不同的选择按钮asp.net?

时间:2011-01-02 17:36:42

标签: asp.net vb.net

alt text

我有一个gridview项目模板字段,即上面提到的状态......

我希望当用户点击特定行的保留按钮时,特定行的记录将被转移到另一个页面。 ......意思是......如果我点击第一排gridview的按钮然后座位= 35并且预订关闭= 08:00:00 PM将被转移到

Me.Response.Redirect("Select_seats.aspx?s_no=" & label22.Text.ToString & "&" & "journey=" & label6.Text & "&" & "seater=" & label4.Text & "&" & "sleeper=" & label2.Text & "&" & "service=" & lab5.Text.ToString) ..

如果我点击同一行的管理按钮,那么该行的记录将被转移到

Me.Response.Redirect("Select_nfo.aspx?s_no=" & label22.Text.ToString & "&" & "journey=" & label6.Text & "&" & "seater=" & label4.Text & "&" & "sleeper=" & label2.Text & "&" & "service=" & lab5.Text.ToString)

1 个答案:

答案 0 :(得分:0)

来自您的previous, similar question,我不确定您实际遇到了什么问题,因为您已经有了99%的答案。

   Private Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        Dim row As GridViewRow = DirectCast(DirectCast(e.CommandSource, Control).NamingContainer, GridViewRow)
        Dim lab5 As Label = DirectCast(row.FindControl("Label5"), Label)
        Dim label2 As Label = DirectCast(row.FindControl("Label2"), Label)
        Dim label4 As Label = DirectCast(row.FindControl("Label4"), Label)
        Dim label6 As Label = DirectCast(row.FindControl("label6"), Label)
        Dim label22 As Label = DirectCast(row.FindControl("Label22"), Label)

        If e.CommandName = "Hold" Then
            Me.Response.Redirect("Select_seats.aspx?s_no=" & label22.Text.ToString & "&" & "journey=" & label6.Text & "&" & "seater=" & label4.Text & "&" & "sleeper=" & label2.Text & "&" & "service=" & lab5.Text.ToString)
        ElseIf e.CommandName = "Manage" Then
            Me.Response.Redirect("Select_nfo.aspx?s_no=" & label22.Text.ToString & "&" & "journey=" & label6.Text & "&" & "seater=" & label4.Text & "&" & "sleeper=" & label2.Text & "&" & "service=" & lab5.Text.ToString)
        End If
   End Sub