Click here to Skip to main content
15,892,839 members
Articles / Web Development / ASP.NET

Programmatically Setting Control Adapters for URL Rewriting and AJAX

Rate me:
Please Sign up or sign in to vote.
4.23/5 (7 votes)
25 Jun 2008CPOL3 min read 66.7K   196   22  
A guide to injecting control adapters at runtime
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CodeKing.Website._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>Untitled Page</title>
    <style type="text/css">
        #updatePanel 
        {
            background-color: #CCC;
            padding: 10px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
            <h2>Url Rewrite & Ajax Demo</h2>
            <p>The following demo shows url re-writting & Ajax working together with the use
            of programmatically attached control adapters.</p>
            <script type="text/javascript">
                document.write("HtmlForm <i>action</i> attribute: "+document.forms[0].action);
            </script>
            <br />
            <p>Ajax form starts here:</p>
            <div id="updatePanel">
                <asp:UpdatePanel ID="demoPanel" runat="server">
                    <ContentTemplate>
                        The time is <asp:label id="timeStamp" runat="server" />
                        <asp:LinkButton ID="button" Text="Refresh" runat="server" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
            <h2>Test virtual url</h2>
            <p>Click here to test the Ajax panel with a rewritten url.</p>
            <a href="/virtual/sample.aspx">Virtual Url</a>
        </div>
    </form>
</body>
</html>

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 Code Project Open License (CPOL)


Written By
Architect
United Kingdom United Kingdom
Mike Carlisle - Technical Architect with over 20 years experience in a wide range of technologies.

@TheCodeKing

Comments and Discussions