如何使用C#代码创建一个asp.net页? [英] how to create an asp.net page ..using c# code?

查看:84
本文介绍了如何使用C#代码创建一个asp.net页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用c#创建一个ASP页面(Web表单),即:

当我按下按钮时,它将创建新页面.

我已经有了该页面:将其称为ExplorForumTopics

ExplorForumTopics xx =新的ExplorForumTopics();

url是{Page.Response.Redirect(〜/ExplorForumTopics.aspx");},但是这种方式行不通.

我的问题是:我可以从webform(ExplorForumTopics)创建新实例吗?
???如何显示?


更多信息:

我写了这个问题之后,
我看到了新的ASP页面,这是
http://www.codeproject. com/answers/65395/how-to-create-an-asp-net-page-using-csharp-code.aspx [

i want to create an asp page ( web form) using c# , that is to say:

when i press down button it will create new page.

i have the page already: called it ExplorForumTopics

ExplorForumTopics xx = new ExplorForumTopics();

the url is {Page.Response.Redirect("~/ExplorForumTopics.aspx");} , but this way does not work right.

my question is: can i create a new instance from webform (ExplorForumTopics )
??? how to show it ?


more info:

after i wrote this question,
i saw new asp page , this is
http://www.codeproject.com/answers/65395/how-to-create-an-asp-net-page-using-csharp-code.aspx[^]

so can i do the same thing? create new page for each button press down?

thanks a lot !!

推荐答案

对不起,但是我们的问题没有多大意义.
ASP.NET页面仅是带有由服务器运行的某些代码的HTML页面,您不必在按钮按下处理程序上创建它的实例.

在您的解决方案中,ExplorForumTopics.aspx页(VS2005,VS2008)应具有3个文件,
1. ExplorForumTopics.aspx
2. ExplorForumTopics.aspx.cs
3. ExplorForumTopics.aspx.designer.cs

对于VS2003,文件为;
1. ExplorForumTopics.aspx
2. ExplorForumTopics.aspx.cs
3. ExplorForumTopics.aspx.resx

现在,如果ExplorForumTopics.aspx页与调用页位于同一文件夹中,则应该可以使用;
Sorry but our question doesn''t make a lot of sense.
An ASP.NET page is little more than a HTML page with some code that is run by the server, you do not have to create an instance of it on the button press handler.

In your solution you should have 3 files for the ExplorForumTopics.aspx page (VS2005, VS2008),
1. ExplorForumTopics.aspx
2. ExplorForumTopics.aspx.cs
3. ExplorForumTopics.aspx.designer.cs

For VS2003 the files are;
1. ExplorForumTopics.aspx
2. ExplorForumTopics.aspx.cs
3. ExplorForumTopics.aspx.resx

Now if the ExplorForumTopics.aspx page is in the same folder as the calling page you should be able to use;
Response.Redirect("ExplorForumTopics.aspx");


要转到ExplorForumTopics.aspx页面,如果不能,则需要发布尝试执行此操作时遇到的错误.


To go to the ExplorForumTopics.aspx page, if you can''t then you need to post the error you get when you try to do this.


要显示论坛问题,可以让他们提出所有这些都从"ExplorForumTopics.aspx"重定向到同一页面,例如"DisplayForumTopic.aspx",并且在查询字符串中具有类似"DisplayForumTopic.aspx?MessageID = XX"的内容,然后使用
To display forum questions you could have them all redirect to the same page such as "DisplayForumTopic.aspx" from "ExplorForumTopics.aspx" and in the query string have something like "DisplayForumTopic.aspx?MessageID=XX" then use URL Rewriting[^] to change what the user sees in the address bar of the browser.


感谢您的回答,我使用的是vs 2010 Ultimate,每个asp页面都用您所说的三个文件创建了,是正确的!


我想做一些类似论坛设计的事情,当您单击线程标题时,它会打开新页面,每个线程都有其打开的URL链接,内容!!!

你能告诉我怎么做这个功能!?
thanks for answer, i am using vs 2010 ultimate , each asp page created with three file as you said , that is right !!


i want to do some thing like forum design , when you click the thread title it open new page ,each thread has its open url link, content !!!

can you tell how to do this function!?


这篇关于如何使用C#代码创建一个asp.net页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆