Replace Webforms with MVC

Asked

Viewed 126 times

2

Is there a way or a tool, just to avoid rewriting, to replace a code developed in Webforms and transport it to MVC? In Webforms there are runat=server, user control, Asp: Label etc... Example of part of the code to be replaced:

<asp:ScriptManager ID="scpManager" runat="server" OnPreRender="scpManager_PreRender">
    </asp:ScriptManager>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Label ID="Label10" runat="server" BackColor="#E1EBF2" Font-Bold="True" Font-Size="12pt"
                ForeColor="#666666" Text="CNPJ: " Style="margin-left: 10px;"></asp:Label>
            &nbsp;<asp:TextBox ID="txtCnpj" runat="server" Width="175px"></asp:TextBox>
            <asp:Button ID="cmdPesquisar" runat="server" OnClick="cmdPesquisar_Click"
                Text="Pesquisar" Width="106px" Style="margin-left: 10px;" />
            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                    <div style="position: absolute; width: 99%; height: 99%; z-index: 1;">
                        <br />
                        <asp:Image ID="imgCarregando" runat="server" ImageUrl="~/Images/Carregando.gif"
                            Style="position: absolute; top: -27px; left: 393px; height: 32px;" Width="32px" />
                        <asp:Label ID="lblAtualiza" Style="position: absolute; top: -17px; left: 440px;" runat="server" Font-Size="12pt" ForeColor="#6D7CA3" Text="Pesquisando..."></asp:Label>
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>

1 answer

3


No, there’s no tool for that.

The largest - and virtually single - layer to be changed to do this portability is the presentation - on MVC, the famous "view" - and there is nothing that will automate the process for you: you really need to do "on the arm".

If you’re in a hurry and you don’t have many options, the advice I can give you to minimize a little your route, is to use a Chrome Developer’s Tool of life to rescue the generated HTML from your pages and save them in files ". cshtml". Remember, if you insist on this "technique", be attentive to Javascripts and other necessary dependencies; moreover, it is worth remembering that the code generated by Webforms for presentations are not fully in accordance with W3C standards.

  • 2

    Alias I think that not only html will have to be redone but a lot of code, after all not work with native webcontrols . net and yes with html normal Controls.

  • 1

    I’ve been waiting for this. The job we don’t want is what we have to do.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.