Two minor problems encountered in ASP. net mvc development

Source: Internet
Author: User

Two minor problems encountered in ASP. net mvc development
I recently developed a website using asp.net MVC4.0. Today I encountered two small problems and solved them by searching for relevant channels. Here I wrote these two questions, which is very simple, mark hopes to help beginners who encounter the same problems. Problem 1: I want to implement asynchronous file upload. The files submitted by the front-end cannot be obtained in the background. I wrote it like this: copy the code @ using (Ajax. beginForm ("UpdateNewInfo", "Home", new AjaxOptions () {HttpMethod = "post", OnSuccess = "afterAdd"}, new {id = "form1 "})) {<table> <td> select image </td> <input type = "file" id = "uploadImg" name = "fileUpImg"/> <input type =" button "id =" btnFileUp "value =" Upload image "/> </td> </tr> </table>} copy the code and select an image, click the upload image button to asynchronously upload the image to the server. A Form is submitted and the ajaxSubmit is used to asynchronously upload the file. The backend obtains HttpPostedFileBase postFile = Request. Files ["fileUpImg"]. However, the postFile object is always empty. Check the Form and show data. What is the problem? This problem plagued me for one morning. Then I asked questions in the blog and someone immediately pointed out my mistake. Here is the problem @ using (Ajax. beginForm ("UpdateNewInfo", "Home", new AjaxOptions () {HttpMethod = "post", OnSuccess = "afterAdd"}, new {id = "form1 ", enctype = "multipart/form-data"}) When uploading files, you must set enctype = "multipart/Form-data" for the form ". Why? After checking this attribute, I suddenly realized: QQ20141203214923, I am not surprised, happy, and sad to see it here. What I like is that the problem is solved, sadly, I was troubled by such a problem all morning.  ̄ □ ̄ | Question 2 how to assign values to rich text editor I believe everyone has used Rich Text Editor, I use kindeditor-4.1.7 Rich Text Editor. I edited the content in the editor and stored it in the database. However, when I read the data from the database and assigned a value to Rich Text Using JQuery, it cannot be displayed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.