如何创建另一个ASPX文件服务器控件

编程入门 行业动态 更新时间:2024-10-11 21:29:32
本文介绍了如何创建另一个ASPX文件服务器控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我发展在VS 2008目前一个C#/ SQL ASP.NET Web应用程序,我把控制权从一个ASPX文件到另一个:

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 }

然而,它不能在这行Server.Transfer的后插入

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

runat="server"

在DataMatch.aspx文件到表元素,像这样:

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?

推荐答案

从表中删除了RUNAT的标签,而是在&LT把它包; ASP:面板&gt; 标记。应用能见度属性到面板

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

更多推荐

如何创建另一个ASPX文件服务器控件

本文发布于:2023-08-03 04:44:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1284057.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   文件服务器   ASPX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!