Last post Jan 24, 2008 11:08 AM by ParrotBoy
Jan 24, 2008 01:47 AM|Echo Khan|LINK
I have a custom button control and a custom event for that button. The custom event fires for simple pages. But for Master page - Content Page th event is not firing.
I did the following line at the content page load : Page.RegisterRequiresRaiseEvent(btnOk); Surprisingly in this case it is working.
But pblm again when I have more than 1 buton.
Then I have to register like: Page.RegisterRequiresRaiseEvent(btnOk); Page.RegisterRequiresRaiseEvent(btnCancel);
Always the second event is firing.
Can anybody help on this?
Jan 24, 2008 07:55 AM|ParrotBoy|LINK
In the OnInit method of your custom button put this.Page.RegisterRequiresRaiseEvent(this);
Jan 24, 2008 08:43 AM|Echo Khan|LINK
Thanks for the reply. But it also failed. The scenario is if I have one control at page it works fine. But for more than one control always the last control's event fire.
Thanks for the reply.
Jan 24, 2008 09:32 AM|ParrotBoy|LINK
Could you post the code for your button control please
Jan 24, 2008 10:43 AM|Echo Khan|LINK
Here is the code for you. Just one thing: I have to render the button myself for some business requirement. (Like underscore at the access key) . So, I can not call the base.Render to do the stuff. And I have to made a event-delegation.
Thanks in advance .
base.Attributes["accesskey"] = _AccessKey;
int index = base.InnerText.IndexOf(_AccessKey, StringComparison.OrdinalIgnoreCase);
string akey = base.InnerText[index].ToString();
base.InnerHtml = base.InnerText.Substring(0, index) + "<span style=\"text-decoration: underline\">" + akey + "</span>" + base.InnerText.Substring(index + 1);
catch (IndexOutOfRangeException ex)
throw new Exception(base.InnerText + " does not contain tha accesskey: " + base.Attributes["accesskey"], ex);
catch (Exception ex)
if (_LM_ConfirmCancelForceSubmit == true)
js += "\nLM_ConfirmCancelNavigateScriptLeaveOKFlag=true;";
if (js != "")
Jan 24, 2008 11:08 AM|ParrotBoy|LINK
though that it will work in some cases though!