0% found this document useful (0 votes)
22 views

DOC3

This document contains code for an ASP.NET web page class called Ashwani that retrieves advertisement character data from a database table and displays it in a scrolling message. The Page_Load method connects to the database, selects the ad character field, and passes it to the myfucntion method. Myfucntion generates JavaScript code to continuously scroll the character string in the browser window status bar and registers this code to be included on the page.

Uploaded by

sidratanveer
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

DOC3

This document contains code for an ASP.NET web page class called Ashwani that retrieves advertisement character data from a database table and displays it in a scrolling message. The Page_Load method connects to the database, selects the ad character field, and passes it to the myfucntion method. Myfucntion generates JavaScript code to continuously scroll the character string in the browser window status bar and registers this code to be included on the page.

Uploaded by

sidratanveer
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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