Button: Add OnClientClick property to bind a clientside js event to click
This commit is contained in:
@@ -15,15 +15,21 @@ namespace VAR.WebFormsCore.Controls
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
public string OnClientClick { get; set; }
|
||||
|
||||
public string CommandArgument { get; set; } = string.Empty;
|
||||
|
||||
public event EventHandler Click;
|
||||
|
||||
public override void Render(TextWriter textWriter)
|
||||
protected override void Render(TextWriter textWriter)
|
||||
{
|
||||
textWriter.Write("<input type=\"submit\" ");
|
||||
RenderAttributes(textWriter);
|
||||
RenderAttribute(textWriter, "value", _text);
|
||||
if (string.IsNullOrEmpty(OnClientClick) == false)
|
||||
{
|
||||
RenderAttribute(textWriter, "onclick", OnClientClick);
|
||||
}
|
||||
textWriter.Write(">");
|
||||
|
||||
base.Render(textWriter);
|
||||
|
||||
Reference in New Issue
Block a user