Urgent Help Datagrid.DataSource

Mehyar

Well-known member
Joined
Jun 9, 2003
Messages
371
Location
Lebanon
Hi guys i am having this weird problem,
i have a page with 5 panels in the Page_OnLoad i have this code
If not ispostback then
Datagrid1.datasource = GetEnhancements() whihch returns a table
Datagrid1.databind()
end if

wHEN I TRY THEN TO ACCESS THE DATA IN THE DATAGRID BY USING :
datagrid1.datasource it returns nothing ????

If anyone knows the problem please reply ASAP,
thx
 
I hope you dont see this as an insult :)

a) Will the if-clause evaluate to true ? Sure ? You checked it ?
b) Will GetEnhancements return a table - not nothing ? Sure ? Checked it ?
 
No its ok feel free ;)

I know the if statement is set to true since when the page loads i see the data in the datagrid whihc also proves that the function is returning a datatable.

Heiko when i debugged i saw the datasource and everything is ok but when i click on anything and then debug the datasource property becomes nothing, i mean this is a web control that must preserve its state it would be frustrating to bind it every time right?
 
What i mean is the datasource is always present since i click several buttons on the page whihc go to the server and then back and the data is not altered (so the datasource is till there)
however i want to access the data in the datagrid by looping in the rows of its datasource which is a datatable and when i do, an exception occurs because the datasource is nothing!!!!
 
Back
Top