By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,955 Members | 1,756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,955 IT Pros & Developers. It's quick & easy.

Question about passing aspx pages into methods

P: n/a

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
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jim Bancroft" <as******@nowhere.com> wrote in message
news:eS**************@TK2MSFTNGP15.phx.gbl...

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

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.