J
James X. Li
I have following C# method to generate a DataView object:
DataView TestView() {
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("A", typeof(string)));
dt.Columns.Add(new DataColumn("B", typeof(string)));
DataRow dr = dt.NewRow();
dr[0] = "1"; dr[1] = "2";
dt.Rows.Add(dr);
return new DataView(dt);
}
When this method is included in an aspx page and bound to a DataGrid control
it displays the data correctly. However, when I move this method to a
separate C# class
and compile it into a shared assembly (stored in the bin directory), the
DataGrid displays
the string "false" instead of "1" and "2".
It looks like the ASP framework MAGICALLY filtered out the content of the
view. Why?
Also, when I passed the Server object to a shared assembly, within the
shared assemly
the method Server.MapPath() return the wrong mapping path. Is this a
designed restriction
of ASP framework?
Where can find information about which objects can be correctly passed
between
aspx pages and shared assemblies in the bin directory.
Thanks in advance,
James
DataView TestView() {
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("A", typeof(string)));
dt.Columns.Add(new DataColumn("B", typeof(string)));
DataRow dr = dt.NewRow();
dr[0] = "1"; dr[1] = "2";
dt.Rows.Add(dr);
return new DataView(dt);
}
When this method is included in an aspx page and bound to a DataGrid control
it displays the data correctly. However, when I move this method to a
separate C# class
and compile it into a shared assembly (stored in the bin directory), the
DataGrid displays
the string "false" instead of "1" and "2".
It looks like the ASP framework MAGICALLY filtered out the content of the
view. Why?
Also, when I passed the Server object to a shared assembly, within the
shared assemly
the method Server.MapPath() return the wrong mapping path. Is this a
designed restriction
of ASP framework?
Where can find information about which objects can be correctly passed
between
aspx pages and shared assemblies in the bin directory.
Thanks in advance,
James