Monday, May 25, 2009

How To Generate IFrame At Runtime Using Javascript


<script type="text/javascript">
var el = document.createElement("iframe");
el.setAttribute('id', 'ifrm');
el.setAttribute('width', '100%');
document.body.appendChild(el);
el.setAttribute('src', 'http://www.yahoo.com');
script>

Thursday, May 14, 2009

How to Print Div Tag Using Javascript?



HTML FILE :

<script language="javascript">

function CallPrint( strid )

{

var prtContent = document.getElementById( strid );

var WinPrint = window.open('', '', 'left=0,top=0,width=900,height=600,toolbar=1,scrollbars=1,status=0');

WinPrint.document.write( prtContent.innerHTML );

WinPrint.document.close();

WinPrint.focus();

WinPrint.print();

WinPrint.close();

prtContent.innerHTML=strOldOne;

}

script>

<div id="print_Grid">

This is Print

This is Print

This is Print

This is Print

This is Print

div>



Code FILE :


protected void Page_Load(object sender, EventArgs e)

{

btnPrint.Attributes.Add("onclick", "javascript:CallPrint('print_Grid')");

}


How To Use This Code?

1. Copy JavaScript into your HTML Page

2. Make a Div Tag Which data you want to print into that div tag

3. Add Print Button and call JavaScript Function




Wednesday, May 13, 2009

How To Get List of Tables in SQL Server


Using Following SQL Query you can get list of tables in SQL Database

SELECT name [Table Name]
FROM sysobjects
WHERE xtype = 'U'



How to Get SQL Table Columns List

How to get all field names in a table using sql query?



Following query is use for getting all sql table column names from database in Microsoft SQL server.

SELECT c.name
FROM syscolumns c INNER JOIN sysobjects o ON o.id = c.id
WHERE o.name ='TABLENAME'
ORDER BY colid

#How to find all SQL tables with a column name
#How to Get SQL Table Columns List
#How to get all field names in a table using sql query

ShareThis

Welcome

Welcome to Rajesh Prajapati, asp.net blog.
Here you can find some useful code and information about asp.net., c#, VB.net, SQL Server, Web Service, Web Designing etc