0

I need the Html will be something like:

<form onsubmit="return manipulateForm()">
...
</form>

I'm generating it with

HtmlTextWriterAttribute key;
string value;

using (HtmlTextWriter writer = new HtmlTextWriter(new System.IO.StringWriter(innerBuffer)))
{
    writer.AddAttribute(key, value);
}

The problem is that the HtmlTextWriterAttribute Enum does not have a definition for OnSubmit, hot do i get passed it?

Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91

1 Answers1

1

Just saw that the class of HtmlTextWriter has override function for AddAttribute

public virtual void AddAttribute(string name, string value);

So the solution will be like:

using (HtmlTextWriter writer = new HtmlTextWriter(new System.IO.StringWriter(innerBuffer)))
{
    writer.AddAttribute("onsubmit", "return manipulateForm()");
}
Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91