1
這個任務中的數據填充文本框是一個小我夠不着的地方,所以我不竟然真的知道從哪裏開始...基於重定向從另一個頁面
我想用戶點擊命令字段「選擇「在我的gridview。然後,我希望將它們重定向到(response.redirect()
)到一個輸入表單,該表單的各種asp.net文本框將充滿來自所選項目的數據。
我也需要這樣做邏輯過程的能力:
IF形式從用戶 加載gridview的選擇項THEN 「」填充控制與選自gridview的項目否則負載 形式作爲數據正常和有控制 空白ENDIF
我建議使用此命令爲重定向負載...不知道,如果它的正確:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If InStr(Request.ServerVariables("HTTP_REFERER"), "LogViewer.aspx") Then
'FILL the text boxes with the data from data source!
End If
End Sub
+++++++++++++++++++++++++++++++++++++++++++++ ++++++++++ 編輯
我得到了它的工作感謝阿杜勒...現在我怎樣才能得到我的下拉列表中選擇基於GridView中的數據正確的項目?
Private Sub getData(ByVal user As String)
Dim dt As New DataTable()
Dim connection As New SqlConnection("My Connection ")
connection.Open()
Dim sqlCmd As New SqlCommand("SELECT * from AppMaster WHERE RecNum = @recnum", connection)
Dim sqlDa As New SqlDataAdapter(sqlCmd)
sqlCmd.Parameters.AddWithValue("@recnum", user)
sqlDa.Fill(dt)
If dt.Rows.Count > 0 Then
NameTxt.Text = dt.Rows(0)("UserName").ToString()
'''''''''this drop down list needs to be the correct item'''''''''''''''''
'AppDropDownList.SelectedValue = dt.Rows("Application").ToString()
SelectedDateTxt.Text = dt.Rows(0)("DateOfChange").ToString()
DescriptionTxt.Text = dt.Rows(0)("Description").ToString()
SnipetTxt.Text = dt.Rows(0)("Snippet").ToString()
End If
connection.Close()
End Sub