Dear all
I've found a problem with raising server-events from a LinkButton (although I suspect that other Controls have the same problem). It appears that if you set the ID property with a string containing "$" that the Server-Side events aren't fired. This is probably caused by the fact that the Javascript __doPostBack expects the $-sign to be used for some Control-identification magic. Now if this is the case I would expect ASP.Net to either raise an exception when I try to set the ID with such an invalid character, or do some kind of escaping to make sure it works transparantly for me. Below the code behind for a WebForm with which I've tested this. The aspx only contains a Panel named MyPanel. Does anyone know if this is something I could have known
using System
using System.Collections
using System.ComponentModel
using System.Data
using System.Drawing
using System.Web
using System.Web.SessionState
using System.Web.UI
using System.Web.UI.WebControls
using System.Web.UI.HtmlControls
namespace LinkButtonTes
public class WebForm1 : System.Web.UI.Pag
protected Panel MyPanel
private void Page_Load(object sender, System.EventArgs e
LinkButton lb = new LinkButton()
lb.ID = "_Edward$Test$X"
lb.Click += new EventHandler(lb_Click)
lb.Text = "CLICK which doesn't work"
MyPanel.Controls.Add(lb)
LiteralControl lc = new LiteralControl("<br/>")
MyPanel.Controls.Add(lc)
LinkButton lb2 = new LinkButton()
lb2.ID = "_EdwardTestX"
lb2.Click += new EventHandler(lb_Click)
lb2.Text = "CLICK which works"
MyPanel.Controls.Add(lb2)
#region Web Form Designer generated cod
!!!REMOVED for clarity!!
#endregio
private void lb_Click(object sender, EventArgs e
LiteralControl lc = new LiteralControl("<br/>Hello")
MyPanel.Controls.Add(lc)