HTML helpers in Webform?(Webform 中的 HTML 助手?)
问题描述
我有一个旧站点,我想使用诸如 HTML 助手之类的东西来生成特殊的 HTML(在这种情况下是复杂的按钮).我知道这在 ASP.NET MVC 中是如何工作的,但我如何在 Webform(而不是 Razor)中做到这一点.
I have a old site that I want to use something like HTML helpers to generate special HTML(in this case complexed buttons). I know how this works in ASP.NET MVC but how can I do it in Webform(not Razor).
我已经阅读了关于这样的静态方法的建议:
I have read suggestions on static methods like this :
public class Helpers
{
public static string Label1(string target, string text)
{
return String.Format("<label for= '{0}'>{1}</label>", target, text);
}
}
但是如何在 Webform 中使用它?
But how is this used in the Webform?
最好的问候
推荐答案
在您的解决方案中.添加一个名为 code 的特殊文件夹 ASP.net Folder.然后粘贴您的 Helpers.cs 文件.然后就可以访问了.
At your solution. Add a special folder ASP.net Folder called code. Then paste your Helpers.cs file at it. Then you can access it.
这篇关于Webform 中的 HTML 助手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Webform 中的 HTML 助手?
基础教程推荐
- 获取C#保存对话框的文件路径 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 如果条件可以为空 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 将数据集转换为列表 2022-01-01
