Posts

Showing posts from October, 2013

get submit button id in Page_Load

The sender argument to the handler contains a reference to the control which raised the event. private void MyClickEventHandler(object sender, EventArgs e) { Button theButton = (Button)sender; ... } Edit: Wait, in the Load event? That's a little tricker. One thing I can think of is this: The Request's Form collection will contain a key/value for the submitting button, but not for the others. So you can do something like: protected void Page_Load(object sender, EventArgs e) { Button theButton = null; if (Request.Form.AllKeys.Contains("button1")) theButton = button1; else if (Request.Form.AllKeys.Contains("button2")) theButton = button2; ... } Not very elegant, but you get the idea..

Escape an Underscore Like cause

if you search about Underscore this query will not get a true value Where Username Like '%_d' so you need to use : Where Username LIKE '%[_]d'