Mid and InStrRev conversion to c#

S

sck10

Hello,

I am converting a DataList from vb to c#. I am having a problem converting
the Mid function with InStrRev to c#. Any help with this would be
appreciated.

<asp:DataList id="dlstPhotoGallery" Runat="Server"
RepeatDirection="Horizontal">
<ItemTemplate>
<a href='<%# Replace(Container.DataItem,"_mini","") %>' target="_blank">
<asp:Image ID="imgPhotoGallery" ImageUrl='<%# Container.DataItem %>'
ToolTip='<%# Mid(Container.DataItem, InStrRev(Container.DataItem, "/")
+ 1) %>' Runat="Server" />
</a>
</ItemTemplate>
</asp:DataList>
</asp:panel>
 
C

Cowboy \(Gregory A. Beamer\)

For Mid, you can use a substring. Put the position (0 based) and the length
you desire. I forget what InStrRev contains.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
S

Siva M

Mid - String.Substring()
InStrRev - String.LastIndexOf()

Hello,

I am converting a DataList from vb to c#. I am having a problem converting
the Mid function with InStrRev to c#. Any help with this would be
appreciated.

<asp:DataList id="dlstPhotoGallery" Runat="Server"
RepeatDirection="Horizontal">
<ItemTemplate>
<a href='<%# Replace(Container.DataItem,"_mini","") %>' target="_blank">
<asp:Image ID="imgPhotoGallery" ImageUrl='<%# Container.DataItem %>'
ToolTip='<%# Mid(Container.DataItem, InStrRev(Container.DataItem, "/")
+ 1) %>' Runat="Server" />
</a>
</ItemTemplate>
</asp:DataList>
</asp:panel>
 
G

Guest

The following was produced with our Instant C# VB to C# converter (asp.net
snippet tab):

<asp:DataList id="dlstPhotoGallery" Runat="Server"
RepeatDirection="Horizontal">
<ItemTemplate>
<a href='<%#Container.DataItem.Replace("_mini", "")%>'
target="_blank">
<asp:Image ID="imgPhotoGallery" ImageUrl='<%#Container.DataItem%>'

ToolTip='<%#Container.DataItem.Substring((Container.DataItem.LastIndexOf("/")
+ 1))%>'
Runat="Server" />
</a>
</ItemTemplate>
</asp:DataList>
</asp:panel>

By the way, while Reflector is a great tool, it's impractical for most
conversion purposes. The main goal in conversion is not just to get code
that runs in another language, but to get code that conveys the same
information and is understood. Any tool that converts to IL and back again
will be obscured with convoluted IL interpretations & optimizations and
missing comments. In addition, it would be very impractical to convert
ASP.NET in-line code.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
 
S

sck10

Thanks David, appreciate the help...


David Anton said:
The following was produced with our Instant C# VB to C# converter (asp.net
snippet tab):

<asp:DataList id="dlstPhotoGallery" Runat="Server"
RepeatDirection="Horizontal">
<ItemTemplate>
<a href='<%#Container.DataItem.Replace("_mini", "")%>'
target="_blank">
<asp:Image ID="imgPhotoGallery" ImageUrl='<%#Container.DataItem%>'

ToolTip='<%#Container.DataItem.Substring((Container.DataItem.LastIndexOf("/")
+ 1))%>'
Runat="Server" />
</a>
</ItemTemplate>
</asp:DataList>
</asp:panel>

By the way, while Reflector is a great tool, it's impractical for most
conversion purposes. The main goal in conversion is not just to get code
that runs in another language, but to get code that conveys the same
information and is understood. Any tool that converts to IL and back
again
will be obscured with convoluted IL interpretations & optimizations and
missing comments. In addition, it would be very impractical to convert
ASP.NET in-line code.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
 

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

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top