PDA

Click to See Complete Forum and Search --> : CLick Event on Datagrid


venerable bede
Oct 16th, 2002, 04:54 AM
I have a datagrid displaying brief details on clients.

I would like to somehow allow the users to click on one of the rows in the datagrid.
This would result in a new form appearing which would display all of that clients details.

I have never tried this with a datagrid.

Does anyone know where I can dig up some similar examples or maybe point me in the right direction?

Thanks In Advance

EyeTalion
Oct 16th, 2002, 02:05 PM
I have a update link on my datagrid and I'm grabbing a value which I take to my form page (updatebid.aspx) then use the value in my query to fill the new page


----datagrid page
<asp:HyperLinkColumn Text="UPDATE" Target="_self" DataNavigateUrlField="BID_ID" DataNavigateUrlFormatString="updateBid.aspx?id={0}" HeaderText="UPDATE"></asp:HyperLinkColumn>


----form page....on the page load event I open my database connection execute my query and then fill my dataReader with the results and fill my new page from there....hope this helps...

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim BidId As String
BidId = Request.QueryString(0)
Dim strConnection As String = "Provider=MSDAORA;Password=PASS;User ID=USERID;Data Source=WEBDDEVL"
Dim strSQL As String = "select pbss_bid.bid_id, bid_date, bid_schedule_desc, bid_status_code, display_end_date, bid_type_code, buyer_name, display_start_date, post_to_internet_ind"
strSQL = strSQL & " from pbss.pbss_bid, pbss.pbss_bid_schedule WHERE pbss_bid.bid_id ='" & BidId & "'"
strSQL = strSQL & " and pbss_bid_schedule.bid_id ='" & BidId & "'"
Dim objConnection As New OleDbConnection(strConnection)
Dim objCommand As New OleDbCommand(strSQL, objConnection)
Dim objDataReader As OleDbDataReader


Try
objConnection.Open()
objDataReader = objCommand.ExecuteReader

Do While objDataReader.Read = True
txtBidId.Text = objDataReader("Bid_ID")
txtBuyerName.Text = objDataReader("Buyer_Name")
txtIntDisStartDate.Text = objDataReader("display_start_date")
txtBidOpenDate.Text = objDataReader("bid_date")
txtBidDesc.Text = objDataReader("bid_schedule_desc")
txtIntDisEndDate.Text = objDataReader("display_end_date")
If objDataReader("Bid_Type_Code") = 0 Then
RBIfb.Checked = True
ElseIf objDataReader("Bid_Type_Code") = 1 Then
RBRfp.Checked = True
ElseIf objDataReader("Bid_Type_Code") = 2 Then
RBRfi.Checked = True
ElseIf objDataReader("Bid_Type_Code") = 1 Then
RBSale.Checked = True
End If
If objDataReader("post_to_internet_ind") = 1 Then
RBYes.Checked = True
Else
RBPostNo.Checked = True
End If
If objDataReader("bid_status_code") = 0 Then
RBStatus.Checked = True
ElseIf objDataReader("bid_status_code") = 1 Then
RBStatusDelay.Checked = True
ElseIf objDataReader("bid_status_code") = 2 Then
RBStatusCancel.Checked = True
End If

loop

EyeTalion
Oct 16th, 2002, 02:09 PM
that code is from ASP.NET but I'm sure it's a similar pocedure.

eye