all groups > asp.net building controls > june 2005 >
You're in the

asp.net building controls

group:

custom web controls and conversion to inline code



custom web controls and conversion to inline code Lefty
6/16/2005 11:48:01 AM
asp.net building controls: Our client wanted delivery of the code using inline scripting, but for
obvious reasons, we developed the ASP.NET 1.1 app using codebehind. We have
an issue now when trying to convert the codebehind code to an inline format.

The control fires a custom event (to pass detailed error info up the
containing page, should they choose to implement a listener for the event).
Using C# the custom control is doing something like this:

==============
public delegate void UserControlEventHandler(object sender,
ThinData.Common.UserControlEventArgs e);

public event UserControlEventHandler UserControlError;
==============

the parent page consuming the control was doing this:

==============
PersInfo1.UserControlError += new
ClientName.RegistrationUserControls.PersonalInformationForm.UserControlEventHandler(Generic_UserControlError);
==============

The above works fine using codebehind.

My problem is that within the containing page, when it is converted to
inline script, the namespace and name:
ClientName.RegistrationUserControls.PersonalInformationForm...

cannot be resolved properly. The error is "missing assembly reference?"

How should I be doing this so I can wire up the event in the parent page
properly?

Thanks.




Re: custom web controls and conversion to inline code lisa NO[at]SPAM starways.net
6/17/2005 9:19:01 AM
Um... have you tried giving a the full name of the object, including
the assembly reference that you're being told is missing?

Lisa


[quoted text, click to view]
Re: custom web controls and conversion to inline code Sergey Polyakov
6/17/2005 10:05:57 AM
Hello Lefty

When using inline script, you don't need to add event handler via the syntax
you described
(PersInfo1.UserControlError += new ....)

You should assign event handler via your control attribute:

<cc1: ... id="PersInfo1" runat="server"
OnUserControlError="Generic_UserControlError"...></cc1:...>

--
Best regards,
Sergey


[quoted text, click to view]

AddThis Social Bookmark Button