How to create a server control on another ASPX file

Posted by salvationishere on Stack Overflow See other posts from Stack Overflow or by salvationishere
Published on 2010-04-15T17:49:31Z Indexed on 2010/04/15 17:53 UTC
Read the original article Hit count: 313

Filed under:
|
|
|

I am developing a C#/SQL ASP.NET web application in VS 2008. Currently, I am transferring control from one ASPX file to another:

    if (uploadFile.PostedFile.ContentLength > 0)
    {

        inputfile = System.IO.File.ReadAllText(path);
        Context.Items["Message"] = inputfile; //Page1
        Server.Transfer("DataMatch.aspx"); //Page1
    }

However, it fails on this Server.Transfer line after inserting

runat="server"

in the DataMatch.aspx file to the Table element like so:

<table width="50%" id="tMain" runat="server">

But after making this a server control, I rebuilt it and now when I run this app it gives me exception:

Error executing child request for DataMatch.aspx

But I need this table to be a server control so I can make it invisible programmatically if a certain condition occurs. How else can I programmatically make this table invisible?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vs2008