用asp.net的response傳資料至另一個網頁

請問為什麼我從A網頁用gridview"選取"資料顯示到B網頁時只會顯示第一筆資料?

照理說B網頁應該會出現EMP_NO,EMP_NAME,EMP_TEL,EMP_ADD四筆資料

但是實際上卻只能顯示出EMP_NO這一筆資料而已

有什麼方法可以解決?

A網頁

Protected Sub GridView1_SelectedIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GridView1.SelectedIndexChanging

Dim CurrentRowIndex As Integer

Dim no, name, add, tel As String

CurrentRowIndex = e.NewSelectedIndex

no = GridView1.Rows(CurrentRowIndex).Cells(1).Text

name = GridView1.Rows(CurrentRowIndex).Cells(2).Text

add = GridView1.Rows(CurrentRowIndex).Cells(3).Text

tel = GridView1.Rows(CurrentRowIndex).Cells(4).Text

Response.Redirect("edit.aspx?emp_no= " & no)

Response.Redirect("edit.aspx?emp_name= " & name)

Response.Redirect("edit.aspx?emp_add= " & add)

Response.Redirect("edit.aspx?emp_tel= " & tel)

end sub

B網頁(edit.aspx)

Dim no, name, add, tel As String

no = (Request.Params("emp_no"))

name = (Request.Params("emp_name"))

add = (Request.Params("emp_add"))

tel = (Request.Params("emp_tel"))

TextBox1.Text = no

TextBox2.Text = name

TextBox3.Text = add

TextBox4.Text = tel

1 Answer

Rating
  • 1 decade ago
    Favorite Answer

    Response.Redirect("edit.aspx?emp_no= " & no & "&emp_name= " & name & "&emp_add= " & add & "&emp_tel= " & tel)

    • Login to reply the answers
Still have questions? Get your answers by asking now.