Skip to content

Instantly share code, notes, and snippets.

@JakubLinhart
Created March 11, 2012 21:34
Show Gist options
  • Save JakubLinhart/2018283 to your computer and use it in GitHub Desktop.
Save JakubLinhart/2018283 to your computer and use it in GitHub Desktop.
Javascript registration via ClientScript
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ClientScriptRegistration.aspx.cs"
Inherits="ScriptRegistrationLabyrinth.ClientScriptRegistration" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button runat="server" ID="Button1" Text="Do postback" OnClick="Button1_Click" />
<asp:Literal runat="server" ID="Literal1" />
</div>
</form>
</body>
</html>
using System;
namespace ScriptRegistrationLabyrinth
{
public partial class ClientScriptRegistration : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
Literal1.Text = "<script>alert('Button1 clicked')</script>";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment