This is a migrated thread and some comments may be shown as answers.

[Solved] VB.NET code

2 Answers 122 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gareth
Top achievements
Rank 1
Gareth asked on 31 May 2011, 04:43 PM
Hi,

Can someone help with converting this to vb.net? I can't work out the .content section:

    <% Html.Telerik().Window()
           
.Name("Window")
           
.Title("Telerik Window for ASP.NET MVC")
           
.Draggable((bool)ViewData["movable"])
           
.Resizable(resizing => resizing
               
.Enabled((bool)ViewData["resizable"])
               
.MinHeight(250)
               
.MinWidth(250)
               
.MaxHeight(500)
               
.MaxWidth(500)
           
)
           
.Scrollable((bool)ViewData["scrolling"])
           
.Modal((bool)ViewData["modal"])
           
.Buttons(b => b.Maximize().Close())
           
.Content(() =>
           
{%>
               
<p style="text-align: center">
                    <img src="
<%= Url.Content("~/Content/Window/window.png")%>"
                         alt="Window for ASP.NET MVC logo" style="display:block;margin:0 auto
                             10px;" />
                           
                    The Telerik Window for ASP.NET MVC is
<br /> the right choice for creating Window
                        dialogs
<br />
                    and alert/prompt/confirm boxes
<br /> in your ASP.NET MVC applications.
               
</p>
           
<%})
           
.Width(300)
           
.Height(300)
           
.Render();
    %>

Thanks

Gareth

2 Answers, 1 is accepted

Sort by
0
Gareth
Top achievements
Rank 1
answered on 02 Jun 2011, 09:01 AM
O.K., if no-one can tell me how to convert
.Content(() =>
           {%>
                <p style="text-align: center">
                    <img src="<%= Url.Content("~/Content/Window/window.png")%>"
                         alt="Window for ASP.NET MVC logo" style="display:block;margin:0 auto
                             10px;" />
                             
                    The Telerik Window for ASP.NET MVC is<br /> the right choice for creating Window
                        dialogs<br />
                    and alert/prompt/confirm boxes<br /> in your ASP.NET MVC applications.
                </p>
           <%})

can anyone tell me what it's called? Is () => a lambda or anonymous or what? And what's it called when you have the html (i.e. the bit between %> <%) embedded in the function/lambda??

Thanks

Gareth
0
Roobin
Top achievements
Rank 1
answered on 16 Jun 2011, 02:59 PM
Hello Gareth,

I cant belive that noone from Telrik has helped you with this.
Trick is for you and anybody else facing this problem:
Inline Subs as in the example code below.

.Content(
    Sub()
        %>
             <p style="text-align: center">
                  This is the content!
             </p>
        <%
        End Sub
     ) _


For function as in various ClientEvents methods use this syntax
.ClientEvents(Function(ev) ev.OnChange("OnchangeJsMethod")) _

And for anonymous object its this syntax:

.HtmlAttributes(New With { .style = "padding:5px;", .title = "a title"}) _


Here is the complete example

<% Html.Telerik().Window() _
       .Name("Window") _
       .Title("Telerik Window for ASP.NET MVC") _
       .Draggable(True) _
       .Resizable(
           Sub(resizing)
               With resizing
                   .Enabled(True)
                   .MinHeight(250)
                   .MinWidth(250)
                   .MaxWidth(500)
                   .MaxWidth(500)
                    
               End With
               End Sub
        ) _
        .Scrollable(True) _
        .Modal(True) _
        .Buttons(
                Sub(b)
                    b.Maximize()
                    b.Close()
                End Sub
            ) _
       .Content(
           Sub()
               %>
                    <p style="text-align: center">
                        <img src="<%= Url.Content("~/Content/Window/window.png")%>"
                             alt="Window for ASP.NET MVC logo" style="display:block;margin:0 auto
                                 10px;" />
             
                        The Telerik Window for ASP.NET MVC is<br /> the right choice for creating Window
                            dialogs<br />
                        and alert/prompt/confirm boxes<br /> in your ASP.NET MVC applications.
                    </p>
               <%
               End Sub
            ) _
        .Width(300) _
        .Height(300) _
        .Render()
    %>

Tags
Window
Asked by
Gareth
Top achievements
Rank 1
Answers by
Gareth
Top achievements
Rank 1
Roobin
Top achievements
Rank 1
Share this question
or