我有带有CommandArgument属性的ImageButton,它具有多个Eval值.当我单击其中一个时,我想将值传递给ImageButton2_Click事件,但它不起作用,因为Command参数为null.
<div class="sag-re-icerik" id="icerik2" runat="server">Lorem ipsum dolor sit amet, consectetur commodo et convallis et, auctor viverra metus. Aenean pharetra, arcu nec viverra mollis, turpis neque feugiat massa, non dapibus neque nunc ac orci. </div>
<div class="oy-verme">
<div class="yildiz"><asp:ImageButton ID="ImageButton4" runat="server" Height="19px" ImageUrl="~/images/yildiz.png" onclick="ImageButton2_Click" Width="20px" style="position: relative; top: 13px; left:6px; float:left; " commandArgument='<%#Eval("sdasdas") + ","+Eval("fafasfa") %>' /></div>
<div class="yildiz"><asp:ImageButton ID="ImageButton5" runat="server" Height="19px" ImageUrl="~/images/yildiz.png" onclick="ImageButton5_Click" Width="20px" style="position: relative; top: 13px; left:8px; float:left;" commandArgument='<%#Eval("row[0].ToString()") + ","+Eval("row[1].ToString()") %>'/></div>
<div class="yildiz"><asp:ImageButton ID="ImageButton6" runat="server" Height="19px" ImageUrl="~/images/yildiz.png" …Run Code Online (Sandbox Code Playgroud) 我知道这是重复但我无法获得可靠的解决方案(对于asp.net web).
如果会话过期,我只想重定向到登录页面.我试过以下:
$.ajax({
type: "POST",
url: "stream.asmx/SomeMethod",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
//success msg
},
error: function (request, status, error) {
if (status = 403) {
location.href = 'login.aspx';
}
}
});
Run Code Online (Sandbox Code Playgroud)
问题:这也为其他错误返回相同的状态代码(403),我只期望会话超时.
代码背后:
if (!object.Equals(HttpContext.Current.Session["User"], null))
{
Id = int.Parse(HttpContext.Current.Session["User"].ToString());
}
else
{
result = from row in dtscrab.AsEnumerable()
select new
{
redirectUrl = "login.aspx",
isRedirect = true
};
}
Run Code Online (Sandbox Code Playgroud)
$ .ajax成功:
success: function (msg) {
if (msg.d[0].isRedirect) {
window.location.href = …Run Code Online (Sandbox Code Playgroud) 对我来说这是非常常见但很重要的问题,因为在我的项目中,我开始将硬编码查询转换为存储过程,我知道使用它的优势.但是,是否有任何特定的情况我应该避免使用存储过程?
我使用了fileupload.js jquery插件并按照本教程实现:使用jQuery File Upload插件上传ASP.NET Ajax文件
这很好用,但是一旦使用输入(fileuplaod控件)选择文件,就会引发事件并上传文件.但是,我只是在点击按钮后尝试这样做.
这是代码:
<input id="fileupload" type="file" name="file" multiple="multiple"/>
<input id="btnSubmit" type="button" value="Start Upload"/>
$('#fileupload').fileupload({
//uploads file
});
Run Code Online (Sandbox Code Playgroud)
需要做这样的事情:
$('#btnSubmit').click(function () {
$('#fileupload').fileupload({
//uploads file
});
});
Run Code Online (Sandbox Code Playgroud)
我想我们可以使用回调选项来做到这一点,但我无法正确得到这个:回调选项
表结构:

我试过这个:
select Id, Name from Color where ParentId=4
UNION
select Id, Name from Color where ParentId=(select Id from Color where ParentId=4)
Run Code Online (Sandbox Code Playgroud)
上面的方法是静态的,在这种情况下,我必须知道所有的ID.我正在寻找一些动态方法,因为我只有Color的ParentId值.
例如:对于ParentId = 4,有两条记录; 名称蓝色和红色他们的Id分别是6和10.现在,我需要获取Id 6和10的所有记录.
当此错误提示我的屏幕时,我该怎么办?
在VS2008 Express Edition中

在Web浏览器中
分析器错误消息:在应用程序级别之外使用注册为Definition ='MachineToApplication'的部分是错误的.此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的.
来源错误:
第36行:ASP.NET识别传入的用户.第37行: - >第38行:第39行:部分启用配置

我尝试了三种方法。
第一个:index.html
<base href="/customer">
Run Code Online (Sandbox Code Playgroud)
第二个:app.module.ts
@NgModule({
providers: [{provide: APP_BASE_HREF, useValue: '/customer'}]
})
Run Code Online (Sandbox Code Playgroud)
第三个:app-routing.module.ts
const routes: Routes = [
{ path: "", redirectTo: "/customer", pathMatch: "full" },
{
path: "customer",
component: CustomerComponent,
data: { animation: "HomePage" }
}
];
Run Code Online (Sandbox Code Playgroud)
以上所有方法都适用于 URL 路由,我得到了所需的 URL。
但是,静态文件(js 和图像)仍在使用基本路径“ http://localhost:4200/ ”加载。我需要它像http://localhost:4200/customer/main.js 一样。
因此,出于某些安全验证原因,我试图将其设为http://localhost:4200/customer/main.js而不是http://localhost:4200/main.js。
同样可以在下面的屏幕截图中看到。
我无法在谷歌上得到满意的答案,他们是:
我很想知道这件事.
我是 AutoMapper 的新手,正在尝试映射Arrayclass ItemLink[]。
public class ViewModel
{
public ItemLink[] ItemLinks { get; set; }
}
public class ItemLink
{
public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我试过:
Mapper.Map<viewModel.ItemLink>(db.ItemLinks);
Run Code Online (Sandbox Code Playgroud)
错误:
“映射器未初始化。使用适当的配置调用初始化。如果您尝试通过容器或其他方式使用映射器实例,请确保没有对静态 Mapper.Map 方法进行任何调用,并且如果您使用的是 ProjectTo 或 UseAsDataSource扩展方法,请确保传入适当的 IConfigurationProvider 实例。”
简单的映射不行吗?
编辑1
为了澄清更多,我从数据库中获得了类似的类结构。例子,
public class Db
{
public ItemLink[] ItemLinks { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
所以,我想用 来ViewModel.ItemLink[]映射Db.ItemLink[]。
asp.net ×7
c# ×6
sql ×2
.net ×1
ajax ×1
angular ×1
angular7 ×1
asp.net-mvc ×1
automapper ×1
file-upload ×1
imagebutton ×1
jquery ×1
security ×1
session ×1
sql-server ×1
t-sql ×1