Using Event on Custom WebControl

  • Thread starter Alhambra Eidos Kiquenet
  • Start date

A

Alhambra Eidos Kiquenet

Hi all, misters,

I have a custom web control, and I want use it in my main user control ASCX.

My webcontrol has one event, see source code above

/// <summary>Control DropDownExtender para Ordenacion</summary>
[DefaultProperty("TargetControlID"), ToolboxItem(true),
ToolboxData("<{0}:DropDownExtenderOrdenacion
runat=server></{0}:DropDownExtenderOrdenacion>")]
public class DropDownExtenderOrdenacion : DropDownExtender
....

/// <summary>Click ordenación Asc</summary>
public event EventHandler ClickAscendente;

....
void lnkAscendente_Click(object sender, EventArgs e)
{
this.OnClickAscendente();
}


protected void OnClickAscendente()
{
EventArgs e = new EventArgs();
if (ClickAscendente != null) ClickAscendente(this, e);
RaiseBubbleEvent(this, e);
}



Using my webcontrol in ASCX:

<ordenacion:DropDownExtenderOrdenacion ID="ddeOrdenacionTasador"
runat="server" TargetControlID="lbTareasAsignadas_Columna_ClaveTasa"
ClickAscendente="OrdenacionAscendenteTasador_Click" />

Then, I get the following error:

Parser Error Message: Type
'TINSA.Cliente.Util.Controles.Ordenacion.DropDownExtenderOrdenacion' does not
have a public property named 'ClickAscendente'.


Any idea, please ? I'll be very grateful. Thanks in advance. Best regards
 
Ad

Advertisements

M

marss

<ordenacion:DropDownExtenderOrdenacion ID="ddeOrdenacionTasador"
runat="server" TargetControlID="lbTareasAsignadas_Columna_ClaveTasa"
ClickAscendente="OrdenacionAscendenteTasador_Click" />

Then, I get the following error:

Parser Error Message: Type
'TINSA.Cliente.Util.Controles.Ordenacion.DropDownExtenderOrdenacion' does not
have a public property named 'ClickAscendente'.


Add input parameter for OnClickAscendente method's signature:
protected void OnClickAscendente(EventArgs e)
...
Then, in ascx file:
<ordenacion:DropDownExtenderOrdenacion ...
OnClickAscendente="OrdenacionAscendenteTasador_Click" />

Also you may find it useful:
http://msdn2.microsoft.com/en-us/library/aa719907(VS.71).aspx

Regards,
Mykola
http://marss.co.ua
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top