Can't pass DataView object from shared assembly to aspx page.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top