点击后面的代码,在updatepanel内禁用按钮 [英] Disable button inside updatepanel on click from code behind
本文介绍了点击后面的代码,在updatepanel内禁用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在开发一个asp.net应用程序,我想让链接按钮单击一次意味着我需要禁用它点击它之后.Link按钮被放置在更新面板内。我试过像这样的lnkSubmit.Enabled = false;但它不起作用你可以建议任何其他方法来自背后的代码(不是jquery)
谢谢提前
Hi all,
I'm working on an asp.net application in this i want to make a link button click only once means i need to disable it after clicking on it .Link Button is placed inside an update panel . i have tried like this lnkSubmit.Enabled = false; but it is not working can u suggest any other method from code behind (not jquery)
Thanks in advance
推荐答案
而不是显示加载程序,直到进程开启,以便用户无法再次点击它
http://www.aspsnippets.com/Articles/Display-loading-image-while -PostBack-calls-in-ASPNet.aspx [ ^ ]
instead you can display a loader till process is on so that user cannot click on it again
http://www.aspsnippets.com/Articles/Display-loading-image-while-PostBack-calls-in-ASPNet.aspx[^]
工作正常,请看下面的代码。
Default.aspx
It is working very fine, Please see the below code.
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWebApplication._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server" />
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:LinkButton Text="Click" ID="lnk" runat="server" onclick="lnk_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Default.aspx.cs
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TestWebApplication
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lnk_Click(object sender, EventArgs e)
{
lnk.Enabled = false;
}
}
}
这篇关于点击后面的代码,在updatepanel内禁用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文