-
Aug 1st, 2006, 11:14 PM
#1
Thread Starter
New Member
click datagrid row and display details to another datagrid
hello there..here i need help. i have a datagrid that retrieve data from database.what i want to do with the datagrid is when i click any rows of the datagrid it can display the details of the data (refer to the row that i click) to another datagrid.
is there possible to be done ?
i want to know if there is any procedure that can capture the datagrid row that i clicked
-
Aug 1st, 2006, 11:21 PM
#2
Re: click datagrid row and display details to another datagrid
this should give you the selected cell's content
VB Code:
Private Sub DataGrid1_Click()
DataGrid1.Col = DataGrid1.Col
DataGrid1.Row = DataGrid1.Row
MsgBox DataGrid1.Text
End Sub
But why do you want to display the contents in the other datagrid...
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Feb 12th, 2010, 03:27 AM
#3
New Member
Re: click datagrid row and display details to another datagrid
write this code inside a button:
first set your autogeneratecolumn in datagrid to true if it is false it won't work
Dim con As New SqlConnection
Dim cmd As New SqlDataAdapter
Dim ds As New DataSet
'Dim dbfile As String
'dbfile = Server.MapPath("cas_data.mdb")
con = New SqlConnection("Server=(local);Database=Project;Integrated Security=SSPI")
con.Open()
If IsPostBack = True Then
Dim str As String
' Select the checkboxes from the GridView control
Dim i As Integer
For i = 0 To GridView1.Rows.Count - 1 'Step i + 1
Dim row As GridViewRow = GridView1.Rows(i)
Dim isChecked As Boolean
isChecked = (CType(row.FindControl("CheckBox1"), CheckBox)).Checked
If (isChecked) Then
str = GridView1.Rows(i).Cells(1).Text
cmd = New SqlDataAdapter("select Item_Code,Item_Des,Uom from Eng_Part_Master where (Item_Code='" & str & "')", con)
cmd.Fill(ds, "Eng_Part_Master")
GridView2.DataSource = ds
GridView2.DataBind()
MsgBox("Selected")
-
Feb 12th, 2010, 08:18 AM
#4
Re: click datagrid row and display details to another datagrid
Welcome to VBForums felsi
Unfortunately your post is irrelevant for a couple of reasons... first of all this is our VB6 forum, but the code you posted is for VB.Net (VB2002 and later), so the code wont work.
The other reason is that the question was asked in 2006, so it is very unlikely that the original poster still needs help with it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|