USE DatabaseName --Enter the name of the database you want to reindex
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT table_name
FROM information_schema.tables
WHERE table_type = 'base table'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
Total Pageviews
Thursday, July 1, 2010
Printing a Div in JAVAScript - Extended Version
This works in IE and Firefox, Mutiple Divs can be printed.
function PrintAllDivs(printDiv) {
if (typeof HTMLElement != "undefined" && !
HTMLElement.prototype.insertAdjacentElement) {
HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode) {
switch (where) {
case 'beforeBegin':
this.parentNode.insertBefore(parsedNode, this)
break;
case 'afterBegin':
this.insertBefore(parsedNode, this.firstChild);
break;
case 'beforeEnd':
this.appendChild(parsedNode);
break;
case 'afterEnd':
if (this.nextSibling)
this.parentNode.insertBefore(parsedNode, this.nextSibling);
else this.parentNode.appendChild(parsedNode);
break;
}
}
HTMLElement.prototype.insertAdjacentHTML = function(where, htmlStr) {
var r = this.ownerDocument.createRange();
r.setStartBefore(this);
var parsedHTML = r.createContextualFragment(htmlStr);
this.insertAdjacentElement(where, parsedHTML)
}
HTMLElement.prototype.insertAdjacentText = function(where, txtStr) {
var parsedText = document.createTextNode(txtStr)
this.insertAdjacentElement(where, parsedText)
}
}
var doc;
var contentDiv;
var content;
if (document.getElementById('printHiddenFrame') == null) {
document.body.insertAdjacentHTML("beforeEnd", "");
}
doc = printHiddenFrame.document;
doc.open();
doc.write("");
doc.write("");
doc.write("");
contentDiv = document.getElementById(printDiv);
if (contentDiv != null) {
doc.write(contentDiv.innerHTML);
}
ConvertToText(doc);
doc.write("");
setTimeout('document.getElementById(\'abc\')', 0);
doc.close();
return false;
}
function printHiddenPage() {
window.document.printHiddenFrame.focus();
window.document.printHiddenFrame.print();
}
function ConvertToText(doc) {
var f = doc.getElementsByTagName('textarea');
for (var i = 0; i < f.length; i++) {
var txt = doc.getElementById(f[i].id + 'Print');
f[i].style.display = 'none';
f[i].style.visibility = 'hidden';
if (txt != null) {
f[i].value == "" ? txt.innerHTML = " " : txt.innerHTML = f[i].value.replace(/\n\r/g, "
");
}
}
}
function PrintAllDivs(printDiv) {
if (typeof HTMLElement != "undefined" && !
HTMLElement.prototype.insertAdjacentElement) {
HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode) {
switch (where) {
case 'beforeBegin':
this.parentNode.insertBefore(parsedNode, this)
break;
case 'afterBegin':
this.insertBefore(parsedNode, this.firstChild);
break;
case 'beforeEnd':
this.appendChild(parsedNode);
break;
case 'afterEnd':
if (this.nextSibling)
this.parentNode.insertBefore(parsedNode, this.nextSibling);
else this.parentNode.appendChild(parsedNode);
break;
}
}
HTMLElement.prototype.insertAdjacentHTML = function(where, htmlStr) {
var r = this.ownerDocument.createRange();
r.setStartBefore(this);
var parsedHTML = r.createContextualFragment(htmlStr);
this.insertAdjacentElement(where, parsedHTML)
}
HTMLElement.prototype.insertAdjacentText = function(where, txtStr) {
var parsedText = document.createTextNode(txtStr)
this.insertAdjacentElement(where, parsedText)
}
}
var doc;
var contentDiv;
var content;
if (document.getElementById('printHiddenFrame') == null) {
document.body.insertAdjacentHTML("beforeEnd", "");
}
doc = printHiddenFrame.document;
doc.open();
doc.write("");
doc.write("");
doc.write("");
contentDiv = document.getElementById(printDiv);
if (contentDiv != null) {
doc.write(contentDiv.innerHTML);
}
ConvertToText(doc);
doc.write("");
setTimeout('document.getElementById(\'abc\')', 0);
doc.close();
return false;
}
function printHiddenPage() {
window.document.printHiddenFrame.focus();
window.document.printHiddenFrame.print();
}
function ConvertToText(doc) {
var f = doc.getElementsByTagName('textarea');
for (var i = 0; i < f.length; i++) {
var txt = doc.getElementById(f[i].id + 'Print');
f[i].style.display = 'none';
f[i].style.visibility = 'hidden';
if (txt != null) {
f[i].value == "" ? txt.innerHTML = " " : txt.innerHTML = f[i].value.replace(/\n\r/g, "
");
}
}
}
Sunday, June 20, 2010
Thursday, June 17, 2010
Printing a Div in JAVAScript
There several version of implementing. With iframe and without it.
With Iframe
function CallPrint() {
var content = document.getElementById('ctl00_DefaultContent_divShippingRate');
var pri = document.getElementById('ifmcontentstoprint').contentWindow;
pri.document.open();
pri.document.write(content.innerHTML);
pri.document.close();
pri.focus();
pri.print();
}
Add this iframe to html with iframe tags
iframe id="ifmcontentstoprint" style="height: 0px; width: 0px; position: absolute"
Call by button client click
OnClientClick="CallPrint();"
Without Iframe
function CallPrint()
{
var printContent = document.getElementById('ctl00_DefaultContent_divShippingRate');
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=0,top=5000,width=7000,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
Just call from onClientclick()
With Iframe
function CallPrint() {
var content = document.getElementById('ctl00_DefaultContent_divShippingRate');
var pri = document.getElementById('ifmcontentstoprint').contentWindow;
pri.document.open();
pri.document.write(content.innerHTML);
pri.document.close();
pri.focus();
pri.print();
}
Add this iframe to html with iframe tags
iframe id="ifmcontentstoprint" style="height: 0px; width: 0px; position: absolute"
Call by button client click
OnClientClick="CallPrint();"
Without Iframe
function CallPrint()
{
var printContent = document.getElementById('ctl00_DefaultContent_divShippingRate');
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=0,top=5000,width=7000,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
Just call from onClientclick()
Wednesday, June 16, 2010
Opening Windows by JAVAScript
When you show a modal dialog the window remains on top of other windows until the user explicitly closes it.
window.showModalDialog("Test.html","dialogWidth:400px; dialogHeight:225px; status:no; center:yes");
When you show a modeless dialog the window remains on top of other windows, but you can still access the other windows.
window.showModelessDialog("Test.html","dialogWidth:400px; dialogHeight:225px; status:no; center:yes");
window.showModalDialog("Test.html","dialogWidth:400px; dialogHeight:225px; status:no; center:yes");
When you show a modeless dialog the window remains on top of other windows, but you can still access the other windows.
window.showModelessDialog("Test.html","dialogWidth:400px; dialogHeight:225px; status:no; center:yes");
Monday, June 14, 2010
Implementation of ASP.Net Post back on the Client side
Implementation of ASP.Net Post back on the Client side:
Post back is implemented with the use javascript in the client side. The HTML page generated for each .aspx page will have the action property of the form tag set to the same page. This makes the page to be posted on to itself. If we check the entry on the HTML file, it will look something like this.
form name="_ctl1" method="post" action="pagename.aspx?getparameter1=134" language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;" id="_ctl1"
Also, all the validation code that is written (Required Field Validation, Regular Expression validation etc.,) will all be processed at the client side using the .js(javascript) file present in the webserver_wwwroot/aspnet_client folder.
With this new ASP .Net model, even if the user wants to post the data to a different .aspx page, the web server will check for the runat='server' tag in the form tag and post the web form to the same .aspx page. A simple declaration as in the following code snippet will be enough to create such a web form.
form id="form1" runat="server"
form
Post back is implemented with the use javascript in the client side. The HTML page generated for each .aspx page will have the action property of the form tag set to the same page. This makes the page to be posted on to itself. If we check the entry on the HTML file, it will look something like this.
form name="_ctl1" method="post" action="pagename.aspx?getparameter1=134" language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;" id="_ctl1"
Also, all the validation code that is written (Required Field Validation, Regular Expression validation etc.,) will all be processed at the client side using the .js(javascript) file present in the webserver_wwwroot/aspnet_client folder.
With this new ASP .Net model, even if the user wants to post the data to a different .aspx page, the web server will check for the runat='server' tag in the form tag and post the web form to the same .aspx page. A simple declaration as in the following code snippet will be enough to create such a web form.
form id="form1" runat="server"
form
Subscribe to:
Posts (Atom)