Navigation

Search

Categories

On this page

ASP.NET Controls Suite–oBout Software
Microsoft Ajax Content Delivery Network
Using the FileUpload control inside an UpdatePanel and Postbacktrigger
AjaxToolKit Calendar Extender
Call JavaScript function after UpdatePanel has fired server side code
Filtering a Gridview With a Dropdownlist
Microsoft AJAX Content Delivery Network (CDN)
GridView Paging using ASP.NET AJAX Slider Extender

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 378
This Year: 6
This Month: 1
This Week: 0
Comments: 17

Sign In
Pick a theme:

# Monday, January 23, 2012
Monday, January 23, 2012 2:31:10 PM (GMT Standard Time, UTC+00:00) ( ASP.NET | ASP.NET AJAX )


This is a really nice (and free) suite of ASP.NET controls

http://www.obout.com/

Comments [0] | | # 
# Saturday, December 24, 2011
Saturday, December 24, 2011 3:45:14 AM (GMT Standard Time, UTC+00:00) ( ASP.NET AJAX | jQuery )

 

I’ve been using the Microsoft Ajax CDN for a while but didn’t know that they had an official page for it. Includes not only links to jQuery but also to jQuery UI, jQuery Validate, jQuery Mobile and Modernizr.

http://www.asp.net/ajaxlibrary/cdn.ashx#Modernizr_Releases_on_the_CDN_6

Here is an example of how to call these files from the CDN:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestjQueryUICDN.WebForm1" %>
<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Using jQuery UI from the CDN</title>
    <link rel="Stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:TextBox ID="txtStartDate" ClientIDMode="Static" runat="server" />

    </div>
    </form>

    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.js"></script>

    <script>

        $("#txtStartDate").datepicker();

    </script>
</body>
</html>

Comments [0] | | # 
# Thursday, March 24, 2011
Thursday, March 24, 2011 4:10:05 PM (GMT Standard Time, UTC+00:00) ( ASP.NET | ASP.NET AJAX )
# Thursday, November 11, 2010
Thursday, November 11, 2010 2:09:03 AM (GMT Standard Time, UTC+00:00) ( ASP.NET AJAX | Javascript/AJAX )


This is a nice calendar. Here’s how to get it and some examples: http://www.asp.net/ajax/ajaxcontroltoolkit/samples/calendar/calendar.aspx

<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtBeginDate" />
                        <asp:TextBox ID="txtBeginDate" runat="server"/>
</ContentTemplate>       
</asp:UpdatePanel>

Comments [0] | | # 
# Friday, October 15, 2010
Friday, October 15, 2010 5:13:00 AM (GMT Daylight Time, UTC+01:00) ( ASP.NET AJAX | Javascript/AJAX )

 

This shows how to call a function or execute a JavaScript code after UpdatePanel processing is completed. I decided to write a blog on the solution which I gave to him. Actually we need to hook the events which are fired when the update panel is done with its processing and the event is Sys.WebForms.PageRequestManager endRequest Event.

Sys.WebForms.PageRequestManager endRequest Event: Raised after an asynchronous postback is finished and control has been returned to the browser.

So we need to hook this event in order execute a JavaScript code after the processing of UpdatePanel is done. Below is the sample code:

<%@ Page Language="C#" %>     

<!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 id="Head1" runat="server">  
    <title></title>  
</head>  

<body onload="foo()">
    <script type="text/javascript">  
        function foo()  
        {  
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler); 
        }  
        function endRequestHandler(sender, args)  
        {  
            // Do your stuff  
            alert('Update Panel work is done');  
        }  
    </script>  

    <form id="Form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>  
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
        <ContentTemplate>  
            <asp:Label ID="lblTest" runat="server" Text="Label"></asp:Label>  
            <asp:Button ID="btnTest" runat="server" Text="Test" onclick="btnTest_Click" />
        </ContentTemplate>  
    </asp:UpdatePanel>  
    </form>  
</body>  
</html>  
<script runat="server">   

    protected void btnTest_Click(object sender, EventArgs e)
    {  
        lblTest.Text="Server side code fired";  
    }       

</script> 

Above the "Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);" line will hook the "endRequestHandler" function and this function will be called when update panel is done with its processing in server side.

Comments [0] | | # 
# Tuesday, May 18, 2010
Tuesday, May 18, 2010 8:58:02 PM (GMT Daylight Time, UTC+01:00) ( ASP.NET | ASP.NET AJAX | Gridview )

I was looking for a way to filter the results in a gridview by selecting a value in a dropdownlist and came across this great example

http://blog.evonet.com.au/post/Creating-a-Stylish-looking-Gridview-with-Filtering.aspx

First the CSS

.GridviewDiv {font-size: 100%; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, 
Helevetica, sans-serif; color: #303933;} Table.Gridview{border:solid 1px #df5015;} .GridviewTable{border:none} .GridviewTable td{margin-top:0;padding: 0; vertical-align:middle } .GridviewTable tr{color: White; background-color: #df5015; height: 30px; text-align:center} .Gridview th{color:#FFFFFF;border-right-color:#abb079;border-bottom-color:#abb079;padding:0.5em 0.5em 0.5em 0.5em;text-align:center} .Gridview td{border-bottom-color:#f0f2da;border-right-color:#f0f2da;padding:0.5em 0.5em 0.5em 0.5em;} .Gridview tr{color: Black; background-color: White; text-align:left} :link,:visited { color: #DF4F13; text-decoration:none } Then the .aspx page
<%@ Page Language="VB" %>

<!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 profile="http://gmpg.org/xfn/11">
    <link rel="stylesheet" type="text/css" href="gridview.css" media="all" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <h3>Gridview with Filtering</h3>
            <div class="GridviewDiv">
            <table style="width: 540px" border="0" cellpadding="0" cellspacing="1" class="GridviewTable">
                <tr >
                    <td style="width: 40px;">
                        ID
                    </td>
                    <td style="width: 120px;" >
                        First Name
                    </td>
                    <td style="width: 120px;">
                        Last Name
                    </td>
                    <td style="width: 130px;">
                        Department
                    </td>
                    <td style="width: 130px;">
                        Location
                    </td>
                </tr>
                <tr >
                    <td style="width: 40px;">
                    </td>
                    <td style="width: 120px;">
                    </td>
                    <td style="width: 120px;">
                    </td>
                    <td style="width: 130px;">
                        <asp:DropDownList ID="ddldepartment" DataSourceID="dsPopulateDepartment" AutoPostBack="true"
                            DataValueField="department" runat="server" Width="120px" Font-Size="11px" AppendDataBoundItems="true">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td style="width: 130px;">
                        <asp:DropDownList ID="ddlLocation" DataSourceID="dsPopulateLocation" AutoPostBack="true"
                            DataValueField="location" runat="server" Width="120px" Font-Size="11px" AppendDataBoundItems="true">
                            <asp:ListItem Text="All" Value="%"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="5">
                        <asp:GridView ID="Gridview1" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                            AllowSorting="true" DataSourceID="dsGridview" Width="540px" PageSize="10" CssClass="Gridview">
                            <Columns>
                                <asp:BoundField DataField="id" HeaderText="Sort" SortExpression="id" ItemStyle-Width="40px"
                                    ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="FirstName" HeaderText="Sort" SortExpression="FirstName"
                                    ItemStyle-Width="120px" />
                                <asp:BoundField DataField="LastName" HeaderText="Sort" SortExpression="LastName"
                                    ItemStyle-Width="120px" />
                                <asp:BoundField DataField="Department" HeaderText="Sort" SortExpression="Department"
                                    ItemStyle-Width="130px" />
                                <asp:BoundField DataField="Location" HeaderText="Sort" SortExpression="Location"
                                    ItemStyle-Width="130px" />
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
            </table>
            </div>
            <asp:SqlDataSource ID="dsGridview" runat="server" ConnectionString="<%$ ConnectionStrings:EvonetConnectionString %>"
                SelectCommand="SELECT * FROM [T_Employees]" FilterExpression="Department like '{0}%'
                and Location like '{1}%'">
                <FilterParameters>
                    <asp:ControlParameter Name="Department" ControlID="ddldepartment" PropertyName="SelectedValue" />
                    <asp:ControlParameter Name="Location" ControlID="ddllocation" PropertyName="SelectedValue" />
                </FilterParameters>
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="dsPopulateDepartment" runat="server" ConnectionString="<%$ ConnectionStrings:EvonetConnectionString %>"
                SelectCommand="SELECT DISTINCT Department from [T_Employees]"></asp:SqlDataSource>
            <asp:SqlDataSource ID="dsPopulateLocation" runat="server" ConnectionString="<%$ ConnectionStrings:EvonetConnectionString %>"
                SelectCommand="SELECT DISTINCT Location FROM [T_Employees]"></asp:SqlDataSource>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
Comments [0] | | # 
# Thursday, September 17, 2009
Thursday, September 17, 2009 4:03:55 PM (GMT Daylight Time, UTC+01:00) ( ASP.NET AJAX | Javascript/AJAX | jQuery )


http://www.asp.net/ajax/CDN/

Here is a working demo of this code example

<!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>
        <title>jQuery from Microsoft AJAX CDN</title>
        <script src="http://ajax.Microsoft.com/ajax/jquery/jquery-1.3.2.js" type="text/javascript"></script>

        <script type="text/javascript">
        
        $( domReady );
        
        function domReady() {
            $('#btn').click( showMessage );
        }
        
        function showMessage() {
            $('#message').fadeIn('slow');
        }
        
        </script>
    </head>
    <body>

    <button id="btn">Show Message</button>

    <div id="message" style="display:none">

        <h1>Hello from jQuery!</h1>

    </div>

    </body>
    </html>

 
 
 
Comments [0] | | # 
# Thursday, January 01, 2009
Thursday, January 01, 2009 11:05:23 AM (GMT Standard Time, UTC+00:00) ( ASP.NET AJAX | Gridview )

This code and demonstration is based on this article.

Here is a working demo.

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<script runat="server">
    Protected Sub txtSlide_Changed(ByVal sender As Object, ByVal e As EventArgs)
        Dim txtCurrentPage As TextBox = TryCast(sender, TextBox)
        Dim rowPager As GridViewRow = GridView1.BottomPagerRow
        Dim txtSliderExt As TextBox = CType(rowPager.Cells(0).FindControl("txtSlide"), TextBox)
        GridView1.PageIndex = Int32.Parse(txtSliderExt.Text) - 1
    End Sub

    Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As EventArgs)
        Dim rowPager As GridViewRow = GridView1.BottomPagerRow
        Dim slide As SliderExtender = CType(rowPager.Cells(0).FindControl("ajaxSlider"), SliderExtender)
        slide.Minimum = 1
        slide.Maximum = GridView1.PageCount
        slide.Steps = GridView1.PageCount
    End Sub
</script>

<html>
<head runat="server">
<title></title>
<style type="text/css">
body
{
font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;    
background-color: #ffffff;
color: #4f6b72;       
}
 
th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
background: #D5EDEF;
}
 
td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}
 
td.alt
{
background: #F5FAFA;
color: #797268;
}
 
td.boldtd
{
font: bold 13px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
background: #D5EDEF;
color: #797268;
}
</style>
</head>
<body>

<form runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

<asp:GridView ID="GridView1" runat="server" AllowPaging="true" AutoGenerateColumns="false" PageSize="3"
DataKeyNames="ID" DataSourceID="SqlDataSource1" OnDataBound="GridView1_DataBound">
<Columns>
    <asp:BoundField DataField="Title" HeaderText="Title" />
    <asp:BoundField DataField="Director" HeaderText="Director" />
    <asp:BoundField DataField="DateReleased" HeaderText="Date Released" DataFormatString="{0:d}" /> 
</Columns>
<PagerTemplate>
    <asp:TextBox ID="txtSlide" runat="server" Text='<%# GridView1.PageIndex + 1 %>' AutoPostBack="true" OnTextChanged="txtSlide_Changed"/>               
    <cc1:SliderExtender ID="ajaxSlider" runat="server" TargetControlID="txtSlide" Orientation="Horizontal"  />
       <asp:Label ID="lblPage" runat="server" Text='<%# "Page " & (GridView1.PageIndex + 1) & " of " & GridView1.PageCount %>' />
       <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                    <ProgressTemplate>
                        <img alt="Loading" src="/images/ajaxicons/loading.gif" />                       
                    </ProgressTemplate>
</asp:UpdateProgress>
    </PagerTemplate>
</asp:GridView>

</ContentTemplate>
</asp:UpdatePanel>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyDatabase%>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT [ID], [Title], [Director], [DateReleased] FROM [Movies]">
</asp:SqlDataSource>

</form>

</body>
</html>
Comments [0] | | #