hello,
i have wriitten a code like this:
using
System;
using
System.Data;
using
System.Configuration;
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;
using
System.Data.SqlClient;using System.Web.Services;
public
partial class _Default : System.Web.UI.Page
{
//SqlConnection con = new SqlConnection();
//SqlCommand cmd = new SqlCommand();
//string st;static int i;protected void Page_Load(object sender, EventArgs e)
{
Timer1.Interval = 500;
Timer1.Enabled = true;
lblmtr.Text =
"00000000";lblfreq.Text = "000000";
lbldat.Text =
"00000000";lbltime.Text = "00000000";
lblvol1.Text =
"000000";lblvol2.Text = "000000";
lblvol3.Text =
"000000";lblcu1.Text = "000000";
lblcur2.Text =
"000000";lblcur3.Text = "000000";
lbllin1.Text =
"000000";lbllin2.Text = "000000"; lbllin3.Text = "000000";
// database();
}
public void database()
{
DataSet ds;
//localhost.Service obj = new localhost.Service();com.vvspl.www.Service obj = new com.vvspl.www.Service();
ds = obj.data(
"1");lblmtr.Text = ds.Tables["electricmeter"].Rows[0][0].ToString();
lblfreq.Text = ds.Tables[
"electricmeter"].Rows[0][1].ToString();lbldat.Text = ds.Tables["electricmeter"].Rows[0][11].ToString();
lbltime.Text = ds.Tables[
"electricmeter"].Rows[0][12].ToString();lblvol1.Text = ds.Tables["electricmeter"].Rows[0][2].ToString();
lblvol2.Text = ds.Tables[
"electricmeter"].Rows[0][3].ToString();lblvol3.Text = ds.Tables["electricmeter"].Rows[0][4].ToString();
lblcu1.Text = ds.Tables[
"electricmeter"].Rows[0][5].ToString();lblcur2.Text = ds.Tables["electricmeter"].Rows[0][6].ToString();
lblcur3.Text = ds.Tables[
"electricmeter"].Rows[0][7].ToString();lbllin1.Text = ds.Tables["electricmeter"].Rows[0][8].ToString();
lbllin2.Text = ds.Tables[
"electricmeter"].Rows[0][9].ToString();lbllin3.Text = ds.Tables["electricmeter"].Rows[0][10].ToString();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Timer1.Interval = 30000;
database();
}
}
but the problem is pageload is taking almost more than 11 secs,what could be the problem.
and also whenever timer event occurs ,it;s first going into page load event and then time1_tick event.