Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » Ajax » General » Downloads
 
Add your own
alternative version

Magic AJAX: Applying AJAX to your existing Web Pages

, 28 May 2007 MIT
How to apply AJAX technologies to your web pages without replacing ASP.NET controls and/or writing JavaScript code.
magicajax-030-net11.zip
magicajax
Examples
ExampleSite (.NET 2.0 only)
Web.sitemap
webparts
images
first.GIF
last.GIF
next.gif
pow_by_aspnet2.0.gif
prev.GIF
examples
App_Data
App_Code
Docs
Core
script
bin
MagicAjax.dll
magicajax-030-net20.zip
MagicAjax.dll
Web.sitemap
first.GIF
last.GIF
next.gif
pow_by_aspnet2.0.gif
prev.GIF
magicajax-030-source.zip
Web.sitemap
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
first.GIF
last.GIF
next.gif
pow_by_aspnet2.0.gif
prev.GIF
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries
Entries.Extra
Entries.Old
Entries.Extra.Old
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
CVS
Root
Repository
Entries
Entries.Extra
Entries.Old
Entries.Extra.Old
MagicAjax.snk
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
UI
Design
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
Controls
ClientEventControls
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Extra
Entries.Old
Entries
Entries.Extra.Old
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
Interfaces
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
Configuration
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
CVS
Root
Repository
Entries
Entries.Extra
Entries.Old
Entries.Extra.Old
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
magicajax.zip
AJAXTest
AJAXTest.csproj.webinfo
Global.asax
Ajax
Ajax.csproj.user
Controls
Design
script
<%@ Page language="C#" MasterPageFile="~/MasterPage.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
	<asp:XmlDataSource ID="CustomersDataSource" runat="server" EnableCaching="true" CacheDuration="Infinite" DataFile="~/App_Data/customers.xml" />
	<asp:XmlDataSource ID="RowDataSource" runat="server" EnableCaching="true" CacheDuration="Infinite" DataFile="~/App_Data/customers.xml" XPath="customers/customer[@CustomerID='']" />

	<ajax:ajaxpanel ID="Ajaxpanel1" runat="server">
	
	<fieldset>
		<legend>GridView &amp; DetailsView using MagicAjax</legend>
		<i>An example of an ASP.NET 2.0 GridView combined with a DetailsView. Paging the grid and viewing the details is done without a visible postback.</i><br /><br />
		<table><tr>
		<td valign="top">
				<asp:GridView Width="400px" ID="GridView1" runat="server" DataSourceID="CustomersDataSource" 
						EnableViewState="False"
						DataKeyNames="customerid" AllowPaging="True"
						AutoGenerateSelectButton="True"
						OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
						OnPageIndexChanged="GridView1_PageIndexChanged"
						AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal">
						<Columns>
								<asp:BoundField DataField="CompanyName" HeaderText="Company" />
								<asp:BoundField DataField="Country" HeaderText="Country" />                                
						</Columns>
					<PagerSettings Mode=NextPreviousFirstLast FirstPageImageUrl="~/images/first.GIF" LastPageImageUrl="~/images/last.GIF" NextPageImageUrl="~/images/next.gif" PreviousPageImageUrl="~/images/prev.GIF" />
					<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
					<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
					<SelectedRowStyle BackColor="#738A9C" ForeColor="#F7F7F7" />
					<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Center" />
					<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
					<AlternatingRowStyle BackColor="#F7F7F7" />
				</asp:GridView>
		</td>
		<td valign="top">
				<asp:DetailsView Width="350px"  ID="DetailsView1" runat="server" 
						DataKeyNames="customerid"  
						HeaderText="Customer Details"
						EmptyDataText="No customer currently selected"
						DataSourceID="RowDataSource" 
						AutoGenerateRows="False" 
						BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal">
						<Fields>
								<asp:BoundField DataField="CustomerID" HeaderText="ID" HeaderStyle-Width="80px" />
								<asp:BoundField DataField="CompanyName" HeaderText="Company" />
								<asp:BoundField DataField="ContactName" HeaderText="Contact" />
								<asp:BoundField DataField="Address" HeaderText="Address" />                
								<asp:BoundField DataField="City" HeaderText="City" />      
								<asp:BoundField DataField="Country" HeaderText="Country" />                             
						</Fields>
					<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
					<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
					<AlternatingRowStyle BackColor="#F7F7F7" />
				</asp:DetailsView>   
		</td>
		</tr></table>
  </fieldset>
  </ajax:ajaxpanel>
</asp:Content>

<script language="C#" runat="server">
	private void GridView1_SelectedIndexChanged(object sender, EventArgs e)
	{
		RowDataSource.XPath = "customers/customer[@CustomerID='" + GridView1.SelectedDataKey.Value + "']";
	}
	private void GridView1_PageIndexChanged(object sender, EventArgs e)
	{
		GridView1.SelectedIndex = -1;
	}
</script>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License

Share

About the Author

Argiris Kirtzidis
Web Developer
Greece Greece
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 28 May 2007
Article Copyright 2005 by Argiris Kirtzidis
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid