ASP.NET MVC的LabelFor的问题

ASP.NET MVC的LabelFor输出结果,其中br换行显示不出来,html中被转义了,请问如何避免转义?

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
asp.net mvc <input type="submit"/> 无效

在把asp.net mvc的控制器Edit方法和View代码完全复制到一个其他地方时,代码仍能很好的执行. 现在我想通过这个Edit方法修改部分信息,即不需要修改所有可能的列. 所以我删除了View中的一些输入框,比如这样的 <div class="form-group"> @Html.LabelFor(model => model.CardUserName, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.CardUserName, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.CardUserName, "", new { @class = "text-danger" }) </div> </div> 然后只剩下我想改的那一项,这时候 <input type="submit" value="Save" class="btn btn-default" /> 按钮就失效了. 想请教为什么QAQ 其实我对这个按钮真的不是很懂,希望大家能给尽可能详细的回答和知道,提前感谢

ASP.NET MVC5性别设置为bool,把根据EF生成的代码中checkbox改成radiobutton后的报错问题

这里是报错的图 ![图片说明](https://img-ask.csdn.net/upload/201903/17/1552835226_669209.png) Model代码 ``` using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace RadioButtonTest1.Models { public class UserGender { public int Id { get; set; } public string Name { get; set; } public bool Gender { get; set; } } } ``` Controller代码未修改 ``` using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Linq; using System.Net; using System.Web; using System.Web.Mvc; using RadioButtonTest1.Models; namespace RadioButtonTest1.Controllers { public class UserGendersController : Controller { private ApplicationDbContext db = new ApplicationDbContext(); // GET: UserGenders public ActionResult Index() { return View(db.UserGenders.ToList()); } // GET: UserGenders/Details/5 public ActionResult Details(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } UserGender userGender = db.UserGenders.Find(id); if (userGender == null) { return HttpNotFound(); } return View(userGender); } // GET: UserGenders/Create public ActionResult Create() { return View(); } // POST: UserGenders/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "Id,Name,Gender")] UserGender userGender) { if (ModelState.IsValid) { db.UserGenders.Add(userGender); db.SaveChanges(); return RedirectToAction("Index"); } return View(userGender); } // GET: UserGenders/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } UserGender userGender = db.UserGenders.Find(id); if (userGender == null) { return HttpNotFound(); } return View(userGender); } // POST: UserGenders/Edit/5 // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "Id,Name,Gender")] UserGender userGender) { if (ModelState.IsValid) { db.Entry(userGender).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(userGender); } // GET: UserGenders/Delete/5 public ActionResult Delete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } UserGender userGender = db.UserGenders.Find(id); if (userGender == null) { return HttpNotFound(); } return View(userGender); } // POST: UserGenders/Delete/5 [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { UserGender userGender = db.UserGenders.Find(id); db.UserGenders.Remove(userGender); db.SaveChanges(); return RedirectToAction("Index"); } protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); } } } ``` Create页面代码(这里之前的checkbox被改成了RadioButton) ``` @model RadioButtonTest1.Models.UserGender @{ ViewBag.Title = "Create"; } <h2>Create</h2> @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> <h4>UserGender</h4> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) <div class="form-group"> @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.Gender, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.RadioButton("gender", "male", Model.Gender) Male @Html.RadioButton("gender", "female", !Model.Gender) Fmale </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Create" class="btn btn-default" /> </div> </div> </div> } <div> @Html.ActionLink("Back to List", "Index") </div> @section Scripts { @Scripts.Render("~/bundles/jqueryval") } ```

ASP.NET MVC5项目中,如何使用rediobutton插入数据

比如我想添加性别数据,用rediobutton。EF原句如下: ``` <div class="form-group"> @Html.LabelFor(model => model.Gender, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Gender, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Gender, "", new { @class = "text-danger" }) </div> </div> ``` 怎么把它改成用rediobutton选性别?

关于MVC中日期选择控件如何添加?

代码如下 ``` <div class="form-group"> @Html.LabelFor(model => model.Date, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.Date, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Date, "", new { @class = "text-danger" }) </div> </div> ``` 现在是输入日期,如何添加日期选择控件呢? ![图片说明](https://img-ask.csdn.net/upload/201810/11/1539228411_889802.png)

asp.net webuploader多图片上传并保存文件路径到数据库

![图片说明](https://img-ask.csdn.net/upload/201906/22/1561187942_114655.jpg) 要做一个滚动窗功能,使用webuploader插件 不知道在哪获取文件路径,保存到数据库里 上传的upload.js ``` (function( $ ){ // 当domReady的时候开始初始化 $(function() { var $wrap = $('.uploader-list-container'), // 图片容器 $queue = $( '<ul class="filelist"></ul>' ) .appendTo( $wrap.find( '.queueList' ) ), // 状态栏,包括进度和控制按钮 $statusBar = $wrap.find( '.statusBar' ), // 文件总体选择信息。 $info = $statusBar.find( '.info' ), // 上传按钮 $upload = $wrap.find( '.uploadBtn' ), // 没选择文件之前的内容。 $placeHolder = $wrap.find( '.placeholder' ), $progress = $statusBar.find( '.progress' ).hide(), // 添加的文件数量 fileCount = 0, // 添加的文件总大小 fileSize = 0, // 优化retina, 在retina下这个值是2 ratio = window.devicePixelRatio || 1, // 缩略图大小 thumbnailWidth = 110 * ratio, thumbnailHeight = 110 * ratio, // 可能有pedding, ready, uploading, confirm, done. state = 'pedding', // 所有文件的进度信息,key为file id percentages = {}, // 判断浏览器是否支持图片的base64 isSupportBase64 = ( function() { var data = new Image(); var support = true; data.onload = data.onerror = function() { if( this.width != 1 || this.height != 1 ) { support = false; } } data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; return support; } )(), // 检测是否已经安装flash,检测flash的版本 flashVersion = ( function() { var version; try { version = navigator.plugins[ 'Shockwave Flash' ]; version = version.description; } catch ( ex ) { try { version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') .GetVariable('$version'); } catch ( ex2 ) { version = '0.0'; } } version = version.match( /\d+/g ); return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); } )(), supportTransition = (function(){ var s = document.createElement('p').style, r = 'transition' in s || 'WebkitTransition' in s || 'MozTransition' in s || 'msTransition' in s || 'OTransition' in s; s = null; return r; })(), // WebUploader实例 uploader; if ( !WebUploader.Uploader.support('flash') && WebUploader.browser.ie ) { // flash 安装了但是版本过低。 if (flashVersion) { (function(container) { window['expressinstallcallback'] = function( state ) { switch(state) { case 'Download.Cancelled': alert('您取消了更新!') break; case 'Download.Failed': alert('安装失败') break; default: alert('安装已成功,请刷新!'); break; } delete window['expressinstallcallback']; }; var swf = 'expressInstall.swf'; // insert flash object var html = '<object type="application/' + 'x-shockwave-flash" data="' + swf + '" '; if (WebUploader.browser.ie) { html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; } html += 'width="100%" height="100%" style="outline:0">' + '<param name="movie" value="' + swf + '" />' + '<param name="wmode" value="transparent" />' + '<param name="allowscriptaccess" value="always" />' + '</object>'; container.html(html); })($wrap); // 压根就没有安转。 } else { $wrap.html('<a href="http://www.adobe.com/go/getflashplayer" target="_blank" border="0"><img alt="get flash player" src="http://www.adobe.com/macromedia/style_guide/images/160x41_Get_Flash_Player.jpg" /></a>'); } return; } else if (!WebUploader.Uploader.support()) { alert( 'Web Uploader 不支持您的浏览器!'); return; } // 实例化 uploader = WebUploader.create({ pick: { id: '#filePicker-2', label: '点击选择图片' }, formData: { uid: 123 }, dnd: '#dndArea', paste: '#uploader', swf: '../Uploader.swf', chunked: false, chunkSize: 512 * 1024, server: './Ajax/UpLoad.ashx', // runtimeOrder: 'flash', accept: { title: 'Images', extensions: 'gif,jpg,jpeg,bmp,png', mimeTypes: 'image/*' }, // 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候,把图片打开。 disableGlobalDnd: true, fileNumLimit: 300, fileSizeLimit: 200 * 1024 * 1024, // 200 M fileSingleSizeLimit: 50 * 1024 * 1024 // 50 M }); // 拖拽时不接受 js, txt 文件。 uploader.on( 'dndAccept', function( items ) { var denied = false, len = items.length, i = 0, // 修改js类型 unAllowed = 'text/plain;application/javascript '; for ( ; i < len; i++ ) { // 如果在列表里面 if ( ~unAllowed.indexOf( items[ i ].type ) ) { denied = true; break; } } return !denied; }); uploader.on('dialogOpen', function() { console.log('here'); }); // uploader.on('filesQueued', function() { // uploader.sort(function( a, b ) { // if ( a.name < b.name ) // return -1; // if ( a.name > b.name ) // return 1; // return 0; // }); // }); // 添加“添加文件”的按钮, uploader.addButton({ id: '#filePicker2', label: '继续添加' }); uploader.on('ready', function() { window.uploader = uploader; }); // 当有文件添加进来时执行,负责view的创建 function addFile(file) { alert(file.name); var $li = $( '<li id="' + file.id + '">' + '<p class="title">' + file.name + '</p>' + '<p class="imgWrap"></p>'+ '<p class="progress"><span></span></p>' + '</li>' ), $btns = $('<div class="file-panel">' + '<span class="cancel">删除</span>' + '<span class="rotateRight">向右旋转</span>' + '<span class="rotateLeft">向左旋转</span></div>').appendTo( $li ), $prgress = $li.find('p.progress span'), $wrap = $li.find( 'p.imgWrap' ), $info = $('<p class="error"></p>'), showError = function( code ) { switch( code ) { case 'exceed_size': text = '文件大小超出'; break; case 'interrupt': text = '上传暂停'; break; default: text = '上传失败,请重试'; break; } $info.text( text ).appendTo( $li ); }; if ( file.getStatus() === 'invalid' ) { showError( file.statusText ); } else { // @todo lazyload $wrap.text( '预览中' ); uploader.makeThumb( file, function( error, src ) { var img; if ( error ) { $wrap.text( '不能预览' ); return; } if( isSupportBase64 ) { img = $('<img src="'+src+'">'); $wrap.empty().append( img ); } else { $.ajax('../server/preview.php', { method: 'POST', data: src, dataType:'json' }).done(function( response ) { if (response.result) { img = $('<img src="'+response.result+'">'); $wrap.empty().append( img ); } else { $wrap.text("预览出错"); } }); } }, thumbnailWidth, thumbnailHeight ); percentages[ file.id ] = [ file.size, 0 ]; file.rotation = 0; } file.on('statuschange', function( cur, prev ) { if ( prev === 'progress' ) { $prgress.hide().width(0); } else if ( prev === 'queued' ) { $li.off( 'mouseenter mouseleave' ); $btns.remove(); } // 成功 if ( cur === 'error' || cur === 'invalid' ) { console.log( file.statusText ); showError( file.statusText ); percentages[ file.id ][ 1 ] = 1; } else if ( cur === 'interrupt' ) { showError( 'interrupt' ); } else if ( cur === 'queued' ) { percentages[ file.id ][ 1 ] = 0; } else if ( cur === 'progress' ) { $info.remove(); $prgress.css('display', 'block'); } else if ( cur === 'complete' ) { $li.append( '<span class="success"></span>' ); } $li.removeClass( 'state-' + prev ).addClass( 'state-' + cur ); }); $li.on( 'mouseenter', function() { $btns.stop().animate({height: 30}); }); $li.on( 'mouseleave', function() { $btns.stop().animate({height: 0}); }); $btns.on( 'click', 'span', function() { var index = $(this).index(), deg; switch ( index ) { case 0: uploader.removeFile( file ); return; case 1: file.rotation += 90; break; case 2: file.rotation -= 90; break; } if ( supportTransition ) { deg = 'rotate(' + file.rotation + 'deg)'; $wrap.css({ '-webkit-transform': deg, '-mos-transform': deg, '-o-transform': deg, 'transform': deg }); } else { $wrap.css( 'filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation='+ (~~((file.rotation/90)%4 + 4)%4) +')'); // use jquery animate to rotation // $({ // rotation: rotation // }).animate({ // rotation: file.rotation // }, { // easing: 'linear', // step: function( now ) { // now = now * Math.PI / 180; // var cos = Math.cos( now ), // sin = Math.sin( now ); // $wrap.css( 'filter', "progid:DXImageTransform.Microsoft.Matrix(M11=" + cos + ",M12=" + (-sin) + ",M21=" + sin + ",M22=" + cos + ",SizingMethod='auto expand')"); // } // }); } }); $li.appendTo( $queue ); } // 负责view的销毁 function removeFile( file ) { var $li = $('#'+file.id); delete percentages[ file.id ]; updateTotalProgress(); $li.off().find('.file-panel').off().end().remove(); } function updateTotalProgress() { var loaded = 0, total = 0, spans = $progress.children(), percent; $.each( percentages, function( k, v ) { total += v[ 0 ]; loaded += v[ 0 ] * v[ 1 ]; } ); percent = total ? loaded / total : 0; spans.eq( 0 ).text( Math.round( percent * 100 ) + '%' ); spans.eq( 1 ).css( 'width', Math.round( percent * 100 ) + '%' ); updateStatus(); } function updateStatus() { var text = '', stats; if ( state === 'ready' ) { text = '选中' + fileCount + '张图片,共' + WebUploader.formatSize( fileSize ) + '。'; } else if ( state === 'confirm' ) { stats = uploader.getStats(); if ( stats.uploadFailNum ) { text = '已成功上传' + stats.successNum+ '张照片至XX相册,'+ stats.uploadFailNum + '张照片上传失败,<a class="retry" href="#">重新上传</a>失败图片或<a class="ignore" href="#">忽略</a>' } } else { stats = uploader.getStats(); text = '共' + fileCount + '张(' + WebUploader.formatSize( fileSize ) + '),已上传' + stats.successNum + '张'; if ( stats.uploadFailNum ) { text += ',失败' + stats.uploadFailNum + '张'; } } $info.html( text ); } function setState( val ) { var file, stats; if ( val === state ) { return; } $upload.removeClass( 'state-' + state ); $upload.addClass( 'state-' + val ); state = val; switch ( state ) { case 'pedding': $placeHolder.removeClass( 'element-invisible' ); $queue.hide(); $statusBar.addClass( 'element-invisible' ); uploader.refresh(); break; case 'ready': $placeHolder.addClass( 'element-invisible' ); $( '#filePicker2' ).removeClass( 'element-invisible'); $queue.show(); $statusBar.removeClass('element-invisible'); uploader.refresh(); break; case 'uploading': $( '#filePicker2' ).addClass( 'element-invisible' ); $progress.show(); $upload.text( '暂停上传' ); break; case 'paused': $progress.show(); $upload.text( '继续上传' ); break; case 'confirm': $progress.hide(); $( '#filePicker2' ).removeClass( 'element-invisible' ); $upload.text( '开始上传' ); stats = uploader.getStats(); if ( stats.successNum && !stats.uploadFailNum ) { setState( 'finish' ); return; } break; case 'finish': stats = uploader.getStats(); if ( stats.successNum ) { alert( '上传成功' ); } else { // 没有成功的图片,重设 state = 'done'; location.reload(); } break; } updateStatus(); } uploader.onUploadProgress = function( file, percentage ) { var $li = $('#'+file.id), $percent = $li.find('.progress span'); $percent.css( 'width', percentage * 100 + '%' ); percentages[ file.id ][ 1 ] = percentage; updateTotalProgress(); }; uploader.onFileQueued = function( file ) { fileCount++; fileSize += file.size; if ( fileCount === 1 ) { $placeHolder.addClass( 'element-invisible' ); $statusBar.show(); } addFile( file ); setState( 'ready' ); updateTotalProgress(); }; uploader.onFileDequeued = function( file ) { fileCount--; fileSize -= file.size; if ( !fileCount ) { setState( 'pedding' ); } removeFile( file ); updateTotalProgress(); }; uploader.on( 'all', function( type ) { var stats; switch( type ) { case 'uploadFinished': setState( 'confirm' ); break; case 'startUpload': setState( 'uploading' ); break; case 'stopUpload': setState( 'paused' ); break; } }); uploader.onError = function( code ) { alert( 'Eroor: ' + code ); }; $upload.on('click', function() { if ( $(this).hasClass( 'disabled' ) ) { return false; } if ( state === 'ready' ) { uploader.upload(); } else if ( state === 'paused' ) { uploader.upload(); } else if ( state === 'uploading' ) { uploader.stop(); } }); $info.on( 'click', '.retry', function() { uploader.retry(); } ); $info.on( 'click', '.ignore', function() { alert( 'todo' ); } ); $upload.addClass( 'state-' + state ); updateTotalProgress(); }); })( jQuery ); ``` ashx文件 ``` <%@ WebHandler Language="C#" Class="Handler" %> using System; using System.Web; using System.IO; using System.Text; public class Handler : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //指定字符集 context.Response.ContentEncoding = System.Text.Encoding.UTF8; if (context.Request["REQUEST_METHOD"] == "OPTIONS") { context.Response.End(); } SaveFile(); } /// <summary> /// 文件保存操作 /// </summary> /// <param name="basePath"></param> private void SaveFile(string basePath = "~/Upload/Images/") { var name = string.Empty; basePath = (basePath.IndexOf("~") > -1) ? System.Web.HttpContext.Current.Server.MapPath(basePath) : basePath; // basePath = FileHelper.GetUploadPath(); HttpFileCollection files = System.Web.HttpContext.Current.Request.Files; //如果目录不存在,则创建目录 if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } var suffix = files[0].ContentType.Split('/'); //获取文件格式 var _suffix = suffix[1].Equals("jpeg", StringComparison.CurrentCultureIgnoreCase) ? ".jpg" : suffix[1]; var _temp = System.Web.HttpContext.Current.Request["name"]; //如果不修改文件名,则创建随机文件名 //if (!string.IsNullOrEmpty(_temp)) //{ // name = _temp; //} //else //{ Random rand = new Random(24 * (int)DateTime.Now.Ticks); name = rand.Next() + "." + _suffix; //} //文件保存 var full = basePath + name; files[0].SaveAs(full); var _result = "{\"jsonrpc\" : \"2.0\", \"result\" : null, \"Imgurl\" : \"" + name + "\"}"; System.Web.HttpContext.Current.Response.Write(_result); } public bool IsReusable { get { return false; } } } ```

ASP.NET POST页面传值时无法访问

我在写用户注册的时候一个页面显示Form表单,输入数据,另一个页面用于接受数据传值。 但是在POST页面提交时,处理页面显示拒绝访问,不知道怎么回事,求解. 注册代码 ``` <form id="FormRegister" runat="server" method="post" action="registerConfirm.aspx"> <ul class="information"> <li class="mdl-textfield mdl-js-textfield"> <input class="mdl-textfield__input" type="text" id="user" name="user"/> <label class="mdl-textfield__label" for="user">请输入您用户名</label> </li> <li class="mdl-textfield mdl-js-textfield"> <input class="mdl-textfield__input" type="password" id="password" name="password" pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$"/> <label class="mdl-textfield__label" for="password">设置您的密码</label> <span class="mdl-textfield__error">密码范围6-20位,必须包含大小写字母及数字</span> <div class="tips"> <span id="password-tips" class="icon material-icons black-1">help</span> <div class="mdl-tooltip" for="password-tips">密码范围6-20位,<br>必须包含大小写字母及数字</div> </div> </li> <button type="submit" class="information-button mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-color--blue mdl-color-text--white"> 确定 </button> <button type="reset" class="information-button mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"> 重置 </button> </ul> </form> ``` 处理代码 if (Request.Form["user"]!=null&&Request.Form["password"]!=null){ Response.Write("有传值"); }else{ Response.Write("没有传值"); } POST传值时,其中这个IIS就直接停止工作了!不知道这是什么原因? 跳转注册时直接这样显示 ![图片说明](https://img-ask.csdn.net/upload/201708/03/1501741377_356094.jpg)

Datatable-bootstrap仅适用于第一页。

<div class="post-text" itemprop="text"> <p>I'm new to datatable-bootstrap. I have edit button and delete button, when i press edit button, it works fine on first page only.From 2nd page it doesn't work. How to refresh the datatable (only table) after deleting? </p> <p><strong>For refreshing table(after DELETING)</strong></p> <p>This code is working only one time, if i click again on another button, it doesn't work</p> <pre><code>$('table').load(location.href + " table"); </code></pre> <p><strong>php file for datatable</strong></p> <pre><code>&lt;script&gt; $(document).ready(function() { $('#vehicle-list').dataTable(); } ); &lt;/script&gt; &lt;table class="table table-hover myTable" id="vehicle-list"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;No&lt;/th&gt; &lt;th&gt;No plate&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;A/C&lt;/th&gt; &lt;th&gt;Fuel&lt;/th&gt; &lt;th&gt;Action&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php include 'inc/connection.php'; $que="SELECT * FROM vehicle_register"; $query_run=mysqli_query($con,$que); $no=1; while($row=mysqli_fetch_array($query_run)) { ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $no++; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row['no_plate']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row['vehicle_type']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row['ac_type']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row['fuel_type']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;div class="btn-group"&gt;&lt;a class='Edit btn btn-primary' data-toggle="modal" href="#form_modal" data-target="#myModal" data-Id="&lt;?php echo $row['no_plate'];?&gt;"&gt;Edit&lt;/a&gt;&lt;a class='Delete btn btn-danger' data-toggle="modal" href="#form_modal" data-target="#myModal" data-Id="&lt;?php echo $row['no_plate'];?&gt;"&gt;Delete&lt;/a&gt;&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php } mysqli_close($con); ?&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> </div>

使用C#.NET进行Web开发的好处[关闭]

<div class="post-text" itemprop="text"> <p>my question might sound stupid to some of you, but I need some good answers here. I have experience working with PHP and Ruby on Rails. I know what are the benefits in using both technologies, (MVC, performance and etc). Now I am working on a project written in C#. Based on what I have seen so far, the browser code is a mixture of HTML, inline and external CSS, and I some C# methods to generate HTML content. Everything is so messy, I have been working on it for 3days and I am still confused.From that C# implementation, there is not well structured MVC. My impression is that C# does not seem like a good choice when it comes to web app (for me). Maybe the code I am working with is written in a wrong way. My question is, is the messy HTML/CSS and the lack of MVC implementation something common when it comes to C# ? What are the benefits of C# over PHP, Java and ROR for developing small and big web applications.</p> <p>Exaple from the code I work with:</p> <pre><code>&lt;/td&gt; &lt;td align="left"&gt; &lt;asp:TextBox ID="txt_to" runat="server" Enabled="true" TextAlignment="Center" MaxLength="7000" AcceptsReturn="True" ToolTip="Add ; after a recepient to add another recepient" CssClass="txt_Message1" TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt; &lt;asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txt_to" MinimumPrefixLength="2" CompletionInterval="10" CompletionSetCount="3" EnableCaching="true" FirstRowSelected="true" UseContextKey="True" ServiceMethod="GetCompletionList" DelimiterCharacters=";, :" howOnlyCurrentWordInCompletionListItem="true" /&gt; &lt;asp:Label ID="lbl_ToError" runat="server" CssClass="Error"&gt;&lt;/asp:Label&gt; &lt;/td&gt; </code></pre> <p>This look too much complicated for me, at the end of the day it is just a text field :) And another thing, most of my global Css gets overloaded by the inline values ( I believe they are generated using some sort of a generator or VS tool).</p> <p>Please, dont get offended, I have no experience with C# .NET this is my first contact and my impression is "Never ever". I hope it is the code I am working with, not the C#. Give me explanation why I should use C#? So far it has been a pain for me :)</p> </div>

c#+jquery+ajax实现注册登录功能

数据库是sql server 客户端和服务器端怎么交换数据 页面代码如下 ``` <nav class="main_nav"> <ul> <li ><a class="cd-signin" href="#0">登录</a></li> <li ><a class="cd-signup" href="#0">注册</a></li> </ul> </nav> <div class="cd-user-modal"> <div class="cd-user-modal-container"> <ul class="cd-switcher"> <li ><a href="#0">用户登录</a></li> <li ><a href="#0">注册新用户</a></li> </ul> <div id="cd-login"><!-- 登录表单 --> <form class="cd-form" method="post"> <p class="fieldset"> <label class="image-replace cd-username" for="signin-username-email">姓名或邮箱</label> <input class="full-width has-padding has-border" id="signin-username" type="text" placeholder="输入姓名或邮箱" > </p> <p class="fieldset"> <label class="image-replace cd-password" for="signin-password">密码</label> <input class="full-width has-padding has-border" id="signin-password" type="text" placeholder="输入密码"> </p> <p class="fieldset"> <input type="checkbox" id="remember-me" checked> <label for="remember-me">记住登录状态</label> </p> <p class="fieldset"> <input class="full-width2" id="login" type="submit" value="登 录"> </p> </form> </div> <div id="cd-signup"> <!-- 注册表单 --> <form class="cd-form" method="post"> <p class="fieldset"> <label class="image-replace cd-username" for="signup-username">姓名</label> <input class="full-width has-padding has-border" id="signup-username" type="text" placeholder="输入姓名"> </p> <p class="fieldset"> <label class="image-replace cd-email" for="signup-email">邮箱</label> <input class="full-width has-padding has-border" id="signup-email" type="email" placeholder="输入mail"> </p> <p class="fieldset"> <label class="image-replace cd-password" for="signup-password">密码</label> <input class="full-width has-padding has-border" id="signup-password" type="text" placeholder="输入密码"> </p> <p class="fieldset"> <input type="checkbox" id="accept-terms"> <label for="accept-terms">我已阅读并同意 <a href="#0">用户协议</a></label> </p> <p class="fieldset"> <input class="full-width2" id="register" type="submit" value="注册新用户"> </p> </form> </div> <a href="#0" class="cd-close-form">关闭</a> </div> </div> ``` js代码如下: ``` jQuery(document).ready(function ($) { var $form_modal = $('.cd-user-modal'), $form_login = $form_modal.find('#cd-login'), $form_signup = $form_modal.find('#cd-signup'), $form_modal_tab = $('.cd-switcher'), $tab_login = $form_modal_tab.children('li').eq(0).children('a'), $tab_signup = $form_modal_tab.children('li').eq(1).children('a'), $main_nav = $('.main_nav'); //弹出窗口 $main_nav.on('click', function (event) { if ($(event.target).is($main_nav)) { // on mobile open the submenu $(this).children('ul').toggleClass('is-visible'); } else { // on mobile close submenu $main_nav.children('ul').removeClass('is-visible'); //show modal layer $form_modal.addClass('is-visible'); //show the selected form ($(event.target).is('.cd-signup')) ? signup_selected() : login_selected(); } }); //关闭弹出窗口 $('.cd-user-modal').on('click', function (event) { if ($(event.target).is($form_modal) || $(event.target).is('.cd-close-form')) { $form_modal.removeClass('is-visible'); } }); //使用Esc关闭弹出窗口 $(document).keyup(function (event) { if (event.which == '27') { $form_modal.removeClass('is-visible'); } }); //切换表单 $form_modal_tab.on('click', function (event) { event.preventDefault(); ($(event.target).is($tab_login)) ? login_selected() : signup_selected(); }); function login_selected() { $form_login.addClass('is-selected'); $form_signup.removeClass('is-selected'); $form_forgot_password.removeClass('is-selected'); $tab_login.addClass('selected'); $tab_signup.removeClass('selected'); } function signup_selected() { $form_login.removeClass('is-selected'); $form_signup.addClass('is-selected'); $form_forgot_password.removeClass('is-selected'); $tab_login.removeClass('selected'); $tab_signup.addClass('selected'); } }); //credits http://css-tricks.com/snippets/jquery/move-cursor-to-end-of-textarea-or-input/ jQuery.fn.putCursorAtEnd = function () { return this.each(function () { // If this function exists... if (this.setSelectionRange) { // ... then use it (Doesn't work in IE) // Double the length because Opera is inconsistent about whether a carriage return is one character or two. Sigh. var len = $(this).val().length * 2; this.setSelectionRange(len, len); } else { // ... otherwise replace the contents with itself // (Doesn't work in Google Chrome) $(this).val($(this).val()); } }); }; ``` 接下来该怎么写功能 与数据库交换数据 最好有详细代码 谢谢了!

MVC 4 Ajax DropDownList

<div class="post-text" itemprop="text"> <p>There are two DropDownLists on a form. </p> <p>If the user chooses a Region in the first DropDownList, there should be only cities related to this region in the second DropDownList. </p> <p>I already tried solutions that I found on StackOverflow, but because of my beginner knowledge of jQuery and MVC, I failed. Maybe there is a difference between my model/controller and others, that these DropDownLists are already on form and they should be dynamically changed using ajax.</p> <h2>Html</h2> <pre><code>&lt;div class="form-group col-sm-4"&gt; @Html.LabelFor(m =&gt; m.Company.Region.Name) @Html.DropDownList("region", Model.Regions, new { @class = "form-control" ,@id = "Region_drop" }) &lt;/div&gt; &lt;div class="form-group col-sm-4"&gt; @Html.LabelFor(m =&gt; m.Company.City.Name) @Html.DropDownList("city", Model.Cities, new { @class = "form-control" ,@id = "City_drop" }) &lt;/div&gt; </code></pre> <h2>Controller</h2> <pre><code>[Authorize] public ActionResult AddCompany() { CompanyModel company = new CompanyModel(); SelectList regions = new SelectList(db.Regions, "Id", "Name"); SelectList cities = new SelectList(db.Cities, "Id", "Name"); AddCompanyViewModel acvm = new AddCompanyViewModel { Regions = regions, Cities = cities, }; return View(acvm); } </code></pre> <hr> <h2>Model</h2> <pre><code>public class RegionModel { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [Display(Name = "Регион")] [Required] public string Name { get; set; } public IEnumerable&lt;CompanyModel&gt; Companies { get; set; } public IEnumerable&lt;CityModel&gt; Cities { get; set; } } public class CityModel { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [Display(Name = "Город")] [Required] public string Name { get; set; } public int RegionId { get; set; } public RegionModel Region { get; set; } public IEnumerable&lt;CompanyModel&gt; Companies { get; set; } } </code></pre> <p>Updated: I tried to write a secondary ActionResult for getting data from DB</p> <pre><code>[HttpPost] public ActionResult getCitiesAction(int provinceId) { var cities = db.Cities.Where(a =&gt; a.RegionId == provinceId).Select(a =&gt; "&lt;option value='" + a.Id + "'&gt;" + a.Name + "'&lt;/option&gt;'"); return Content(String.Join("", cities)); } </code></pre> <p>And then added some JS, as recommended in one of the other solutions:</p> <pre><code>$("#Region_drop").change(function () { $.ajax({ url: "getCitiesAction", type: "post", data: { provinceId: $("#Region_drop").val() } }).done(function (response) { $("#City_drop").html(response); }); }); </code></pre> <p>After running this in the browser, and making some break points, it shows the region ID, but after calling ajax the function dies.</p> </div>

【MVC5】datetime2数据在修改保存时变为默认值“0001-01-01 00:00 ”,如何解决?

如题。添加视图里添加这行时数据时显示当前时间,精确到分,很正常。但每次保存时都会变为那个默认值,这个值是不需要修改的我也没有修改过。很多方法都试过了,请问大神这个问题如何解决? 实体类日期字段: ``` [Required] [ReadOnly(true)] [DisplayName("上传时间")] [Column(TypeName ="DateTime2")] [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm}", ApplyFormatInEditMode = false)] public DateTime UploadDate { get; set; } ``` 控制器的保存方法: ``` [HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "ID,MovieTitle,ClassNumber,Classify,UploadDate,VideoPath,Synopsis")] Movie movies, HttpPostedFileBase file) { if (ModelState.IsValid) { db.Entry(movies).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(movies); } ``` 视图中的方法: ``` @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.ID) @Html.HiddenFor(model=>model.UploadDate) <div class="form-group"> @Html.LabelFor(model => model.UploadDate, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10" style="margin-top:6px;"> @Html.DisplayFor(model => model.UploadDate, new { htmlAttributes = new { @class = "form-control"} }) @Html.ValidationMessageFor(model => model.UploadDate, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="保存" class="btn btn-default" /> </div> </div> </div> ```

使用MvcPager的时候,点击查询会使js失效

初学mvc,在使用mvcpager分页的时候遇到一个棘手的问题,请教各位大神 一个后台管理页面view,左边是导航相关,右边设置有一个iframe用于显示不同导航链接 对应的view 1.主页面index ``` <div class="container-fluid"> <div class="row"> <!--RIP左侧固定导航栏--> <div class="col-md-2"> <!--管理列表(使用Prodect页布局)--> <div class="list-group RIP-Leftnav" id="RIP-LEFTNAV"> <a href="#" class="list-group-item active" id="/RIPManage/RIPDynamic"> <h4 class="list-group-item-heading">首页</h4> <p class="list-group-item-text">提供动态信息维护</p> </a> <a href="#" class="list-group-item" id="/RIPManage/RIPProduct"> <h4 class="list-group-item-heading">产品与服务</h4> <p class="list-group-item-text">静态信息维护请联系开发人员</p> </a> <a href="#" class="list-group-item" id="/RIPManage/RIPApplication"> <h4 class="list-group-item-heading">应用案例</h4> <p class="list-group-item-text">提供动态信息维护</p> </a> <a href="#" class="list-group-item " id="/RIPManage/RIPQuality"> <h4 class="list-group-item-heading">质量保证体系</h4> <p class="list-group-item-text">静态信息维护请联系开发人员</p> </a> <a href="#" class="list-group-item " id="/RIPManage/RIPResult"> <h4 class="list-group-item-heading">研发能力</h4> <p class="list-group-item-text">提供动态信息维护</p> </a> <a href="#" class="list-group-item " id="/RIPManage/RIPEnterprise"> <h4 class="list-group-item-heading">企业信息</h4> <p class="list-group-item-text">静态信息维护请联系开发人员</p> </a> </div> </div> <!--RIP右侧自动管理页--> <div class="col-md-10"> <!--信息管理--> <section> <div class="embed-responsive embed-responsive-4by3"> <iframe class="embed-responsive-item" id="RIP-iframe" scrolling="no" name="RIP-iframe" onload="this.height = RIP-iframe.document.body.scrollHeight" width="100%" frameborder="0"></iframe> </div> </section> </div> </div> </div> ``` 2.嵌入的子页面 ``` <div class="RIP-inside"> <div class="container"> <div class="page-header"> <h1>首页管理</h1> <p>提供对企业动态信息的维护管理,包括基本的文字、图片和附件管理</p> </div> <div class="RIP-Item-padding"> @*<input class="form-control input-sm" type="text" placeholder="查询内容">*@ <fieldset> <legend>查询</legend> <div class="RIP-CUDpadding"> <!-- Provides extra visual weight and identifies the primary action in a set of buttons --> @Html.ActionLink("新增", "RIPDynamicInsert", new { }, new { @class = "btn btn-primary" }) <!-- Indicates a successful or positive action --> <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#myModal" data-tempdata="" id="RIP-Delete"> 删除 </button> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel">删除确认</h4> </div> <div class="modal-body" id="Modal-DeleteContent"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> @*<button type="button" class="btn btn-primary" id="RIP-Delete-confirm">确认删除</button>*@ <a href="javascript:void(0)" id="RIP-Delete-confirm" class="btn btn-primary">确认删除</a> </div> </div> </div> </div> <!-- Contextual button for informational alert messages --> <button type="button" class="btn btn-info">修改</button> <p>@TempData["Condition"]</p> </div> @using (Ajax.BeginForm("RIPDynamic", new RouteValueDictionary { { "id", "" } }, new AjaxOptions { UpdateTargetId = "articles", InsertionMode = InsertionMode.Replace }, new RouteValueDictionary { { "id", "searchForm" } })) { <div class="row"> <div class="col-md-4"><span>文章标题:</span><input type="text" name="title" id="title" class="form-control" /></div> <div class="col-md-4"><span>上传人员:</span><input type="text" name="author" id="author" class="form-control" /></div> <div class="col-md-4"><span>附件名称:</span><input type="text" name="source" id="source" class="form-control" /></div> </div> <div class="RIP-CUDpadding"><button type="submit" class="btn btn-success">查询</button></div> } </fieldset> </div> <div id="articles"> @Html.Partial("_AjaxSearchPost", Model) </div> @section Scripts { @{Html.RegisterMvcPagerScriptResource();} } <script> $(function () { //1.Table点击效果,可以多选,第二次点击取消效果 $('#RIP-Table tr').click(function () { var id = $(this).attr('id'); var value = $('#box-' + id + '').prop('checked'); if (value === true) { $('#box-' + id + '').prop('checked', false); $(this).removeClass('RIP-Click'); } else { $('#box-' + id + '').prop('checked', true); $(this).addClass('RIP-Click'); } }); //2.获取1中选择好的记录关键信息 $('#RIP-Delete').click(function () { var idlist = ''; $('#RIP-Delete').removeData('data-tempdata'); $('#RIP-Table input').each(function () { if ($(this).prop('checked') === true) { var value = $(this).attr('id'); if (value != 'undefine') idlist += value; } }); //根据所选内容是否为空初始化模态框对应内容 if (idlist == '') { $('#Modal-DeleteContent').text('需要选择数据'); $('#RIP-Delete-confirm').attr('disabled', 'true'); } else { $('#RIP-Delete').data('data-tempdata', idlist); var content = $('#RIP-Delete').data('data-tempdata'); $('#Modal-DeleteContent').text(content); $('#RIP-Delete-confirm').removeAttr('disabled'); $('#RIP-Delete-confirm').attr('href', '/RIPManage/RIPDynamicDelete/did=' + content + ''); } }); //3.ajax触发删除 }); </script> </div> </div> </body> ``` 对应的分部页 ``` @using Webdiyer.WebControls.Mvc; @model PagedList<Model.ViewModels.RIPDefaultViewModel> <div style="float:left;width:50%;vertical-align:middle; padding-bottom:10px"><h4>当前页: @Model.CurrentPageIndex / @Model.TotalPageCount 页, 总共:@Model.TotalItemCount 条记录</h4></div> <div>@Html.Partial("_DefaultTable", Model)</div> <div class="text-center">@Html.Pager(Model, new PagerOptions { PageIndexParameterName = "id", ContainerTagName = "ul", CssClass = "pagination", CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>", DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>", PagerItemTemplate = "<li>{0}</li>", Id = "bootstrappager" })</div> ``` 对应的table页 ``` @model Webdiyer.WebControls.Mvc.PagedList<Model.ViewModels.RIPDefaultViewModel> <table class="table table-bordered table-hover table-striped table-responsive" id="RIP-Table"> <tr> <th> <input role="checkbox" type="checkbox" id="checkbox-fullselect" /> </th> <th class="nowrap"> <p> @Html.DisplayNameFor(model => model.SingleOrDefault().AutoID)</p> </th> <th class="nowrap"> <p> @Html.DisplayNameFor(model => model.SingleOrDefault().Title)</p> </th> <th class="nowrap"> <p> @Html.DisplayNameFor(model => model.SingleOrDefault().Content)</p> </th> <th class="nowrap"> <p> @Html.DisplayNameFor(model => model.SingleOrDefault().UploadPerson)</p> </th> <th class="nowrap"> <p> @Html.DisplayNameFor(model => model.SingleOrDefault().UploadTime)</p> </th> <th class="nowrap"> <p> @Html.DisplayNameFor(model => model.SingleOrDefault().FileName)</p> </th> <th class="nowrap"> <p> @Html.DisplayNameFor(model => model.SingleOrDefault().FileSize)</p> </th> </tr> @foreach (var item in Model) { <tr id="@Html.DisplayFor(modelitem=>item.AutoID)"> <td> <input role="checkbox" type="checkbox" id="box-@Html.DisplayFor(modelitem=>item.AutoID)" /> </td> <td class="nowrap"> <p> @Html.DisplayFor(modelitem => item.AutoID)</p> </td> <td class="nowrap"> <p> @Html.DisplayFor(modelitem => item.Title)</p> </td> <td class="nowrap"> <p> @Html.DisplayFor(modelitem => item.Content)</p> </td> <td class="nowrap"> <p> @Html.DisplayFor(modelitem => item.UploadPerson)</p> </td> <td class="nowrap"> <p> @Html.DisplayFor(modelitem => item.UploadTime)</p> </td> <td class="nowrap"> <p> @Html.DisplayFor(modelitem => item.FileName)</p> </td> <td class="nowrap"> <p> @Html.DisplayFor(modelitem => item.FileSize)</p> </td> </tr> } </table> ``` 后台 ``` public ActionResult Index(int id=1) { return View(); } //1.动态页管理 public ActionResult RIPDynamic(int id=1) { List<Model.UDynamic> dylist = BLL.LUDynamic.GetRecordList(); List<Model.UDynamicFile> dyfilelist = BLL.LUDynamicFile.GetRecordList(); //linq方法 var listmodel = (from dy in dylist join dyf in dyfilelist on dy.DynamicFileID equals dyf.AutoID into result from item in result.DefaultIfEmpty() select new RIPDefaultViewModel { AutoID = dy.AutoID, Title = dy.Title, Content = dy.Content, UploadPerson = dy.UploadPersonName, UploadTime = dy.UploadTime, FileName = item.FilesName, FileSize = item.FilesSize }).OrderByDescending(s=>s.AutoID).ToPagedList(id,5); if (Request.IsAjaxRequest()) return PartialView("_AjaxSearchPost", listmodel); return View(listmodel); } [HttpPost] public ActionResult RIPDynamic(string title,string author,string source,int id=1) { return RIPDynamicResult(title,author,source,id); } private ActionResult RIPDynamicResult(string title, string author, string source, int id = 1) { List<Model.UDynamic> dylist = BLL.LUDynamic.GetRecordList(); List<Model.UDynamicFile> dyfilelist = BLL.LUDynamicFile.GetRecordList(); //linq方法 var listmodel = (from dy in dylist join dyf in dyfilelist on dy.DynamicFileID equals dyf.AutoID into result from item in result.DefaultIfEmpty() select new RIPDefaultViewModel { AutoID = dy.AutoID, Title = dy.Title, Content = dy.Content, UploadPerson = dy.UploadPersonName, UploadTime = dy.UploadTime, FileName = item.FilesName, FileSize = item.FilesSize }).AsQueryable(); if (!string.IsNullOrWhiteSpace(title)) listmodel = listmodel.Where(s => s.Title.Contains(title)); if (!string.IsNullOrWhiteSpace(author)) listmodel = listmodel.Where(s => s.UploadPerson.Contains(author)); if (!string.IsNullOrWhiteSpace(source)) listmodel = listmodel.Where(s => s.FileName.Contains(source)); var querymodel = listmodel.OrderByDescending(s => s.AutoID).ToPagedList(id, 5); if(Request.IsAjaxRequest()) return PartialView("_AjaxSearchPost", querymodel); return View(querymodel); } ``` 因为初学,有很多写的不对的地方,但为什么点击查询后,iframe嵌套的页面的自己写的js都失效了呢 因为暂时没有c币了,还请见谅,能有效解决的话会补回来

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Intellij IDEA 实用插件安利

1. 前言从2020 年 JVM 生态报告解读 可以看出Intellij IDEA 目前已经稳坐 Java IDE 头把交椅。而且统计得出付费用户已经超过了八成(国外统计)。IDEA 的...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

魂迁光刻,梦绕芯片,中芯国际终获ASML大型光刻机

据羊城晚报报道,近日中芯国际从荷兰进口的一台大型光刻机,顺利通过深圳出口加工区场站两道闸口进入厂区,中芯国际发表公告称该光刻机并非此前盛传的EUV光刻机,主要用于企业复工复产后的生产线扩容。 我们知道EUV主要用于7nm及以下制程的芯片制造,光刻机作为集成电路制造中最关键的设备,对芯片制作工艺有着决定性的影响,被誉为“超精密制造技术皇冠上的明珠”,根据之前中芯国际的公报,目...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

百度工程师,获利10万,判刑3年!

所有一夜暴富的方法都写在刑法中,但总有人心存侥幸。这些年互联网犯罪高发,一些工程师高技术犯罪更是引发关注。这两天,一个百度运维工程师的案例传遍朋友圈。1...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

实时更新:计算机编程语言排行榜—TIOBE世界编程语言排行榜(2020年6月份最新版)

内容导航: 1、TIOBE排行榜 2、总榜(2020年6月份) 3、本月前三名 3.1、C 3.2、Java 3.3、Python 4、学习路线图 5、参考地址 1、TIOBE排行榜 TIOBE排行榜是根据全世界互联网上有经验的程序员、课程和第三方厂商的数量,并使用搜索引擎(如Google、Bing、Yahoo!)以及Wikipedia、Amazon、YouTube统计出排名数据。

阿里面试官让我用Zk(Zookeeper)实现分布式锁

他可能没想到,我当场手写出来了

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

​能让德国人放弃现金支付​,也没谁了

在新冠疫情中,德国人越来越多地选择在超市,加油站或其他商店付款时使用非接触式付款方式。德国信贷协会Deutschen Kreditwirtschaft (DK) 的一位发言人告诉德国新...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

2020春招面试了10多家大厂,我把问烂了的数据库事务知识点总结了一下

2020年截止目前,我面试了阿里巴巴、腾讯、美团、拼多多、京东、快手等互联网大厂。我发现数据库事务在面试中出现的次数非常多。

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

立即提问
相关内容推荐