C# 我的页面上也有同样的问题。 每次我都要点击两次才能让它工作。 这是由某些文本框和dropdownlist将autopostback设置为true引起的。 一旦我移除了自动回邮功能,它甚至变得平滑,单次点击触发正常。
对此我不太清楚,但这个技巧对我很有效:C# 我的页面上也有同样的问题。 每次我都要点击两次才能让它工作。 这是由某些文本框和dropdownlist将autopostback设置为true引起的。 一旦我移除了自动回邮功能,它甚至变得平滑,单次点击触发正常。,c#,asp.net,C#,Asp.net,对此我不太清楚,但这个技巧对我很有效: function pageLoad(sender, args) { $(document).ready(function () { //your stuff }); $(":button").each(function() { $(this).click(); //this is a trick; click one when page load, }); } 我遇到这个问
function pageLoad(sender, args) {
$(document).ready(function () {
//your stuff
});
$(":button").each(function() {
$(this).click();
//this is a trick; click one when page load,
});
}
我遇到这个问题是因为我使用“Server.Transfer”在页面之间切换。当我改为“Response.Redirect”时,问题就解决了。一些OT评论:-您不需要执行Convert.ToString(会话[“game”])。Session[name]是一个对象,因此您只需将其放回:(string)Session[“game”]-您应该研究参数化SQL,因为您对注入攻击非常开放。请仔细研究参数化SQL。这是一篇非常好的文章,我经常向人们介绍它,虽然这在技术上可能有效,你能看看代码并确定为什么代码不起作用吗?谢谢你的回答。但是,更清晰的做法是实际说明按钮的预渲染,而不是页面。
if (!Page.IsPostBack)
{
...
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadData()
}
}
private void LoadData()
{
labDownloadList.Text = null;
//Session variables:
if (Session["Game"] != null)
...
}
protected void btnFilter_Click(object sender, EventArgs e)
{
game = lstGames.SelectedValue;
modtype = lstTypeMod.SelectedValue;
filter = true;
LoadData();
}
function pageLoad(sender, args) {
$(document).ready(function () {
//your stuff
});
$(":button").each(function() {
$(this).click();
//this is a trick; click one when page load,
});
}