Hi nauna,
Refer below code.
HTML
<asp:ListView ID="ListView2" runat="server" OnItemCommand="ListView2_ItemCommand">
<ItemTemplate>
<ul class="no-padding no-margin">
<li>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("time") %>'></asp:Label></li>
<li>
<asp:LinkButton ID="btn1" runat="server" Text="Click" CommandName="selection1"> </asp:LinkButton>
</li>
<li>
<asp:CheckBox runat="server" AutoPostBack="true" OnCheckedChanged="OnCheckedChanged" />
<asp:RadioButton runat="server" AutoPostBack="true" OnCheckedChanged="OnCheckedChanged" />
</li>
</ul>
</ItemTemplate>
</asp:ListView>
<div class="loading" align="center" runat="server" id="loadergif">
Loading. Please wait.<br />
<br />
<img src="loader.gif" alt="" />
</div>
<style type="text/css">
.modal {
position: fixed;
top: 0;
left: 0;
background-color: black;
z-index: 99;
opacity: 0.8;
filter: alpha(opacity=80);
-moz-opacity: 0.8;
min-height: 100%;
width: 100%;
}
.loading {
font-family: Arial;
font-size: 10pt;
border: 5px solid #67CFF5;
width: 200px;
height: 100px;
display: none;
position: fixed;
background-color: White;
z-index: 999;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function ShowProgress() {
setTimeout(function () {
var modal = $('<div />');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
}, 50);
}
$('[id*=ListView2]').live("click", function () {
var $btn = $(document.activeElement);
if ($btn[0].tagName == 'A' && $btn[0].text == 'Click') {
ShowProgress();
}
});
</script>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
BindData();
}
}
private void BindData()
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add("time");
dt.Rows.Add(DateTime.Now);
ListView2.DataSource = dt;
ListView2.DataBind();
}
protected void ListView2_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "selection1")
{
System.Threading.Thread.Sleep(2000);
string script = "$(document).ready(function () { $('[id*=ListView2]').find('a').click(); });";
ClientScript.RegisterStartupScript(this.GetType(), "load", script, true);
}
}
protected void OnCheckedChanged(object sender, EventArgs e)
{
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
BindData()
End If
End Sub
Private Sub BindData()
Dim dt As Data.DataTable = New Data.DataTable()
dt.Columns.Add("time")
dt.Rows.Add(DateTime.Now)
ListView2.DataSource = dt
ListView2.DataBind()
End Sub
Protected Sub ListView2_ItemCommand(ByVal sender As Object, ByVal e As ListViewCommandEventArgs)
If e.CommandName = "selection1" Then
System.Threading.Thread.Sleep(2000)
Dim script As String = "$(document).ready(function () { $('[id*=ListView2]').find('a').click(); });"
ClientScript.RegisterStartupScript(Me.[GetType](), "load", script, True)
End If
End Sub
Protected Sub OnCheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Screenshot