C# to VB: specific issue

M

Michel Couche

Hello,

Normally automatic converters do a very good job at translating code between
C# and VB

I have a specific issue however that I can not solve using these converters
.... and I just can not figure out how to do it myself.
The line that causes problem is:
:
<%# ((AuthorizationRule) Container.DataItem).Action %>

It is used in the context below:

<asp:datalist id="DL_Rules" runat="server">
<itemtemplate>
Action: <asp:literal id="Literal1" runat="server"
text='<%# ((AuthorizationRule)
Container.DataItem).Action %>'/>
<itemtemplate><%# Container.DataItem %></itemtemplate>
<separatortemplate>-</separatortemplate>
</asp:repeater>
</itemtemplate>
</asp:datalist>

The source of this code is
http://www.akaas.net/asp-net-2-tutorial/Chap13.htm

Thanks in advance for your support,

Michel
 
T

Tom John

Michael

The VB syntax for that line is:

<%# Ctype(Container.DataItem, AuthorizationRule).Action %>

The type name in parenthesis before the object is C# syntax for
casting.

Hope this helps

Tom
 

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

Members online

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top