我需要Html会是这样的:
<form onsubmit="return manipulateForm()">
...
</form>
我用
生成它HtmlTextWriterAttribute key;
string value;
using (HtmlTextWriter writer = new HtmlTextWriter(new System.IO.StringWriter(innerBuffer)))
{
writer.AddAttribute(key, value);
}
问题是HtmlTextWriterAttribute
Enum没有 OnSubmit 的定义,我会通过它吗?
答案 0 :(得分:1)
我们看到HtmlTextWriter
的班级具有AddAttribute
public virtual void AddAttribute(string name,string value);
所以解决方案就像:
using (HtmlTextWriter writer = new HtmlTextWriter(new System.IO.StringWriter(innerBuffer)))
{
writer.AddAttribute("onsubmit", "return manipulateForm()");
}