Asp.net Ajax for online staff display

Source: Internet
Author: User

Vs2005 + Ajax is too simple to implement the previous results. We are familiar with several Ajax extensions controls.

 

See the code.

 

<% @ Page Language = "C #" autoeventwireup = "true" codefile = "ttimer. aspx. cs" inherits = "ttimer" %>

<! 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> No title page </title>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: scriptmanager id = "scriptmanager1" runat = "server">
</ASP: scriptmanager>
<Asp: updatepanel id = "updatepanel1" runat = "server">
<Contenttemplate>
<Asp: timer id = "timer1" runat = "server" ontick = "timer1_tick">
</ASP: timer>
<Asp: gridview id = "gridview1" runat = "server">
</ASP: gridview>
</Contenttemplate>
</ASP: updatepanel>

</Div>
</Form>
</Body>
</Html>

 

 

 

using system;
using system. data;
using system. configuration;
using system. collections;
using system. web;
using system. web. security;
using system. web. ui;
using system. web. UI. webcontrols;
using system. web. UI. webcontrols. webparts;
using system. web. UI. htmlcontrols;

Public partial class ttimer: system. web. UI. page
{< br> private dataset DS = new dataset ();
protected void page_load (Object sender, eventargs e)
{< br> If (! Page. ispostback)
binddata ();
}< br> private void binddata ()
{< br> string SQL = "select class_id, class_name, class_pid from tc_user order by class_id ";
string strconn =" Data Source = SEE-CLN-059 \ pmserver; initial catalog = test; uid = sa; Pwd = ;";
conn = new conn (strconn);

DS = conn. GetSet (SQL );
This. gridview1.datasource = Ds. Tables [0];
This. gridview1.databind ();
}
Protected void timereffectick (Object sender, eventargs E)
{
Binddata ();
}
}

Of course, in case of exceptions, please write the Exception error display by yourself...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.