Hi
I building a web app using VB.NET in VS.NET. I have put two tables into a dataset and have created a datarelation between them. I noticed that as sson a you create this DataRelation in .Net Windows Appication it puts a '+' sign in your datagrid automatically which show the relation.
However when I do this in a ASP.Net app it does not put the '+' sign in or show any of the relation data. How do I get it to show the datrelation in the datagrid by pressing a '+' sign in my web datagrid?
Many thanks in advance
Please find below my sample code:
Dim Conn As New SqlConnection(ConfigurationSettings.AppSettings("connBSS"
)
Dim dsClients As New DataSet()
'Client Section
Dim strClientSQL As String = "SELECT CltID, CltFirstNam, CltLastNam, CltAdd1 FROM Client WHERE CltID < 'BSS170'"
Dim objClientAdapter As New SqlDataAdapter (strClientSQL, Conn)
objClientAdapter.Fill(dsClients, "Clients"
'Client Other Info Section
Dim strCOIsql As String = "SELECT * FROM ClientOtherInfo WHERE CltID < 'BSS170'"
Dim objCOIAdapter As New SqlDataAdapter(strCOIsql, Conn)
objCOIAdapter.Fill(dsClients, "ClientOtherInfo"
'Create Relation
dsClients.Relations.Add("Info", _
dsClients.Tables("Clients"
.Columns("CltID"
, _
dsClients.Tables("ClientOtherInfo"
.Columns("CltID"
)
'Bind to Datagrid
DataGrid1.DataSource = dsClients
DataGrid1.DataBind()
I building a web app using VB.NET in VS.NET. I have put two tables into a dataset and have created a datarelation between them. I noticed that as sson a you create this DataRelation in .Net Windows Appication it puts a '+' sign in your datagrid automatically which show the relation.
However when I do this in a ASP.Net app it does not put the '+' sign in or show any of the relation data. How do I get it to show the datrelation in the datagrid by pressing a '+' sign in my web datagrid?
Many thanks in advance
Please find below my sample code:
Dim Conn As New SqlConnection(ConfigurationSettings.AppSettings("connBSS"
Dim dsClients As New DataSet()
'Client Section
Dim strClientSQL As String = "SELECT CltID, CltFirstNam, CltLastNam, CltAdd1 FROM Client WHERE CltID < 'BSS170'"
Dim objClientAdapter As New SqlDataAdapter (strClientSQL, Conn)
objClientAdapter.Fill(dsClients, "Clients"
'Client Other Info Section
Dim strCOIsql As String = "SELECT * FROM ClientOtherInfo WHERE CltID < 'BSS170'"
Dim objCOIAdapter As New SqlDataAdapter(strCOIsql, Conn)
objCOIAdapter.Fill(dsClients, "ClientOtherInfo"
'Create Relation
dsClients.Relations.Add("Info", _
dsClients.Tables("Clients"
dsClients.Tables("ClientOtherInfo"
'Bind to Datagrid
DataGrid1.DataSource = dsClients
DataGrid1.DataBind()