被生活干了

无论你说的话多么傻逼,但我坚决捍卫你说话的权利

导航

Atlas_自动完成&Timer

  1. <atlas:TimerControl>
  2. <atlas:ControlExtenders>

SRC:

 1<%@ Page Language="C#"  %>
 2
 3
 4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 5
 6<script runat="server">
 7
 8
 9    protected void tickerTimer_Tick(object sender, EventArgs e)
10    {
11        Random r1 = new Random();
12        valueAAA.Text = "$" + r1.Next(2530).ToString();
13        valueBBB.Text = "$" + r1.Next(80100).ToString();
14        valueCCC.Text = "$" + r1.Next(300500).ToString();
15    }

16</script>
17
18<html xmlns="http://www.w3.org/1999/xhtml" >
19<head id="Head1" runat="server">
20    <style>
21        .start{background-color:yellow;border:dashed 2px black;}
22        .hover{font-size:40pt;background-color:yellow;border:dashed 2px black;}
23    </style>
24    <link href="intro.css" type="text/css" rel="Stylesheet" />
25    <title>ASP.NET &quot;Atlas&quot; Demo: Server-side Controls</title>
26</head>
27<body>
28    <form id="form1" runat="server">
29        <div id="Div1" class="title">
30            <h2>ASP.NET &quot;Atlas&quot; Demo: Server-side Controls</h2>
31            The following ASP.NET &quot;Atlas&quot; server-side controls are shown in this example:
32            <ol>
33            <li>&lt;atlas:TimerControl&gt;</li>
34            <li>&lt;atlas:ControlExtenders&gt;</li>
35            </ol>
36        </div>
37        <div class="description">
38            <atlas:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true" />
39            <hr />
40            <h3><u>Example 1:  Atlas:TimerControl</u></h3>
41            The example shown below demonstrates the usage of Timer control in conjunction with an UpdatePanel 
42            to update the stock quotes for company 'AAA''BBB' and 'CCC' automatically. The content updates 
43            once every 15 sec<br />
44            <br />
45            <atlas:TimerControl runat="server" Interval="15000" ID="tickerTimer" OnTick="tickerTimer_Tick" />
46            <atlas:UpdatePanel runat="server" ID="UpdatePanel1">
47                <Triggers>
48                    <atlas:ControlEventTrigger ControlID="tickerTimer" EventName="Tick" />
49                </Triggers>
50                <ContentTemplate>
51                    <marquee bgcolor='aqua' >
52                        <asp:Label runat="server" ID="nameAAA" Text="AAA :" Font-Bold="True" />
53                        <asp:Label runat="server" ID="valueAAA" Text="$27" Font-Bold="True" /> |
54                        <asp:Label runat="server" ID="nameBBB" Text="BBB :" Font-Bold="True" /> 
55                        <asp:Label runat="server" ID="valueBBB" Text="$89" Font-Bold="True" /> |
56                        <asp:Label runat="server" ID="nameCCC" Text="CCC :" Font-Bold="True" />
57                        <asp:Label runat="server" ID="valueCCC" Text="$396" Font-Bold="True" />
58                    </marquee>
59                </ContentTemplate>
60            </atlas:UpdatePanel>
61            <br />
62            <hr />
63            <h3><u>Example 2: ControlExtenders</u></h3>
64            This example demonstrates the usage of the AutoCompleteExtender. This extender allows textbox controls to support auto-completion. In the sample below, the extender reads completion list from a web service.
65            Enter atleast 3 chars in the TextBox to enable the auto completion.<br />
66            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>    
67            <atlas:AutoCompleteExtender runat="server" ID="Extender1" >
68                <atlas:AutoCompleteProperties Enabled="true" TargetControlID="TextBox1" ServiceMethod="GetFilteredList" ServicePath="FilterService.asmx" />
69            </atlas:AutoCompleteExtender>
70            <br />
71            <hr />
72            </div>
73    </form>
74</body>
75</html>
76

webService:

 1<%@ WebService Language="C#" Class="FilterService" %>
 2
 3using System;
 4using System.Collections;
 5using System.Web;
 6using System.Web.Services;
 7using System.Web.Services.Protocols;
 8
 9[WebService(Namespace = "http://tempuri.org/")]
10[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
11public class FilterService  : System.Web.Services.WebService {
12
13    [WebMethod]
14    public string[] GetFilteredList(string prefixText, int count)
15    {
16        if (count == 0{
17            count = 10;
18        }

19
20        ArrayList items = new ArrayList(count);
21        Random random = new Random((int)DateTime.Now.Ticks);
22        for (int i = 0; i < count; i++{
23            char c1 = (char)random.Next(33127);
24            char c2 = (char)random.Next(33127);
25            char c3 = (char)random.Next(33127);
26
27            items.Add(prefixText + c1 + c2 + c3);
28        }

29
30        return (string[])items.ToArray(typeof(string));
31    }

32}

33

posted on 2006-04-27 13:32  komazhang  阅读(242)  评论(0编辑  收藏  举报