我试图弄清楚如何使用Response.Redirect VB中的“ASP.NET”从一个网格视图中获取两列,如果可能的话,从同一页的下拉列表中获取两列,并将其发送到下一页的标签。这个是可能的吗?
另外,我还有点不明白它写着“房间和名字”的地方。我在哪里找到这些正确的输入?谢谢你的帮助。
更新:
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Response.Redirect("RoundingEntry.aspx?Room=" & GridView1.SelectedRow.Cells(1).Text & "&Name=" & GridView1.SelectedRow.Cells(2).Text & "&Rounder=" & DDRounder.SelectedValue)
End Sub在我的下一页/接收页上我有这个..。
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.Page.PreviousPage IsNot Nothing Then
Dim rowIndex As Integer = Integer.Parse(Request.QueryString("RowIndex"))
Dim GridView1 As GridView = DirectCast(Me.Page.PreviousPage.FindControl("GridView1"), GridView)
Dim row As GridViewRow = GridView1.Rows(rowIndex)
Dim room As String = Request.QueryString("Room")
Dim name As String = Request.QueryString("Name")
Dim Rounder As String = Request.QueryString("Rounder")
lblRoom.Text = room
lblPatientName.Text = name
lblRounder.Text = Rounder
End If
End SublblRoom.Text源代码
<asp:Label ID="lblRoom" runat="server" BackColor="White" Height="22px"
Width="100px" BorderColor="#CCCCCC" BorderStyle="Inset" BorderWidth="1pt"
style="text-align: center; background-color: #CCCCCC;"></asp:Label>发布于 2013-10-02 18:01:50
如果需要上一页上的控件的值,则可以使用Server.Transfer("page.aspx")。
如果您通过querystring,请使用Request.QueryString("Room") & Request.QueryString("Name")
看看这个article
你在这里想念RowIndex ..。
Response.Redirect("RoundingEntry.aspx?Room=" & GridView1.SelectedRow.Cells(2).Text & "&Name=" & GridView1.SelectedRow.Cells(3).Text "&RowIndex=?")在下一页..。
Dim rowIndex As Integer = Integer.Parse(Request.QueryString("RowIndex"))
Dim room As String = Request.QueryString("Room")
Dim name As String = Request.QueryString("Name")
lblRoom.Text = room
lblName.Text = name https://stackoverflow.com/questions/19143565
复制相似问题