我有一个表列,其中包含诸如abc_1_2_3_4.gif
或zzz_12_3_3_45.gif
等的值.
我想在上面的值中找到每个下划线 _ 的索引.只有四个下划线,但鉴于它们可以在弦中的任何位置,我怎么能实现这一点?
您好,是否可以使用jQuery获取gridview的当前rowindex?
一点背景:
我使用模板字段中的服务器端链接按钮从gridview中删除行,如下所示:
<asp:LinkButton CausesValidation="false" CommandName="Delete" ID="lnkDelete"
OnClientClick="javascript: return(confirm('Delete item?'));" runat="server" Text="Delete" />
Run Code Online (Sandbox Code Playgroud)
提示用户确认或取消删除.如果用户单击"确定",则会在代码隐藏中调用此方法:
protected void GridViewRowDeleting(object sender, GridViewDeleteEventArgs e)
{
this.gridview_uploads.EditIndex = -1;
if (!this.UploadsList.Count.Equals(0))
{
DocumentUpload upload = this.UploadsList[e.RowIndex];
if (upload != null)
{
this.UploadsList.RemoveAt(e.RowIndex);
this.BindInputGridview();
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是javascript确认(删除项目?)看起来有点不对劲.
我更喜欢使用类似JQuery的对话框,但如果我这样做,我不知道如何使用这种方法获取rowindex(我可以弄清楚如何调用服务器代码).
有任何想法吗?
对不起,如果已经有人问过这个问题 - 我做了拖网搜索并搜索了它,但找不到任何有用的东西.
抱歉,如果之前有人问过这个问题,我进行了搜索,但找不到任何内容。
是否可以在nHibernate中执行内联sql?我有这样的东西,我想与 dB 进行比较:
_session.CreateSQLQuery(
@"update things
set defaultThing = 0 where parentId = :parentId AND thingId <> :thingId")
.SetInt32("parentId ", parent.Id)
.SetInt32("thingId", thing.Id)
;
Run Code Online (Sandbox Code Playgroud)
我想我可以循环遍历一堆“东西”并将 defaultThing 设置设置为 false 然后调用_session.Update(thing)
,但如果我可以按照上面概述的方式做到这一点,那就太好了。
在MVC3中,您可以向模型添加验证,以检查属性是否匹配如下:
public string NewPassword { get; set; }
[Compare("NewPassword",
ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
Run Code Online (Sandbox Code Playgroud)
有没有办法检查两个属性是否有所不同,如下面的假设代码?
[CheckPropertiesDiffer("OldPassword",
ErrorMessage = "Old and new passwords cannot be the same")]
public string OldPassword { get; set; }
public string ConfirmPassword { get; set; }
Run Code Online (Sandbox Code Playgroud)