You are on page 1of 2

using System;

using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
namespace IndianHoliday
{
/// <summary>
/// Summary description for Ashwani.
/// </summary>
public class Ashwani : System.Web.UI.Page
{
string str1;
private void Page_Load(object sender, System.EventArgs e)
{

SqlCommand cmd= new SqlCommand("SELECT advercharacter


from adrequesttable",cn);
cn.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
str1=(dr[0].ToString());
}
dr.Close();
myfucntion(str1);
}

#region Web Form Designer generated code


override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form
Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
#region global veriable
SqlConnection cn = new
SqlConnection(ConfigurationSettings.AppSettings["Con"]);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
protected System.Web.UI.WebControls.TextBox TextBox1;
DataSet ds = new DataSet();
#endregion

public void myfucntion(string s)


{
string str = "\n";
str += "<script language=JavaScript>\n";
str += " var i=0\n";
str += " myMsg='" + s +"
'\n";
str += " function scrollMsg() {\n";
str += " frontPart = myMsg.substring(i,myMsg.length)\n";
str += " backPart = myMsg.substring(0,i)\n";
str += " window.status = frontPart + backPart\n";
str += " if (i<myMsg.length)\n";
str += " {\n";
str += " i++}\n";
str += " else{\n";
str += " i = 0}\n";
str += " setTimeout('scrollMsg()',100)}\n";
str += "window.onload=scrollMsg()\n<" + "/" + "script>\n";
TextBox1.Text = str;
RegisterClientScriptBlock("script",str);
cn.Close();
}
}
}

You might also like