0项目
在我看来,我有一个隐藏的文件,有一个UserID
.该用户ID是在动作时生成的(因此事先不知道)
一旦这个隐藏字段有一个值,我想将该值用作actionlink routevalue.我可以使用jquery选择器来完成它.
我隐藏的领域是
<input id="NewUserID" type="hidden" value="80">
Run Code Online (Sandbox Code Playgroud)
我的ajax.ActionLink是
@Ajax.ActionLink("Edit", "EditUser", "User", new { UserID = "$('#GetNewPatientID').val()" },
new AjaxOptions
{
OnSuccess = "ShowEditUserForm",
UpdateTargetId = "EditUserDetails",
InsertionMode = InsertionMode.Replace,
HttpMethod = "Get"
}, new { @class = "button", id = "EditUserButton" })
Run Code Online (Sandbox Code Playgroud)
知道这是否可行?
在ASP.Net MVC 3.0中,我使用的是Ajax.Beginform
并且在我调用jQuery函数的表单成功时命中JsonResult.但由于某种原因,我的表单重定向到JsonAction
我的看法
@using (Ajax.BeginForm("ActionName", "Controller", null, new AjaxOptions
{
HttpMethod = "POST",
OnSuccess = "ShowResult"
}, new { id = "myform" }))
{
// All form Fields
<input type="submit" value="Continue" class="button standard" />
}
Run Code Online (Sandbox Code Playgroud)
我的控制器
public JsonResult ActionName(FormCollection collection)
{
return Json(new { _status },JsonRequestBehavior.AllowGet);
}
Run Code Online (Sandbox Code Playgroud)
jQuery的
<script type="text/javascript">
function ShowResult(data) {
// alert("I am at ShowResult");
if (data.isRedirect) {
window.location.href = json.redirectUrl;
}
}
Run Code Online (Sandbox Code Playgroud)
出于某种原因,当我点击提交.它运行JSonResult并将页面重定向到我已包含的主机/控制器/动作名称
<script src="@Url.Content("jquery.unobtrusive-ajax.min.js")"></script>
Run Code Online (Sandbox Code Playgroud)
在我的layout.cshtml中
任何人都可以告诉我什么可能是错的?
我发现了这个问题.现在我必须找到提交的解决方案我正在验证我的表格
$("#myform").validate({
submitHandler: function (form) {
// …
Run Code Online (Sandbox Code Playgroud) 我有一个分层的类别文档,如父母 - 儿童 - 儿童等......
{
id: 1,
value: {
}Children: [{
id: 2,
value: {
}Children: [{
id: 3,
value: {
}Children: [{
id: 4,
value: {
}Children: [{
id: 5,
value: {
}Children: [{
id: 6,
value: {
}Children: [{
id: 7,
value: {
}Children: []
}]
}]
}]
}]
}]
}]
}
Run Code Online (Sandbox Code Playgroud)
在这样的文档中,使用MongoDB C#驱动程序,我该如何找到一个节点 Id = x
我试过这样的事
var filter = Builders<Type>.Filter.Eq(x => x.Id, 3);
var node = mongoDbRepository.GetOne(filter) ??
mongoDbRepository.GetOne(Builders<Type>.Filter.Where(x => x.Children.Any(c=>c.Id == 3)));
Run Code Online (Sandbox Code Playgroud)
但这仅涵盖两个层面.在我的例子中,我有7个级别,我没有对级别深度的限制
一旦我找到该节点,我需要 …
我需要使用MongoDB C#驱动程序构造以下查询
db.Notes.find({ "Group._id" : 74, "CustomFields" : { "$elemMatch" : { "Value" : /batch/i } }, "IsDeleted" : false }).sort({ "CreatedDateTimeUtc" : -1 })
Run Code Online (Sandbox Code Playgroud)
我使用了这样的查询
builder.ElemMatch(x => x.CustomFields, x => x.Value.Contains(filterValue))
Run Code Online (Sandbox Code Playgroud)
它生成mongo查询为
db.Notes.find({ "Group._id" : 74, "CustomFields" : { "$elemMatch" : { "Value" : /batch/s } }, "IsDeleted" : false }).sort({ "CreatedDateTimeUtc" : -1 })
Run Code Online (Sandbox Code Playgroud)
如果你注意到它是附加s /batch/s
而不是i/batch/i
我怎样才能完成这项工作?我需要为像这样的过滤器这样做
我可以做这样的事情,以便我可以将所有正则表达式模式应用于所有上述过滤器.
builder.Regex(x => x.CustomFields[-1].Value, new BsonRegularExpression($"/{filterValue}/i"));
Run Code Online (Sandbox Code Playgroud)
这会将查询转换为如下所示,但不会得到任何结果
db.Notes.find({ "Project._id" : …
Run Code Online (Sandbox Code Playgroud) 创建索引
db.MyCollection.createIndex({'$**': 'text'}, {name: 'FullTextIndex'})
Run Code Online (Sandbox Code Playgroud)
搜索匹配
db.MyCollection.find({$text: {$search: 'myWord'}}).count()
Run Code Online (Sandbox Code Playgroud)
结果为1.对于具有" myWord is here " 值的字段
如果我定期搜索所选字段如下,我得到两条记录,一条记录名称=" myWord就在这里 ",第二条记录中的" myWord "在详细信息中归档为" 这里的东西,myWord就在这里 "
db.getCollection('MyCollection').find({
"$or":[{"Name":/myWord/i}, {"Details":/myWord/i}]
}).sort({"Name": 1})
Run Code Online (Sandbox Code Playgroud)
如何重新创建索引,以便在所有字段中搜索SQL,其中包含%searchText%等字段
最后,我如何在C#Driver中编写此搜索查询
更新:
我进一步调查了它.它找到所有带有前缀和后缀空格的搜索键的结果,但不是单词中字符串的一部分.
示例它返回值为" Hello myWord is here "的记录,但不返回" HellomyWord "
但是根据这个文档,它必须支持通配符搜索.https://docs.mongodb.com/v3.0/reference/operator/query/text/
如何在MVC Telerik Grid Control中完成这项工作
columns.Template(e =>
{
if (e.EndDate>DateTime.Now )
{
@Html.ActionLink("Stop", "StopMedication", "Medication",
new { id = e.PrescriptionID }, new { @class = "standard button" })
}
else {
@Html.ActionLink("Renew", "RenewMedication", "Medication",
new { id = e.PrescriptionID }, new { @class = "standard button" })
}
});
Run Code Online (Sandbox Code Playgroud) 我试图在我的ASP.Net MVC 3.0中注册STart up Script
我知道我可以在VB.Net中使用这种语法但不确定我是否可以在MVC中使用它
System.Web.UI.Page.ClientScript.RegisterStartupScript(typeof(Page), "co", "coInit(0, 'R');", true);
Run Code Online (Sandbox Code Playgroud)
Intellisense没有获取Page的属性
这是我的标记
<tr class="t-detail-row">
<td class="t-hierarchy-cell"></td>
<td class="t-detail-cell" colspan="5"></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我想找到带有类t-detail-row的tr并用类t-hierarchy-cell删除子td并用类t-detail-cell更改td的colspan
我试过这样的事
var newcolspan = $(e.row).find('.t-detail-row').children('td.t-detail-cell').attr('colspan');
$(e.row).find('.t-detail-row').children('td.t-hierarchy-cell').remove()
.children('td.t-detail-cell').attr('colspan',newcolspan+1);
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
有关情况的更具体细节
我想要实现的就是.当我们扩展Telerik MVC网格时,我们会在详细行中得到这个标记
<tr class="t-detail-row">
<td class="t-hierarchy-cell"></td>
<td class="t-detail-cell" colspan="5"></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我想消除 <td class="t-hierarchy-cell"></td>
它.
得到标记为
<tr class="t-detail-row">
<td class="t-detail-cell" colspan="Current+1"></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
为此我虽然做了这样的事情
在网格扩展事件,如果我可以调用jquery函数然后因为我不会生成详细行标记,直到我们扩展网格
function onExpandingtheGrid(){
$('tr.t-detail-row').find('td.t-hierarchy-cell').remove();
$('tr.t-detail-row').find('td.t-detail-cell').attr('colspan',newcolspan+1);
}
Run Code Online (Sandbox Code Playgroud)
谢谢
解
.ClientEvents(exp => exp.OnDetailViewExpand("onExpandingtheGrid"))
Run Code Online (Sandbox Code Playgroud)
和你的上面的jquery函数雅虎中提到的休息!
我有一个要求,我正在实施sitecore WFFM来创建一个表单.该页面包含带有Placeholder属性的HTML输入标记.我必须将WFFM SingleLineInput框渲染为具有占位符属性的输入标记.我该怎么办?
我知道这个SingleLineText
类是在Sitecore.Form.Web.UI.Controls
dll中定义的.
我们有多个网络项目(站点),每个项目都有自己的授权逻辑。今天,我的 CIO 要求我实施 oAuth 并使用它来验证所有站点上的用户。
之前我曾在 Google、Facebook、Twitter 和 Microsoft 中使用过 oAuth。我在这里有多个问题
当我拥有来自 Google 或其他网站的用户 oAuth 时,我们的想法是消除用户在我的网站上注册的麻烦,而不是使用他/她在 Google 上拥有的相同凭据。如果我创建自定义 oAuth,这是我能获得的唯一优势吗?
实施 oAuth:
在较高的层面上,我的上述流程是否满足 oAuth 概念?是否有 oAuth 的深入实现细节可供我参考以获得更好的理解?
c# ×4
mongodb ×3
asp.net-mvc ×1
clientscript ×1
conditional ×1
grid ×1
jquery ×1
mongo-shell ×1
oauth ×1
openid ×1
sitecore ×1
sitecore7 ×1
telerik ×1
telerik-mvc ×1