GridView - populate columns
Hi,
I have a GridView that is populated in Page_Load:
gvOmbudUtanAnmodan.DataSource = gvOmbudUtanAnmodan.DataBind();
AnvandareComponent.GetOmbudUtanAnmodan();
("GetOmbudUtanAnmodan()" is a function in which i filter a with a datatable and returns a .)
The following columns are populated by BoundField controls:
GroupID - Name - City
That was easy...
Now, I have one column that is called Date that i cannot get from this funtion. So i guess this column needs to be populated in gvOmbudUtanAnmodan_RowDataBind..
This Date i need to get from another in which GroupID is an item! The GroupID need to match for each row. How do I populate this last column so that the correct Date is displayed for correct GroupID???
Thanks!
theLizardPosted Oct 20, 2009, 5:07 PM
If the gridview DataSource uses an sql to get the fields from the table then you can do a "select [field list] from table join [other table]
example:
SELECT tbl1.name, tbl1.street, tbl2.date FROM tbl1, tbl2 [inner/outer] join tbl2 on tbl2.groupId = tbl1.groupID
WHERE ????
ORDER BY ????
Then I think DataBind() should handle your needs...
Kirtan PatelPosted Oct 20, 2009, 3:45 AM
can you post the code so it will be better understandable to resolve your problem :)