编写没有任何HTML标签的aspx页面

问题描述:

大家好,我有一个非常基本的问题,但是不幸的是我没有以这种方式工作,所以我不知道.

问题是,当我们使用以下格式的aspx页面时,请在下面给出.
以及我们如何将控件转移到此类页面.


Hi guys, i have a very basic level question but unfortunately i have not worked this way so i don''t know it.

question is, when we use the following format of aspx page, give below.
and how we transfer the control to this type of page.


<%@ Page Language="VB" %>

<%
 'only the VB code will place on this entire page. no HTML tag is placed on it.
%>


此页面在客户端没有任何作用.


this page does not make any effect at client end. but used only for doing some server end processing.

例如,您可以将所有HTML放入一个APS.NET 文字控件 :

For example, you can put all your HTML into one APS.NET literal control:

<asp:Literal id="htmlLiteral" runat="server"/>



然后将您的HTML文本分配给属性htmlLiteral.Text.

我想知道为什么要这么单纯吗? :-)请参阅我对问题的评论.

—SA



and then assign your HTML text to the property htmlLiteral.Text.

I wonder why being such a purist? :-) See my comment to the question.

—SA


我的回答基于您在SA的回答中发布的问题和评论.
My answer based on your question and comments posted in SA''s answer.
报价:

我的方案是我有一个网页,我希望将呼叫发布到另一个页面以执行某些操作,但我不希望这样做.丢失当前加载的页面.我的意思是从Page1.aspx调用Page2.aspx,这样装入的页面(page1.aspx)不会回发.而且我也不想使用JSON.希望您能理解这种情况.

My Scenario is I have a web page, i wish to post a call to another page for performing some action but i do not wish to lose the currently loaded page. i mean to call Page2.aspx from Page1.aspx in such a way that Loaded page (page1.aspx) will not postback. and i do not wish to use JSON as well. hope you understand the scenario.


当Asp.Net为您提供代码隐藏文件(Aspx.vb/Aspx.cs)时,为什么要像Classic ASP那样编程?

如果您希望其他页面执行/处理您的功能并将结果返回给您的页面,请使用 Ajax .

看看下面关于此的CodeProject文章.

在ASP.NET中将jQuery用于AJAX

Jquery Ajax调用函数

简化Asp.Net Core Ajax


Why to program like Classic ASP when Asp.Net provides you Code-Behind file(Aspx.vb/Aspx.cs) for that?

If you want some other page to execute/process your functionality and return result back to your Page then use Ajax.

Have a look at below CodeProject Articles on this.

Using jQuery for AJAX in ASP.NET

Jquery Ajax Calling Functions

Simplifying Asp.Net Core Ajax


根据您的情况,您只需在项目中指定一个类,然后调用可以实现实现的那些类的方法即可.



但是您仍然可以编写不包含html内容的页面.但是您所写的内容都将以纯文本显示(没有任何效果)
For your situation you can just specify a class in your project and call the methods of those class where the implementaions(which you said in the above page) can be done.



But still you can write a page with out html content. but what ever you write will be displayed as plain text(with out any effects)