You must Sign In to post a response.
  • Category: ASP.Net MVC

    Please help convert code to aspx engine

    @model CKEditorExample.ViewModels.Content.ContentViewModel

    @{
    ViewBag.Title = "Content Entry";
    Layout = "~/Views/Shared/_Layout.cshtml";
    }

    <h2>Content Input</h2>

    <form method="post" action="/Content/Submit">
    @Html.TextAreaFor(x => x.Text)

    <p><input type="submit" value="Submit" /></p>
    </form>

    please help convert code to write in MVC aspx engine
  • #761764
    You can try the following

    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="CKEditorExample.ViewModels.Content.ContentViewModel" %>



    <%:
    ViewBag.Title = "Content Entry";
    %>

    <h2>Content Input</h2>

    <form method="post" action="/Content/Submit">
    <%=Html.TextAreaFor(x => x.Text)

    <p><input type="submit" value="Submit" /></p>
    </form>

    You can also use normal html controls

    By Nathan
    Direction is important than speed

  • #761774
    hi

    Razor engine to aspx means change this
    @ to <%:

    @ -> Razor view
    <%: -> Aspx View

    I have mention below code aspx and Razor separetly

    sample aspx view code this


    <% using (Html.BeginForm()) { %>
    <%: Html.ValidationSummary(true) %>

    <fieldset>
    <legend>ExternalLogin</legend>

    <div class="editor-label">
    <%: Html.LabelFor(model => model.Provider) %>
    </div>
    <div class="editor-field">
    <%: Html.EditorFor(model => model.Provider) %>
    <%: Html.ValidationMessageFor(model => model.Provider) %>
    </div>

    <div class="editor-label">
    <%: Html.LabelFor(model => model.ProviderDisplayName) %>
    </div>
    <div class="editor-field">
    <%: Html.EditorFor(model => model.ProviderDisplayName) %>
    <%: Html.ValidationMessageFor(model => model.ProviderDisplayName) %>
    </div>

    <div class="editor-label">
    <%: Html.LabelFor(model => model.ProviderUserId) %>
    </div>
    <div class="editor-field">
    <%: Html.EditorFor(model => model.ProviderUserId) %>
    <%: Html.ValidationMessageFor(model => model.ProviderUserId) %>
    </div>

    <p>
    <input type="submit" value="Create" />
    </p>
    </fieldset>
    <% } %>



    Sample Razor engine code this


    @using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
    <legend>ExternalLogin</legend>

    <div class="editor-label">
    @Html.LabelFor(model => model.Provider)
    </div>
    <div class="editor-field">
    @Html.EditorFor(model => model.Provider)
    @Html.ValidationMessageFor(model => model.Provider)
    </div>

    <div class="editor-label">
    @Html.LabelFor(model => model.ProviderDisplayName)
    </div>
    <div class="editor-field">
    @Html.EditorFor(model => model.ProviderDisplayName)
    @Html.ValidationMessageFor(model => model.ProviderDisplayName)
    </div>

    <div class="editor-label">
    @Html.LabelFor(model => model.ProviderUserId)
    </div>
    <div class="editor-field">
    @Html.EditorFor(model => model.ProviderUserId)
    @Html.ValidationMessageFor(model => model.ProviderUserId)
    </div>

    <p>
    <input type="submit" value="Create" />
    </p>
    </fieldset>
    }

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #761781
    Hi Sp.

    Just replace @ with <%: ..... %>

    Why you are posting twice the same question, as you already posted in the below thread.

    http://www.dotnetspider.com/forum/342734-please-help-convert-code-to-aspx-engine.aspx

    Regards

    Sridhar Thota.
    If you learn from defeat..
    You haven't really lost..

    Sridhar Thota.
    Editor: DNS Forum.


Sign In to post your comments