开发者

How to create a server control on another ASPX file

开发者 https://www.devze.com 2022-12-27 14:23 出处:网络
I am developing a C#/SQL ASP.NET web application in VS 2008.Currently, I am transferring control from one ASPX file to another:

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 开发者_StackOverflow社区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?


remove the "runat" tag from the table, and instead wrap it in an <asp:Panel> tag. Apply the visibility attribute to the panel.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号