www.google.co.in

Saturday, February 21, 2009

Confirmation before the event fire

The purpose of Attributes




In asp.net one of the main control is command Button. My scenario is display the confirmation before the event fire. Let we see


It’s simple

Use JavaScript function “confirm”.

Syntax:

[controls]. Attributes.Add(strkeys as string , values as string)


Code :


btnExit.Attributes.Add("OnClick","return confirm('Exit from this Page')");

btnExit – Command Button
Attributes- basic control Attributes( HTML controls or Client controls)
So when you add an Attributes its fire on the Client side without server requst
OnClick- Event Name . Not only the events css also
Confirm- JavaAcript

Example or Events:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// set the Attributes at the time of form loading

btnExit.Attributes..Add("OnClick","return confirm('Exit from this Page')");
}
}



Another one Example with CSS :

protected void grdRackingmaster_RowDataBound(object sender, GridViewRowEventArgs e)
{

// set the row background color of the gridview at the time of DataBound event

if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmousemove", "this.style.backgroundColor='#D1D9E5'");


e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");

}

}

- when the mouse moves on the gridview control row color changed

Result :



----

Friday, February 20, 2009

MS SQL Troubleshooting

Sp_who & Sp_who 2





My friends! How to know your MS SQL, Doing what? , Way the system slow? , How may progress currently going on!. Here is the answer.

In SQL so many System stored procedures available. Let we see two stored procedures one is sp_who and sp_who2. This two are useful.


1.Sp_who (Show the Information about current users and processes)

Syntax :
---------
sp_who [[@login_name =] 'login']


Result:

Spid—The system process ID.
status—The status of the process (e.g., RUNNABLE, SLEEPING).
loginame—Login name of the user.
hostname—Machine name of the user.
blk—If the process is getting blocked, this value is the SPID of the blocking process.
dbname—Name of database the process is using.
Cmd—The command currently being executed (e.g., SELECT, INSERT)














2.Sp_who2

Show some additional information

Syntax :
---------
sp_who2 [[@login_name =] 'login']

Result:

CPUTime—Total CPU time the process has taken.
DiskIO—Total amount of disk reads for the process.
LastBatch—Last time a client called a procedure or executed a query.
ProgramName—Application that has initiated the connection (e.g., Visual Basic, MS SQL Query Analyzer)





---------------

Wednesday, February 18, 2009

Ajax

AJAX = Asynchronous JavaScript and XML
AJAX is not a new programming language, but a technique for creating better, faster, and more interactive web applications.
With AJAX, your JavaScript can communicate directly with the server, using the JavaScript XMLHttpRequest object. With this object, your JavaScript can trade data with a web server, without reloading the page.
AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages.
The AJAX technique makes Internet applications smaller, faster and more user-friendly.
SQL Server

The final choice to save the session information is using the Sql Server 2000 database. To use Sql Server for storing session state you need to do the following:

1) Run the InstallSqlState.sql script on the Microsoft SQL Server where you intend to store the session.

You web.config settings will look something like this:


SQL Server lets you share session state among the processors in a Web garden or the servers in a Web farm. Apart from that you also get additional space to store the session. And after that you can take various actions on the session stored.

The downside is SQL Server is slow as compared to storing session in the state in process. And also SQL Server cost too much for a small company.

Asp .net Web.config Configuration

1.What is Web.Config File?
Web.config file, as it sounds like is a configuration file for the Asp .net web application. An Asp .net application has one web.config file which keeps the configurations required for the corresponding application. Web.config file is written in XML with specific tags having specific meanings.

2.What is Machine.config File?

As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.
3.What can be stored in Web.config file?
There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..
Database connections
Session States
Error Handling

Security