European ASP.NET 4.5 Hosting BLOG

BLOG about ASP.NET 4, ASP.NET 4.5 Hosting and Its Technology - Dedicated to European Windows Hosting Customer

ASP.NET Core 1.0 Hosting - HostForLIFE.eu :: Progress Bar In GridView

clock July 27, 2016 23:06 by author Peter

Now, I will show you how to create Progress Bar In GridView with ASP.NET. The ASP.NET GridView control is the successor to the v1.x DataGrid, adding the ability to take advantage of specific capabilities of ASP.NET data source controls. Whereas the v1.x DataGrid required a page developer to write custom code to handle simple operations such as paging, sorting, editing or deleting data, the GridView control can automatically handle these operations provided its bound data source control supports these capabilities.

To make Progress Bar in GridView.

Html Code:

<div> 
<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White" 
    runat="server" AutoGenerateColumns="false"> 
    <Columns> 
        <asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="150" /> 
        <asp:BoundField DataField="Percentage" HeaderText="Percentage" ItemStyle-Width="150" /> 
        <asp:TemplateField ItemStyle-Width="300"> 
            <ItemTemplate> 
                <div class='progress'> 
                    <div class="progress-label"> 
                        <%# Eval("Percentage") %></div> 
                </div> 
            </ItemTemplate> 
        </asp:TemplateField> 
    </Columns> 
</asp:GridView> 
</div> 
<style type="text/css"> 
.ui-progressbar 

    position: relative; 

.progress-label 

    position: absolute; 
    left: 50%; 
    top: 4px; 
    font-weight: bold; 
    text-shadow: 1px 1px 0 #fff; 

body 

    font-family: Arial; 
    font-size: 10pt; 

</style> 
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/start/jquery-ui.css"> 
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script> 
<script type="text/javascript" src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> 
<script type="text/javascript"> 
$(function () { 
    $(".progress").each(function () { 
        $(this).progressbar({ 
            value: parseInt($(this).find('.progress-label').text()) 
        }); 
    }); 
}); 
</script> 

Namespaces code:

using System.Data; 

Code:
protected void Page_Load(object sender, EventArgs e) 

if (!this.IsPostBack) 

    DataTable dt = new DataTable(); 
    dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)), 
                    new DataColumn("Name", typeof(string)), 
                    new DataColumn("Percentage",typeof(string)) }); 
    dt.Rows.Add(1, "John Hammond", 45); 
    dt.Rows.Add(2, "Mudassar Khan", 37); 
    dt.Rows.Add(3, "Suzanne Mathews", 67); 
    dt.Rows.Add(4, "Robert Schidner", 12); 
    GridView1.DataSource = dt; 
    GridView1.DataBind(); 


HostForLIFE.eu ASP.NET Core 1.0 Hosting

European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.



ASP.NET Core 1.0 Hosting - HostForLIFE.eu :: ASP.NET CompareValidator

clock July 21, 2016 20:57 by author Peter

In this article I will show you how to use compare validator to compare the two input values. Using compare validator we can compare two values from two different input controls or we can compare input value with some constant or fixed value.

Example of compare validator:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ul style="list-style-type: none">
            <li>
                <asp:TextBox ID="txt1" runat="server" />
                =
                <asp:TextBox ID="txt2" runat="server" />
            </li>
            <li>
                <asp:Button ID="Button1" Text="Validate" runat="server" />
            </li>
        </ul>
        <br>
        <asp:CompareValidator ID="compareval" Display="dynamic" ControlToValidate="txt1"
            ControlToCompare="txt2" ForeColor="red" Type="String" EnableClientScript="false"
            Text="Values are not equal." runat="server" />
    </div>
    </form>
</body>
</html>


So in compare validator we need to set ControlToValidate and ControlToCompare in order to compare two input values.

HostForLIFE.eu ASP.NET Core 1.0 Hosting

European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.



About HostForLIFE

HostForLIFE is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.


Month List

Tag cloud

Sign in