MVC Knowledge Application

Source: Internet
Author: User

Mvc

Add to
Roche.Models.Logincodes per = new Roche.Models.Logincodes ();
Per. QRCode = data. QRCode;
Per. Count = Adminid;
Dd.Logincodes.InsertOnSubmit (per);
Dd.submitchanges ();


Modify
using (var db = new Runhuayoumodeldatacontext ())
{
var Amodel = Db.admin.Where (b = B.adminid = = Adminid). Singleordefault ();
Amodel.password = Psmodel. NewPassword1;
Db. SubmitChanges ();
}


Delete
Dd.executecommand (String. Format ("Delete from Brand where ID in ({0})", String. Join (",", Deleteid))); It is recommended to use this

var coming = Db.Comings.Find (ID);

Db.Comings.Remove (coming);

Db.savechanges ();
-------------------------------------------
using (var db = new Runhuayoumodeldatacontext ())
{
var Amodel = Db.admin.Where (b = B.adminid = = Adminid). Singleordefault ();
Amodel.password = Psmodel. NewPassword1;
Db. SubmitChanges ();
}


Lambda-expression
N.name.startswith (Name)--equivalent to a%
N.name.endswith (Name)--equivalent to%a
N.name.indexof (Name)!=-1--equivalent to%a%
. Names.contains (amodel.names)--equivalent to%a%

A label pass value
<a href= "/home/[email protected]" >

var idstr = request["Text_" + item]; background Gets the value labeled Text_

@Html. hiddenfor (b = b.id)//Hidden text
--------------------------------------------------------------------------------------------------------------- -----------This belongs to one inside
Front desk @Html. Validationmessage ("Tip")
Background modelstate.addmodelerror ("Tip", "Login Error");

*[allowhtml]* This is the main
public string content {get; set;} The upload added in the model

Public HttpPostedFileBase caseimg {get; set;} -This is what the text editor must use in the model

@using (Html.BeginForm ("views", "Controllers", FormMethod.Post, new {enctype = "multipart/form-data"}))
{
@Html. textboxfor (b + = B.spic, new {type = "file", @class = "Text-input medium-input"})//This is the upload foreground code
}
--------------------------------------------------------------------------------------------------------------- ----------------
@Html. dropdownlistfor (b = b.newstype, (selectlist) viewbag.newslist, new {@class = "Personselecter02"})//This is a drop-down box

--------------------------------------------------------------------------------------------------------------- ----------------
<script> Store Numbers
function Checknum () {
if ((Event.keycode < | | Event.keycode > $) && (Event.keycode! = 88))
Event.returnvalue = false;
}
</script>

--------------------------------------------------------------------------------------------------------------- ----------------
[Required (errormessage = "* Enter your e-mail address")]mvc the properties inside the model
[RegularExpression (@ "[A-za-z0-9._%+-][email protected][a-za-z0-9]+\.[ a-za-z]{2,4} ", errormessage =" *{0} is not properly formatted ")]

==============================================================================================
<input type= "button" value= "return" onclick= "Javascript:history.go ( -1)" >//return

After the project is loaded Error--------------------------------------------------------------------------------------------------------------------
Workaround
http://blog.csdn.net/sat472291519/article/details/17246247

The COM component is named Microsoft Internet Controls. Add a reference to the following add references->com tab-> Microsoft Internet Controls
. NET tab->microsoft.mshtml

-------------------------------------This is the text editor URL------
http://kindeditor.net/
---------------------------------------------------------Methods in MVC
Comparison of ActionResult and sub-categories

Description of the subclass name of the ActionResult

Viewresult represents the HTML page content

Emptyresult indicates blank page content

Redirectresult means to navigate to a different URL

Jsonresult indicates that JSON results can be applied to Ajax programs

Javascriptresult represents a JavaScript object

Contentresult represents a textual content

Filecontentresult represents a file that can be downloaded, binary content

Filepathresult represents a file that can be downloaded with a specified path

Filestreamresult represents a downloadable, streaming file

MVC Knowledge Application

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.