locked
ASP.NET Question regarding onchange not firing the subroutine in code behind RRS feed

  • Question

  • Body of index.cshtml looks like the following.

    <body>
        @*<form enctype="multipart/form-data" method="POST" > @*action="/upload">*@
            <div class="content px-4">
                <h1>QLS 5 Day Late File Upload</h1>
                <table style="width:100%">
                    <tr>
                        <td style="width:25%"></td>
                        <td style="width:50%" align="left">
                            <p>
                                1) Run the report below in QLS.<br />
                                2) Save the file to a directory, noting file name and directory.<br />
                                3) Upload file to server.<br />
                            </p>
                        </td>
                        <td style="width:25%"></td>
                    </tr>
                </table>
                <div>
                    @*<input type="file" name="qlsFile" id="qlsFile" OnChange="SubmitFile" />*@
                    <label for="qlsFile">Select 5 Day Late File</label>
                    <input type="file" name="nFile" id="qlsFile" accept=".csv,.txt" onchange="SubmitFile()" />
                    <input type="submit" id="btnUpload" text="Upload" runat="server"/>  
    
    
    
                    <br /><br />
                </div>
    
                <embed src="pdf/Steps.pdf" width="100%" height="1100px" />
            </div>
       @* </form>*@
    </body>

    Code Behind index.cshtml.cs looks like this.

           public void SubmitFile()
            {
                System.Diagnostics.Debug.WriteLine("submitFile");
            }
    Is there a reason that after selecting the file in never calls the code behind?  I have tried Razor, Blazor, ASP.NET, visual Studio professional, vscode (currently trying vscode).  I have done numerous examples from youtube but none seem to work.  Really confused...thanks!  



    FordIT

    • Moved by CoolDadTx Thursday, August 13, 2020 5:53 PM ASP.NET related
    Thursday, August 13, 2020 4:36 PM

All replies

  • This forum is for C#-specific questions only. Please post questions related to building web apps in ASP.NET in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, August 13, 2020 5:52 PM
  • The problem is that there are 200+ forums and you can't search for ASP.NET.  I don't know how you were able to get the forum link.  Now if only there was a way to move it to that forum.


    FordIT

    Friday, August 14, 2020 9:08 AM