private void Literal1_PreRender(object sender, System.EventArgs e)
{
string clickLink = Literal1.UniqueID+"ClickLink";
string clickEvent = Literal1.UniqueID+"ClickBlock";
string eventName = Literal1.UniqueID+"OnClick()";
//Link a function to the onclick event of the rendered literal
if (!(Page.IsClientScriptBlockRegistered(clickLink)))
Page.RegisterClientScriptBlock(clickLink,
"\n\t<SCRIPT LANGUAGE=javascript FOR=" + Literal1.UniqueID + " EVENT=onclick>\n\t\t"+
eventName +";\n\t"+
"</SCRIPT>");
//Define the function for the onclick event of the rendered literal
if (!(Page.IsClientScriptBlockRegistered(clickEvent )))
Page.RegisterClientScriptBlock(clickEvent ,
"<SCRIPT LANGUAGE=javascript>\n\t"+
"function " + eventName + "\n\t{\n\t\t"+
"//Perform some functionality here. . .\n\t\t"+
"alert(\"Here is your alert\");\n\t}\n\t"+
"</SCRIPT>");
//Set the HTML ID Attribute for your rendered literal
Literal1.Text = String.Format(Literal1.Text,Literal1.UniqueID);
}