Eventhandler for UserControl with button onClick event?

I'm using a custom button (actually html div with LinkButton embedded in it). Here is code of it: public delegate void ClickEventHandler(object sender, EventArgs e); public event ClickEventHandler Click = delegate { }; public string Text { get { return cmdLink. Text; } set { cmdLink.

Text = value; } } public bool CausesValidation { get { return cmdLink. CausesValidation; } set { cmdLink. CausesValidation = value; } } public string OnClientClick { get { return cmdLink.

OnClientClick; } set { cmdLink. OnClientClick = value; } } public string CssClass { get { return cmdLink. CssClass; } set { cmdLink.

CssClass = value; } } protected void cmdLink_Click(object sender, EventArgs e) { Click(this, e); } Here is usage in aspx page: Button_Control:ButtonControl ID="btnSave" runat="server" Text="Save" OnClick="btnSaveClick and this is in code-behind page of aspx page: protected void btnSaveClick(object sender, EventArgs e) { //do stuff here }.

I'm using a custom button (actually html div with LinkButton embedded in it). Here is code of it: public delegate void ClickEventHandler(object sender, EventArgs e); public event ClickEventHandler Click = delegate { }; public string Text { get { return cmdLink. Text; } set { cmdLink.

Text = value; } } public bool CausesValidation { get { return cmdLink. CausesValidation; } set { cmdLink. CausesValidation = value; } } public string OnClientClick { get { return cmdLink.

OnClientClick; } set { cmdLink. OnClientClick = value; } } public string CssClass { get { return cmdLink. CssClass; } set { cmdLink.

CssClass = value; } } protected void cmdLink_Click(object sender, EventArgs e) { Click(this, e); } Here is usage in aspx page: and this is in code-behind page of aspx page: protected void btnSaveClick(object sender, EventArgs e) { //do stuff here }.

– teebot. Be Jun 11 '09 at 14:29 I guess it's a convention then? Thanks a lot for your answer!

– teebot. Be Jun 11 '09 at 14:39 You have to write OnClick="btnSaveClick" and write event handler method in your code behind page.It is called by control's Click event. – TheVillageIdiot Jun 12 '09 at 2:10.

That's what I already have and it works. But the question is rather how do you go from declaring an eventhandler in your html markup to attaching to your bubbling event? (So I don't have to link it in the code behind of the hosting page) – URL1 Jun 10 '09 at 6:42.

I found it! Instead of using event bubbling I use reflexion in the click eventhandler of the user control so I have : public string OnClick; protected void Button1_Click(object sender, EventArgs e) { MethodInfo methodInfo = this.Page.GetType(). GetMethod(OnClick); methodInfo.

Invoke(this. Page, new object{ sender, e }); } And it works with declaring the user control as.

It is reflection not reflexion and delegates and event handlers just do that for you automatically! – TheVillageIdiot Jun 12 '09 at 2:11.

I'm using a custom button (actually html div with LinkButton embedded in it). Here is code of it.

Keypress,?. Nata? ,?

,?!? UserControl?.? UserControl(?)? (?,?

"?").? "?"? ,?...? -? (?,?).? ,?

(?)? ,? ,?

,? UserControl. /// Summary description for BaseButton.

Public class BaseButton : System.Windows.Forms. /// Required designer variable. // This call is required by the Windows.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions