Mising C# and VB.net in Web User Controls. Please help

  • Thread starter Thread starter fritz_schenk
  • Start date Start date
F

fritz_schenk

[This followup was posted to microsoft.public.dotnet.framework and a copy was sent to the cited author.]

I have a need to mix C# (or JScript) and VB.net in Web User Controls.
When I create a user control, the ID creates this in the current
project's language and I noticed the that class generated for the User
Control is placed in the ASP Namespace. Additional Web User Controls are
placed in the same namespace. Their code behind are flagged to be in the
language of the project.

How can I mix Web User Controls of different languages?

Thanks
 
You won't be able to use "true code behind" for the non-project language,
since a project currently compiles to one assembly, and the compilers don't
mix languages. Some workarounds:

Compile other languages manually (using VBC or CSC or whatever), and use
ILLINK (www.gotdotnet.com, user samples) to link them.

Use src="somefile.ascx.xx" instead of codebehind and do not compile the
files. You will need to deploy the source (.cs or .vb or whatever) along
with the ascx.

Put the code in the .ascx file, set the language in the directive ( <%@ ) at
the top of the page to whatever language you like.

-mike
MVP
 
[This followup was posted to microsoft.public.dotnet.framework and a
copy was sent to the cited author.]
Thank you Michael,
If I get this right, the IDE will not support either of these
approaches.
Am I correct?
Thanks

You won't be able to use "true code behind" for the non-project language,
since a project currently compiles to one assembly, and the compilers don't
mix languages. Some workarounds:

Compile other languages manually (using VBC or CSC or whatever), and use
ILLINK (www.gotdotnet.com, user samples) to link them.

Use src="somefile.ascx.xx" instead of codebehind and do not compile the
files. You will need to deploy the source (.cs or .vb or whatever) along
with the ascx.

Put the code in the .ascx file, set the language in the directive ( <%@ ) at
the top of the page to whatever language you like.

-mike
MVP

[This followup was posted to microsoft.public.dotnet.framework and a copy was sent to the cited author.]

I have a need to mix C# (or JScript) and VB.net in Web User Controls.
When I create a user control, the ID creates this in the current
project's language and I noticed the that class generated for the User
Control is placed in the ASP Namespace. Additional Web User Controls are
placed in the same namespace. Their code behind are flagged to be in the
language of the project.

How can I mix Web User Controls of different languages?

Thanks
 
The IDE supports using src (it just won't show it as as codebehind file).
For ILLINK, you could add a post-build command.

But, "native", single-click-and-it-works functionality isn't available for
these scenarios.
-mike
MVP

[This followup was posted to microsoft.public.dotnet.framework and a
copy was sent to the cited author.]
Thank you Michael,
If I get this right, the IDE will not support either of these
approaches.
Am I correct?
Thanks

You won't be able to use "true code behind" for the non-project language,
since a project currently compiles to one assembly, and the compilers don't
mix languages. Some workarounds:

Compile other languages manually (using VBC or CSC or whatever), and use
ILLINK (www.gotdotnet.com, user samples) to link them.

Use src="somefile.ascx.xx" instead of codebehind and do not compile the
files. You will need to deploy the source (.cs or .vb or whatever) along
with the ascx.

Put the code in the .ascx file, set the language in the directive ( <%@ ) at
the top of the page to whatever language you like.

-mike
MVP

[This followup was posted to microsoft.public.dotnet.framework and a
copy
was sent to the cited author.]
I have a need to mix C# (or JScript) and VB.net in Web User Controls.
When I create a user control, the ID creates this in the current
project's language and I noticed the that class generated for the User
Control is placed in the ASP Namespace. Additional Web User Controls are
placed in the same namespace. Their code behind are flagged to be in the
language of the project.

How can I mix Web User Controls of different languages?

Thanks
 
Michael, I'm grateful for your patience, and I am not quite
sure of what I am doing, I put the ascx.xx file in the same
directory, then I use the <%@ Register tagname="CLD"
Prefix="radio" src="whatever.ascx.xx" %>, it complains
"User control source files must have a .ascx file
extension".
Thanks
-----Original Message-----
The IDE supports using src (it just won't show it as as codebehind file).
For ILLINK, you could add a post-build command.

But, "native", single-click-and-it-works functionality isn't available for
these scenarios.
-mike
MVP

[This followup was posted to microsoft.public.dotnet. framework and a
copy was sent to the cited author.]
Thank you Michael,
If I get this right, the IDE will not support either of these
approaches.
Am I correct?
Thanks

You won't be able to use "true code behind" for the
non-project
language,
and the compilers
don't or whatever)
along the directive (
<%@ ) at
the top of the page to whatever language you like.

-mike
MVP

com...
[This followup was posted to microsoft.public.
dotnet.framework and a
copy
was sent to the cited author.]

I have a need to mix C# (or JScript) and VB.net in Web User Controls.
When I create a user control, the ID creates this in the current
project's language and I noticed the that class generated for the User
Control is placed in the ASP Namespace. Additional
Web User Controls
are flagged to be in
the

.
 
Back
Top