【问题标题】:redirect gridview selected row data to two different pages on clicking on two different select button asp.net?单击两个不同的选择按钮asp.net,将gridview选定的行数据重定向到两个不同的页面?
【发布时间】:2011-01-02 17:36:42
【问题描述】:

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

我希望当用户单击特定行的保留按钮时,特定行的记录会转移到另一个页面。 ...意思是....如果我单击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)

【问题讨论】:

  • @user559800 所以如果你知道要重定向到的 url,并且你有 Response.Redirect 来做这件事,你的问题是什么?

标签: asp.net vb.net


【解决方案1】:

来自您的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

【讨论】:

  • 对象引用未设置为对象的实例。此行中的此错误...此行以黄线突出显示 Me.Response.Redirect("Select_seats.aspx?s_no=" & label22.Text.ToString & "&" & "journey=" & label6.Text & " &" & "seater=" & label4.Text & "&" & "sleeper=" & label2.Text & "&" & "service=" & lab5.Text.ToString)
猜你喜欢
  • 2022-01-13
  • 1970-01-01
  • 2013-07-06
  • 1970-01-01
  • 1970-01-01
  • 2015-11-18
  • 2019-03-31
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多