|
-
Mar 30th, 2016, 08:36 AM
#1
Thread Starter
Hyperactive Member
Datagrid and Expanded Click to Child ( + and - rows)
I have a merged datagrid with parent/child relationship. When I double click on the Master (parent) row all is good. When I expand a row to look at the children and double click one of THOSE rows I am not getting the proper row number and data returned (keys and such to get the child record).
How do I determine which row and which table from dataset to look in?
Thanks
gollnick
-
Mar 30th, 2016, 10:20 AM
#2
Re: Datagrid and Expanded Click to Child ( + and - rows)
What exactly do you mean by "row number"? What exactly are you doing, what exactly are you expecting to get and what exactly are you getting?
-
Mar 30th, 2016, 10:48 AM
#3
Thread Starter
Hyperactive Member
Re: Datagrid and Expanded Click to Child ( + and - rows)
Example -- I have a list on the grid of Apartment Houses by Unit -- this is the parent line
The Child (what you see when you press the + symbol) IS THE 10 OR SO units in that apartment house and who the tenant is.
If I want further information on A tenant in AN apartment I want to double click that child row. What I am returning is actually the ROW of a PARENT level
Say I have 5 Parent rows of different apartment buildings.
I open the 3rd row at the upper level showing me now 12 detail rows rows associated with that parent. Say that this detail row 5 is the child I want more info on. I double click that row BUT I am returned on the doubleclick event that row and data for the FIFTH (5) Parent row -- not the fifth row child of the third parent row
Got it??
thanks
gollnick
-
Mar 30th, 2016, 11:06 AM
#4
Re: Datagrid and Expanded Click to Child ( + and - rows)
It would help if we could see the code. Clearly you are using the wrong code but if we can't see the code then we can't see what's wrong with it.
-
Mar 30th, 2016, 02:29 PM
#5
Hyperactive Member
Re: Datagrid and Expanded Click to Child ( + and - rows)
I think from what I understand of the question you will need to use a custom datagridview either one from devexpress which already does what you will require or code one yourself.
However as JC points out its difficult to undrstand what you are trying to achieve without an example in any form.
-
Mar 30th, 2016, 02:39 PM
#6
Thread Starter
Hyperactive Member
Re: Datagrid and Expanded Click to Child ( + and - rows)
I've already come to the conclusion of Leary222. I'd include the code snippets but have any of you used ASNA and Visual RPG vs vb.net or c#.net?? Different syntax but accomplishes all that the other two .net languages provide.
-
Mar 30th, 2016, 10:56 PM
#7
Re: Datagrid and Expanded Click to Child ( + and - rows)
 Originally Posted by gollnick
I've already come to the conclusion of Leary222.
I think you're wrong but I'm trying to help when you refuse to post your code.
-
Mar 31st, 2016, 06:00 PM
#8
Thread Starter
Hyperactive Member
Re: Datagrid and Expanded Click to Child ( + and - rows)
Here is the code that generates the merged (parent/child) dataset
/Region Getit_For_Datagrid_TENANTS_By_Building_Merge
BegFunc Getit_For_Datagrid_TENANTS_By_Building_Merge Type(DataSet) Access(*Public) // or more with same key
dclSRParm Keypart1 *String
dclSRParm Keypart2 *Decimal
dclSrParm Keypart3 *Boolean
DclSrParm OpenClose Type(*Zoned) Len(1, 0) By(*Reference)
DclFld Result Type( DataSet ) New()
DclFld RowD DataRow
DclFld Table System.Data.DataTable
DclFld CountRow Type(Datarow)
DclFld Z *Zoned Len(7,0)
DclFld ResultB Type( DataSet ) New()
DclFld CountRowB Type(Datarow)
DclFld ResultC Type( DataSet ) New()
DclFld CountRowC Type(Datarow)
DclFld result_DD Type(dataset) New()
DclFld result_CI Type(dataset) New()
DclFld DD_Table Type( System.Data.DataTable ) New()
DclFld CI_Table Type( System.Data.DataTable ) New()
//creating data relations
DclFld relation Type(DataRelation)
DclFld table1Column Type(DataColumn)
DclFld table2Column Type(DataColumn)
DclFld table3Column Type(DataColumn)
SetSqlCommand_Get_Datagrid_TENANTS_By_Building(Keypart1 , Keypart2 , Keypart3)
*This.OpenConnection()
YesNo = 0
Try
Adapter.Fill( result_DD , "Table1" )
Catch Error Type( System.Exception )
Throw Error
YesNo = 1
EndTry
z = 0
DD_Table = result_DD.Tables[ 0 ]
result_DD.Tables[ 0 ].Columns.Add( "Select", *TypeOf(*String ))
result_DD.Tables[ 0 ].Columns.Add( "KeyUse", *TypeOf(*String ))
result_DD.Tables[ 0 ].Columns.Add( "BuildingName", *TypeOf(*String ))
result_DD.Tables[ 0 ].Columns.Add( "EditPhoneH", *TypeOf(*String ))
result_DD.Tables[ 0 ].Columns.Add( "EditPhoneC", *TypeOf(*String ))
result_DD.Tables[ 0 ].Columns.Add( "LM_Own", *TypeOf(*String ))
ForEach CountRow Collection( result_DD.Tables(0).Rows)
z = z + 1
RowD = DD_Table.Rows[ z - 1 ]
RowD.Item[ "Select" ] = "Select"
Pn = *New Phonenumbers(CountRow.Item("TMHFNBR").ToString())
RowD.Item[ "EditPhoneH" ] = pn.Tostring()
Pn = *New Phonenumbers(CountRow.Item("TMCFNBR").ToString())
RowD.Item[ "EditPhoneC" ] = pn.Tostring()
Try
ResultB.Clear()
Catch
EndTry
SetSqlCommand_Get_Single_TBUILDING(Convert.ToDecimal(CountRow.Item("Bf_Key").ToString()))
Try
Adapter.Fill( ResultB )
Catch Error Type( System.Exception )
EndTry
RowD.Item[ "BuildingName" ] = ""
ForEach CountRowB Collection( ResultB.Tables(0).Rows)
RowD.Item[ "BuildingName" ] = CountRowB.Item("BDESC").ToString()
EndFor
Try
ResultC.Clear()
Catch
EndTry
SetSqlCommand_Get_Single_LANDLORDMAS(Convert.ToDecimal(CountRow.Item("Lm_Key").ToString()))
Try
Adapter.Fill( ResultC )
Catch Error Type( System.Exception )
EndTry
RowD.Item[ "LM_Own" ] = ""
RowD.Item[ "KeyUse" ] = ""
ForEach CountRowC Collection( ResultC.Tables(0).Rows)
RowD.Item[ "LM_Own" ] = CountRowC.Item("LMNFML").ToString()
EndFor
RowD.Item[ "KeyUse" ] = CountRow.Item("LM_Key").ToString() + CountRow.Item("Bf_Key").ToString() + CountRow.Item("TM_Key").ToString()
endfor
//--------------------------
SetSqlCommand_Get_Single_TBUILDING_For_Merge(Keypart1)
Try
Adapter.Fill( result_DD , "Table2" )
Catch Error Type( System.Exception )
Throw Error
YesNo = 1
EndTry
z = 0
CI_Table = result_DD.Tables[ 1 ]
result_DD.Tables[ 1 ].Columns.Add( "Select", *TypeOf(*String ))
result_DD.Tables[ 1 ].Columns.Add( "EditPhoneH", *TypeOf(*String ))
result_DD.Tables[ 1 ].Columns.Add( "EditPhoneC", *TypeOf(*String ))
result_DD.Tables[ 1 ].Columns.Add( "KeyUse", *TypeOf(*String ))
Try
ForEach CountRow Collection( result_DD.Tables(1).Rows)
z = z + 1
RowD = CI_Table.Rows[ z - 1 ]
RowD.Item[ "Select" ] = "Select"
Pn = *New Phonenumbers(CountRow.Item("TMHFNBR").ToString())
RowD.Item[ "EditPhoneH" ] = pn.Tostring()
Pn = *New Phonenumbers(CountRow.Item("TMCFNBR").ToString())
RowD.Item[ "EditPhoneC" ] = pn.Tostring()
RowD.Item[ "KeyUse" ] = CountRow.Item("LM_Key").ToString() + CountRow.Item("Bf_Key").ToString() + CountRow.Item("TM_Key").ToString()
EndFor
Catch Errorq Type( System.Exception )
Throw Error
YesNo = 1
EndTry
//_____________________________________________________________
//_____________________________________________________________
Try
result_DD.Tables[0].TableName = "Upper"
Catch Error1 Type( System.Exception )
Throw Error1
YesNo = 1
EndTry
result_DD.Tables[1].TableName = "Lower"
DD_Table = result_DD.Tables("Upper")
CI_Table = result_DD.Tables("Lower")
Try
result_DD.Relations.Add(*new System.Data.DataRelation("Display Unit Tenants", result_DD.Tables("Upper").Columns("KeyUse"), result_DD.Tables("Lower").Columns("KeyUse"), *false)) //*false
Catch Error Type( System.Exception )
Throw Error
YesNo = 1
EndTry
adapter.Dispose()
*This.CloseConnection()
LeaveSr Value(result_DD )
EndFunc
/endRegion Get records for datagrid
Here is the code that loads the datagrid
dsDocuments = TENANTS.Getit_For_Datagrid_TENANTS_Merge("a" , optOrderAscend.Checked , *ByRef ParmYesNo)
dgGrid1.SetDataBinding(dsDocuments , "Upper")
Then this
Example -- I have a list on the grid of Apartment Houses by Unit -- this is the parent line
The Child (what you see when you press the + symbol) IS THE 10 OR SO units in that apartment house and who the tenant is.
If I want further information on A tenant in AN apartment I want to double click that child row. What I am returning is actually the ROW of a PARENT level
Say I have 5 Parent rows of different apartment buildings.
I open the 3rd row at the upper level showing me now 12 detail rows rows associated with that parent. Say that this detail row 5 is the child I want more info on. I double click that row BUT I am returned on the doubleclick event that row and data for the FIFTH (5) Parent row -- not the fifth row child of the third parent row
gollnick
-
Mar 31st, 2016, 06:14 PM
#9
Hyperactive Member
Re: Datagrid and Expanded Click to Child ( + and - rows)
https://www.devexpress.com/Products/...WinForms/grid/
Does the above meet your requirements in perticular the image next to clear concise and accurate
-
Apr 4th, 2016, 06:04 PM
#10
Hyperactive Member
Re: Datagrid and Expanded Click to Child ( + and - rows)
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
|