problem in showing the column order in grid vb.net
-
I was running the select query to show eight columns in the grid. say dim query = from p in baseclass.Gettable(of tablename) _ select p.column1 , p.column12 , p.column3 , p.column4 , _ p.column5 , p.column6 , p.column7 , p.column8 when i bind it with the grid , it does not give the order of columns in grid , in which i placed them in the query. it shows in grid like p.column12 , p.column3 , p.column1 , p.column4 , p.column6 , p.column5 , p.column7 , p.column8
-
I was running the select query to show eight columns in the grid. say dim query = from p in baseclass.Gettable(of tablename) _ select p.column1 , p.column12 , p.column3 , p.column4 , _ p.column5 , p.column6 , p.column7 , p.column8 when i bind it with the grid , it does not give the order of columns in grid , in which i placed them in the query. it shows in grid like p.column12 , p.column3 , p.column1 , p.column4 , p.column6 , p.column5 , p.column7 , p.column8
Don't use AutoGenerateColumns, it won't work in VB.NET - manually define the columns in the grid.
'Howard
-
Don't use AutoGenerateColumns, it won't work in VB.NET - manually define the columns in the grid.
'Howard
-
Nilish wrote:
i am using window application
Good for you. And how does this relate to the advice you've been given?
Deja View - the feeling that you've seen this post before.
-
Nilish wrote:
i am using window application
Good for you. And how does this relate to the advice you've been given?
Deja View - the feeling that you've seen this post before.
Indeed.. :-)
'Howard
-
Nilish wrote:
i am using window application
Good for you. And how does this relate to the advice you've been given?
Deja View - the feeling that you've seen this post before.
:laugh: :laugh:
-
Don't use AutoGenerateColumns, it won't work in VB.NET - manually define the columns in the grid.
'Howard
Hi , Please go through this code....
BaseClassDataContext = New BaseClassDataContext(BLLmdlCommon.strConfiguration)
'Left outer join for extracting the project table records Dim query = From p In BaseClassDataContext.GetTable(Of CP\_Project)() \_ Group Join crt In BaseClassDataContext.GetTable(Of CP\_CLM\_ClientRating)() \_ On p.RatingID Equals crt.RatingID Into ratingname = Group From c In ratingname.DefaultIfEmpty() \_ Group Join cname In BaseClassDataContext.GetTable(Of CP\_CLM\_Client)() \_ On cname.ClientID Equals p.ClientID Into clientname = Group From c1 In clientname.DefaultIfEmpty() \_ Group Join pstatus In BaseClassDataContext.GetTable(Of CP\_PRJ\_ProjectStatus)() \_ On pstatus.ProjectStatusID Equals p.ProjectStatusID Into projectstatus = Group From c2 In projectstatus.DefaultIfEmpty() \_ Group Join pjtype In BaseClassDataContext.GetTable(Of CP\_PRJ\_ProductType)() \_ On pjtype.ProductTypeID Equals p.ProductTypeID Into pj = Group From projecttype In pj.DefaultIfEmpty() \_ Select c.Rating, p.ProjectName, c1.ClientName, p.StartDate, p.DeliveryDate, c2.ProjectStatus, \_ p.ProjectID, c.RatingColor, projecttype.ProductType 'grdTasks.DataSource = query
If i bind the grid now then i don't get the order of the column as i mentioned above Now instead of binding the grid now , if i create it's XML and convert into dataset . Then the order is correct.
xElement = New XElement("Root", From p In query Select New XElement("Leaf", _
New XElement("Rating", p.Rating), _
New XElement("ProjectName", p.ProjectName), _
New XElement("ClientName", p.ClientName), _
New XElement("StartDate", p.StartDate), _
New XElement("DeliveryDate", p.DeliveryDate), _
New XElement("ProjectStatus", p.ProjectStatus), _
New XElement("ProjectID", p.ProjectID), _
New XElement("RatingColor", p.RatingColor), _
New XElement("RatingColor", p.ProductType)))
ds = New DataSet
ds.ReadXml(New System.IO.StringReader(xElement.ToString()))