我试图在点击时调用div中的局部视图.我写过:
@Ajax.ActionLink("Second", "Second", new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "partials",
InsertionMode = InsertionMode.Replace
})
<div id="partials">
</div>
<script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/additional-methods.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/mvc/5.2/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
在我的Index.cshtml.控制器中看起来像这样:
public ActionResult Index()
{
return View();
}
public PartialViewResult Second()
{
return PartialView("Second.cshtml");
}
Run Code Online (Sandbox Code Playgroud)
但我的错误说我的部分视图无法找到:
~/Views/switchPartial/Second.cshtml.aspx
~/Views/switchPartial/Second.cshtml.ascx
~/Views/Shared/Second.cshtml.aspx
~/Views/Shared/Second.cshtml.ascx
~/Views/switchPartial/Second.cshtml.cshtml
~/Views/switchPartial/Second.cshtml.vbhtml
~/Views/Shared/Second.cshtml.cshtml
~/Views/Shared/Second.cshtml.vbhtml
Run Code Online (Sandbox Code Playgroud)
但我在switchPartial文件夹中有它.
如果我@Html.Partial("Second")在我的div中写,它会正确呈现我的局部视图.
我做错了什么?
asp.net-mvc partial-views asp.net-mvc-ajax razor asp.net-mvc-4
我正在尝试在工具栏中显示导航抽屉.我认为我已经编写了所需的一切,但工具栏中没有显示任何内容.只有文字动物园.不是显示导航栏的图标
我是android新手,如果我错过了某些东西,我不会感到惊讶.
这是我的MainActivity.java
package com.example.zoo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mActionBarDrawerToggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_Layout);
mActionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_opened, R.string.drawer_closed){
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
if (getSupportActionBar() != null) …Run Code Online (Sandbox Code Playgroud) 我正在学习nodejs的教程.我遇到了一个问题,教程适用于旧版本.
我有那个代码:
var express = require('express'),
stylus = require('stylus'),
logger = require('morgan'),
bodyParser = require('body-parser');
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var app = express();
function compile(str, path){
return stylus(str).set('filename', path);
}
app.set('views', __dirname + '/server/views');
app.set('view engine', 'jade');
app.use(logger);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(stylus.middleware(
{
src: __dirname + '/public',
compile: compile
}
));
app.use(express.static(__dirname + '/public'));
app.get('*', function(req, res) {
res.render('index');
});
var port = 3131;
app.listen(port);
console.log('Listening on port ' + port + '...');
Run Code Online (Sandbox Code Playgroud)
当我试图进入http://localhost:3131/ …
我有那个代码:
var express = require('express'),
stylus = require('stylus'),
logger = require('morgan'),
bodyParser = require('body-parser'),
mongoose = require('mongoose');
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var app = express();
function compile(str, path){
return stylus(str).set('filename', path);
}
app.set('views', __dirname + '/server/views');
app.set('view engine', 'jade');
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(stylus.middleware(
{
src: __dirname + '/public',
compile: compile
}
));
app.use(express.static(__dirname + '/public'));
mongoose.connect('mongodb://localhost/multivision');
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error..'));
db.once('open', function callback(){
console.log('multivision db opened');
});
app.get('/partials/:partialPath', function(req, res){ …Run Code Online (Sandbox Code Playgroud) 我正在使用视图生成 pdfROTATIVA
public ActionResult StandartPDF()
{
var makeCvSession = Session["makeCV"];
var something = new Rotativa.ViewAsPdf("StandartPDF", makeCvSession) { FileName = "cv.pdf" };
return something;
}
Run Code Online (Sandbox Code Playgroud)
使用该代码用户可以下载它。但一开始我想把它放在服务器上。我怎样才能做到这一点?
在layoutcomponent这是父母我有形式.在提交时,我正在从router-outlet搜索组件中重定向子组件.那是我的提交
onSubmit({ value }: {
value: Search
}) {
this.sharedData.searchStr = value.Search;
let urlSegments = this.router.url.split('/');
let lang = urlSegments[1];
let url = lang + '/search';
this.router.navigateByUrl(url);
this.searchval.reset();
}
Run Code Online (Sandbox Code Playgroud)
我有共享服务,这里有建议的界面,它的工作原理.
import { Injectable, Inject } from '@angular/core';
export interface ISharedModel {
searchStr: string;
}
@Injectable()
export class SearchService {
sharedComponent: ISharedModel = {
searchStr: ''
};
constructor() { }
}
Run Code Online (Sandbox Code Playgroud)
在我的儿童组件 ngOnInit
ngOnInit() {
this.sharedData = this.sharedResource.sharedComponent;
this.searchval = new FormGroup({
Search: new FormControl(this.sharedData.searchStr) …Run Code Online (Sandbox Code Playgroud) 我找到了ts-md5包,但在示例中它有一个hashStr方法,但现在却没有.
属性'hashStr'在类型上不存在
Md5.
使用该错误后,我的控制台中会记录该错误.我怎样才能做到这一点?
我尝试在构造函数中注入它
constructor(private _md5: Md5) {}
Run Code Online (Sandbox Code Playgroud)
然后
let a: any = this._md5.hashStr("password");
Run Code Online (Sandbox Code Playgroud) 我有这行代码
<a href="{{banner.url}}"></a>
Run Code Online (Sandbox Code Playgroud)
但有时url为null。如何检查它是否为null,然后将url传递给href?
我已经试过了
<a href="{{banner.url === null ? javascript:void(0) : banner.url}}"></a>
Run Code Online (Sandbox Code Playgroud)
但这会引发错误
zone.js:388 Unhandled Promise rejection: Template parse errors:
Parser Error: Got interpolation ({{}}) where expression was expected at column 0 in [{{banner.url === null ? javascript:void(0) : banner.url}}]
Run Code Online (Sandbox Code Playgroud) 我是棱角分明的新人,如果我的问题有点低,请不要生我的气.
如果用户将通过auth,我有web服务返回sessionId和登录成功消息.例如url是:
这是我的回答:
{"sessionId":"0997cec2a8b34c84ba8419ab1204e6aa","loginSucceeded":true}
Run Code Online (Sandbox Code Playgroud)
这是我的登录控制器:
app.controller('loginCtrl', function($scope, loginService){
$scope.login=function(user){
loginService.login(user);
}
});
Run Code Online (Sandbox Code Playgroud)
这是我的服务:
app.factory('loginService', function($http){
return{
login: function(user){
var $promise=$http.post('http://localhost:8181/login?', user);
$promise.then(function(msg){
if(msg.loginSucceeded=="true")
console.log("opa")
else
console.log("den");
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
我的范围内有user.username和user.password(使用文本框).
如何在url中传递这些参数以及如何解析该响应?
我需要在C#中使用的那种格式
DateTime.Now.ToString("o").样品返回日期DateTime.Now.ToString("o")是
2016-03-10T11:24:59.7862749 + 04:00
然后在sql中插入为
2016-03-10 11:24:59.786
我正在尝试从java插入相同的日期格式.我用它:
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ");
df.setTimeZone(tz);
String nowAsISO = df.format(new Date());
Run Code Online (Sandbox Code Playgroud)
它会返回这个
2016-03-10T07:29 + 0000
由于这种格式,它出错了.如何将格式更改为我想要的格式?