我需要从另一个页面获取文本框或下拉列表的值,以便编辑特定记录。
我在EditEmployee页面
中有一个业务组详细信息的gridview列表如果我点击更新链接按钮,它将成功更新,包括HeadCountUpdating页面中的记录,但我只需要在headcountupdating页面中的特定年份和期间编辑记录
如何从其他页面获取文本框的值以便将其放在我的查询中?
Dim JobTitle As String = DirectCast(gvGroup.Rows(e.RowIndex).FindControl("txtgvJobTitle"), TextBox).Text
Dim BusinessUnit As String = DirectCast(gvGroup.Rows(e.RowIndex).FindControl("ddl_gvBusinessUnit"), DropDownList).Text
Dim Division As String = DirectCast(gvGroup.Rows(e.RowIndex).FindControl("ddl_gvDivision"), DropDownList).Text
Dim SubDivision As String = DirectCast(gvGroup.Rows(e.RowIndex).FindControl("ddl_gvSubDivision"), DropDownList).Text
Dim Classification As String = DirectCast(gvGroup.Rows(e.RowIndex).FindControl("ddl_gvClassification"), DropDownList).Text
Dim SubClassification As String = DirectCast(gvGroup.Rows(e.RowIndex).FindControl("ddl_gvSubClassification"), DropDownList).Text
Dim MASTERID As String = DirectCast(gvGroup.Rows(e.RowIndex).FindControl("lblMasterID"), Label).Text
Dim empno As String = lblval_Empno.Text
Dim updatePeriodTblResult As Boolean
updatePeriodTblResult = UpdateInsDelRecord("UPDATE PERIOD_TBL SET BUSINESS_UNIT = '" & BusinessUnit & "', DIVISION = '" & Division & "'," & _
"SUB_DIVISION = '" & SubDivision & "', CLASSIFICATION = '" & Classification & "'," & _
"SUB_CLASSIFICATION = '" & SubClassification & "', JOBTITLE = '" & JobTitle & "' " & _
"WHERE MASTERID = '" & MASTERID & "' AND EMPNO = '" & empno & "'")
答案 0 :(得分:1)
在源页面中,保存要在会话状态中传递的信息
Session("field1") = "value1"
在目标页面中,从会话状态中读取已保存的信息
Dim field1 as String = CType(Session.Item("field1"), String)
阅读here了解更多信息。