Question about passing aspx pages into methods

J

Jim Bancroft

I have a .Net component I'm experimenting with that has a method like so:

public void CTest(System.Web.UI.Control myPage)
{
DataGrid myGrid= (DataGrid)
myPage.FindControl("DataGrid1");
foreach (DataGridItem item in myGrid.Items)
//etc...
}

When I call this component from an aspx page I get an error that tells me
"The type ASP.TestPage_aspx in Assembly.." <snip> "is not marked as
serializable"

I'm not quite sure what the problem is. Is it that you can't pass .aspx
pages into methods because of serialization issues, or am I making a mistake
passing it as a UI.Control, something higher up the inheritance foodchain?
If you have any leads or advice I'd be grateful. Thanks very much.


-Jim
 
K

Karl Seguin

I can't imagine you'd be getting this unless you are doing something odd
with the page, like trying to store it in the session...certainly nothing
you've provided indicates what the problem could be.

you might wanna try a simple example and build on it 'til you find out what
exactly it is that you are doing incorectly.

karl
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top