• Home
  • Trace mobile number (From India)
  • Entertainment
  • SiteMap
  • Home
  • ASP.NET
  • C#
  • BLOGGING
  • SQL SERVER
  • FACEBOOK
  • Entertainment
Place the following code where you would like the JavaScript button to appear: 


<input type="button" value="Open Window"
onclick="window.open('http://www.domain.com')">


Edit the JavaScript code according to your needs.

If you want to redirect your visitors to a new page, then by using this HTML redirect code you can do that. 

By Placing the following HTML redirect code between the <HEAD> and </HEAD> tags of your HTML code you can redirect visitors to a new page.


<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">

Note: don't forget to replace yourdomain.com with your domain name.

This below JavaScript code will enable you to place a button on your website that, when clicked on, will make your web site your visitors home page.


<INPUT TYPE="button" VALUE="Make This page Your Home Page" onClick="this.style.behavior='url(#default#homepage)'; this.setHomePage('http:// www.usetricks.com');">
Display:
In this tip i will tell you  a way to open a new window when someone leave a web page, this code may be what you're looking for.We can use <body> Tag  onUnload event for this .

This below HTML code will open the web page which you specify as soon as you leave the original web page.



<body onUnload=”window.open('http://www.domain.com'); self.blur();”>

Copy paste this code in body tag of your page and replace www.usetricks.com with your desire page url.

onUnload=”window.open('http://www.usetricks.com'); self.blur();”

This effect can be used for your entire web page background, or within your table cells. 

To use the gradient effect as your web page background, use the following BODY tag:
 
<body style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');">
 
To use the gradient effect within your HTML tables, place the following code within your table tag:
 
style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"
Here in this tip i will show you how you can Embed a Web Pages within other Web Pages.Use the below HTML code to do that.

In the below example , I am  displaying a web page within the current web page .

This HTML code will enable you to display rotating tips, images or whatever you'd like.

Copy and paste the  below code into your web page where you would like to embed the web page. 
 
<object data=http://www.usetricks.com width="500" height="450"> <embed src= http://www.usetricks.com width="500" height="450"> </embed> Error: You Can’t see Embedded data. </object>

It Will Look Like this:

Error: You Can’t see Embedded data.
Here in this tip i will show you how you can change color of  HTML table cells when you place your pointer over the cells.

Place your mouse pointer over each of the HTML table cells below to view this HTML mouseover effect.

Place Data here
Place Data here
Place Data here

This HTML code will enable you to give your HTML tables a more professional look and feel, as it will greatly improve the presentation of your HTML table data.

Your table code will look like the below code:

<TABLE BORDER="1" CELLPADDING="1" WIDTH="100%">
<TR onMouseover="this.bgColor='#FF90000'"onMouseout="this.bgColor='#FFFFFF'">
<TD>Place Data here</TD>
</TR>
<TR onMouseover="this.bgColor='#FF90000'"onMouseout="this.bgColor='#7987A1'">
<TD>Place Data here</TD>
</TR>
<TR onMouseover="this.bgColor='#FF90000'"onMouseout="this.bgColor='#7987A1'">
<TD>Place Data here</TD>
</TR>
</TABLE>

There are three location where JavaScript can be placed for use in a webpage.

  1.     within the head tag
  2.     Within the body tag
  3.     In an external file

If you want to have a script run if some event occure,like when a user clicks a button, then you will place that script within the head tag. If you want the script to run when the page loads, then you will have to place the script within the body tag.We use External JavaScript files if we want seprate or hide  javascript function  from html webpage .

An Example Placing  Script within head Tag

<html>
<head>
<script type="text/JavaScript">
<!--
function popup() {
alert("Hello I am within Head")
}
//-->
</script>
</head>
<body>
<input type="button" onclick="popup()" value="popup">
</body>
</html>

An Example Placing  Script within <body> Tag

<html>
<head>
</head>
<body>
<script type="text/JavaScript">
<!--
alert("Hello I am within Head")
//-->
</script>
</body>
</html>

An Example Placing  Script within External JavaScript files


<html>
<head>
<script type="text/JavaScript" src=”script.js”>
</script>
</head>
<body>
<input type="button" onclick="popup()" value="popup">
</body>
</html>

Place the following code in script.js file .


function popup()
 {
alert("Hello I am within External file");
 }


This javascript code will display the current time from the client’s computer. This will display the format you might see on a typical digital clock -- HH:MM AM/PM (H = Hour, M = Minute).

<h4>The Current Time Is 
<script type="text/javascript">
<!--
var dateobj = new Date()
var hrs = dateobj.getHours()
var min = dateobj.getMinutes()
if (min < 10){
min = "0" + min
}
document.write(hrs + ":" + min + " ")
if(hrs > 11){
document.write("PM")
} else {
document.write("AM")
}
//-->
</script>
</h4>

Display:

The Current Time Is

As the title of post implies, in this tutorial i will show you how to get the date and time from the visitor's computer using an example.here you will get the the basic information about how to create a date object in javascript.

How To Create  a Date Object
When a date object is created, it is stored in what's called a variable.Below is the syntax to create a date object.
var date = new Date();
Example:The code given below will show the today date and time from client computer. 
<script language="javascript">
function myFunction(){
    var date = new Date();
    alert(date.toString());
 
}
</script>
<input type="button" onclick="myFunction();" value="Today's Date Is" />

Click on this button will display datetime from your computer.
How To Extract Information From that Date Object
Lots of information can be extracted from a date object. In this tutorial, we'll extract only some important info:
   
    var hour        = date.getHours();
    var minute      = date.getMinutes();
    var second      = date.getSeconds();
    var monthnumber = date.getMonth();
    var monthday    = date.getDate();
    var year        = date.getYear();
The COUNT() function returns the number of rows that matches a specified criteria.

Syntax for SQL COUNT(column)

The COUNT(columnname) function returns the total   number of Record of the specified column.In this case the NULL values will not be counted.
SELECT COUNT(columnname) FROM tablename

Syntax for SQL  SQL COUNT(*) 

The COUNT(*) function returns the total number of records in the specified table:
SELECT COUNT(*) FROM tablename

Syntax for SQL   COUNT(DISTINCT columnname) 

The COUNT(DISTINCT columnname) function returns the number of distinct values of the specified column in a table:

SELECT COUNT(DISTINCT columnname) FROM tablename
Example: We have the following "Orders" table:
O_Id Date Price Customer_Name
1 2012/11/12 10000 Rajesh
2 2012/10/23 16000 Shiv
3 2012/09/02 7000 rupa
4 2012/09/03 3000 Hansen
5 2012/08/30 20000 Jensen
6 2012/10/04 1000 Shiv


Here we want to count the number of orders from 'Customer Shiv' the sql statement we use looks like this .

SELECT COUNT(Customer_name)  FROM Orders
WHERE Customer='Shiv'

Result :2

if we use this statement:

SELECT COUNT(*)  FROM Orders

Result:6

When SQL Server is installed by default, the guest user is disabled for security reasons.

There are many ways to get guest user status:

Using SQL Server Management Studio

You can expand the database node >> Security >> Users. If you see the RED arrow pointing downward, it means that the guest user is disabled.

Using sys.sysusers

If you notice column dbaccess as 1, it means that the guest user is enabled and has access to the database.

SELECT name, hasdbaccess
FROM sys.sysusers
WHERE name = 'guest'

Using sys.database_principals and sys.server_permissions

SELECT name, permission_name, state_desc
FROM sys.database_principals dp
INNER JOIN sys.server_permissions sp
ON dp.principal_id = sp.grantee_principal_id
WHERE name = 'guest' AND permission_name = 'CONNECT'

Using sp_helprotect

the following stored procedure will give you all the permissions associated with the user.

sp_helprotect @username = 'guest'

Disable Guest Account

REVOKE CONNECT FROM guest
For Moving  User Database Files to the New Location On the Same Server in MS SQL Server You Can use Database backup and restore which is the best method . But, when you need to move databases to the new location on the same server, backup and restore creates too much overhead. The below Steps will do the same job with as little downtime as possible.

-- Step1 the below query will make database offline and break all active connections

alter database YOURDATABASENAME
set offline
with rollback immediate
go

-- Step 2 the below query will detach database
use master
go
sp_detach_db 'YOURDATABASENAME'
go

-- Step 3 the below query will Show  the current data and log file locations
use YOURDATABASENAME
go
sp_helpfile
go

-- Step 4 copy data and log files to the new location

-- Step 5 the below query will reattach database Confirm  you specify correct paths to .mdf  and .ldf files)

use master
go
sp_attach_db 'YOURDATABASENAME','D:\SqlData\YOURDATABASENAME.mdf','D:\SqlLogs\
YOURDATABASENAME_log.ldf'
go

-- Step 6 verify that the database is using the new files location
use YOURDATABASENAME
go
sp_helpfile

Copy Rows From One DataSet to Another DataSet in ASP.NET using C#. DataSets in ASP.NET are usually read-only.  This means that it is difficult to copy a row from one DataSet to another. Using the following code you can easily filter rows from one DataSet to another.

Example:
//Here I am using emprecord table to fill the first data set

        SqlConnection Mycon = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].
ToString());
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "select * from emprecord";
        cmd.Connection = Mycon;
        DataSet ds = new DataSet();
        SqlDataAdapter MyAd = new SqlDataAdapter(cmd);
        //Now we will use SqlDataAdapter fill() method to fill data in dataset table.
         MyAd.Fill(ds);
        // Now here ds contains data in it now we have to copy this data to another Dataset for this use below code.

         DataSet ds1 = new DataSet();

        //this line will only copy the structure of DataSet ds to DataSet ds1
         ds1 = ds.Clone();

         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             //here you can filter your rows according to your choice.
             if (ds.Tables[0].Rows[i].ItemArray[1].ToString() != "Shanti Trivedi")
             {
                 ds1.Tables[0].ImportRow(ds.Tables[0].Rows[i]);
             }
         }

The below image shows the rows in both dataset.

Real Data (rows in ds)

EmpId
EmpName
Location
Phone
1
Rajesh Trivedi
Raibareli
9795507829
2
Rajkumar
Kanpur
3456789876
3
Shanti Trivedi
New Delhi
1234567654
4
visnu
New Delhi
5656565655665
5
susil
New Delhi
545435345345

Filterd Data(Rows in ds1)

EmpId
EmpName
Location
Phone
3
Shanti Trivedi
New Delhi
1234567654
4
visnu
New Delhi
5656565655665
5
susil
New Delhi
545435345345


A Web server serves pages for viewing in a Web browser, while an application server provides methods that client applications can call.

A Web server  handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols.

The Web server

Web servers are computers that deliver  Web pages. Every Web server has an IP address and possibly a domain name.A Web server handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page.

The application server

Also called an appserver, and application server is a program that handles all application operations between users and an organization's backend business applications or databases. An application server exposes business logic to client applications through various protocols, possibly including HTTP. While a Web server mainly deals with sending HTML for display in a Web browser, an application server provides access to business logic for use by client application programs. The application program can use this logic just as it would call a method on an object (or a function in the procedural world).
ViewState is a very important  for the programmers in page performance point of view. Programmers leave it enable for all the controls even if there is no need to persist their value. Right use of ViewState can increase the performance of the page drastically.

Using EnableViewState property we only have 2 options.
  • We can turn off view state altogether.                 
  • Enable viewstate for the entire page and then turn it off on a control-by-control basis.
If you want to turn of ViewState for the entire page and only enable it for specific controls on the page, then we have to use ViewStateMode property in conjunction with EnableViewState.

EnableViewState property only accepts true or false values and the default value is true, where as ViewStateMode property can have a value of - Enabled, Disabled and inherit. Inherit is the default value for ViewStateMode property, If we set this then it takes the value from the parent and set it accordingly. Suppose If it has been set to Disabled at Page level and for a checkbox you set ViewStateMode = “Inherit” then it will disable the ViewState for the checkbox.

ViewStateMode property is introduced in  4.0, where as EnableViewState exists from a long time.

If EnableViewState is to True, only then the ViewStateMode settings are applied, where as, if EnableViewState is set to False then the control will not save its view state, regardless of the ViewStateMode setting. In short if EnableViewState is set to False, ViewStateMode setting is not respected.

To disable view state for a page and to enable it for a specific control on the page, set the EnableViewState property of the page and the control to true, set the ViewStateMode property of the page to Disabled, and set  the ViewStateMode property of the control to Enabled.
Newer Posts Older Posts Home

Most Read

  • How to Capitalize the First Letter of All Words in a string in C# ?
  • keyboard shortcuts For Windows
  • List Of Best Free WordPress Plugins : 2012
  • Read Write XML Data-Read Write XML File Using C#, VB.NET In Asp.Net
  • How to Shake Internet Explorer - Javascript Code
  • How to Choose a Nice Topic for your Blog .
  • Free Search Engine Submission List ,search engine optimization
  • Number validation in Textbox of ASP.NET Using Regular Expression validator
  • Javascript:Percentage Gain Javascript Calculator
  • .Net Interview Questions and Answers on OOPS | OOPS Frequently Asked Questions
Google
Custom Search Bloggers - Meet Millions of Bloggers

Join Us On FaceBook

  • Recent Posts
  • Comments

All Topics

  • ►  2014 (10)
    • ►  January (10)
  • ►  2013 (14)
    • ►  October (1)
    • ►  April (2)
    • ►  March (11)
  • ▼  2012 (142)
    • ►  December (25)
    • ►  October (1)
    • ►  September (9)
    • ►  August (2)
    • ►  July (7)
    • ►  June (2)
    • ►  April (5)
    • ►  March (27)
    • ▼  February (27)
      • Open a New Window With a Button
      • Redirect Visitor to a New Page using meta REFRESH Tag
      • Make This Site Your Home Page Button |Add a "Make ...
      • Open a new window on page unload | page unload event
      • Tips to create a Gradient Background Effect
      • Embed a Web Pages within other Web Pages
      • Changing Table Background Colors on Mouseover | Mo...
      • Where to place Javascript in a HTML web page
      • JavaScript Current Time Clock
      • Basic JavaScript Date and Time Functions
      • SQL COUNT() Function
      • Detecting guest User Permissions and guest User Ac...
      • Moving User Database Files to the New Location On...
      • How to Copy Rows From One DataSet to Another DataS...
      • What is the difference between an application serv...
      • Difference between EnableViewState and ViewStateMo...
      • Free Search Engine Submission List ,search engine ...
      • HTML TITLE tag - HTML tips
      • Adding sound into a web page- JavaScript tip
      • Creating thin vertical separator lines in HTML
      • Hiding JavaScript code by using external .js files
      • How to scroll to the top of the page | use JavaSc...
      • How to Build Email Links On Your Web Site using HT...
      • Read Write XML Data-Read Write XML File Using C#, ...
      • Number validation in Textbox of ASP.NET Using Regu...
      • Using JavaScript getDate() Method
      • How to check if your browser has JavaScript enabled
    • ►  January (37)
  • ►  2011 (23)
    • ►  December (3)
    • ►  November (6)
    • ►  October (12)
    • ►  September (2)
  • ►  2009 (1)
    • ►  June (1)

Tips & Tricks

  • What is good One Blog and Many Categories, or Many Blogs with One Categories?
  • Adding Twitter tweet button to each Blogger posts.
  • How to Choose a Nice Topic for your Blog .
  • Embedding YouTube Videos ,movie in your blog
  • Facebook iFrame Apps – Getting Rid of Scrollbars
  • Facebook Analytics:How to Set Up Your Website or Blog with Facebook Insights for Domains
  • How To Add Perfect Share Box to Blogger
  • Blogger Free Images Hosting Tip,Free unlimited bandwidth image hosting for Blogger blogs
  • Add “Link to this post” codes below Each blogger posts
  • Free Search Engine Submission List ,search engine optimization
  • Adsense Tips for Maximum CTR
  • List Of Best Free WordPress Plugins : 2012
2012 tectopix. All rights reserved.
Designed by tectopix