<input type="submit" value="Submit" onclick"ValidatePage();" />
<script type="text/javascript">
function ValidatePage() {
if (typeof (Page_ClientValidate) == 'function') {
Page_ClientValidate();
}
if (Page_IsValid) {
// do something
alert('Page is valid!');
}
else {
// do something else
alert('Page is not valid!');
}
}
</script>
Search This Blog
Saturday, November 5, 2011
Sunday, October 23, 2011
why does an AutocompleteExtender get refreshed at given interval?
AutocompleteExtender get refreshed at given interval when its EnableCaching is set to false.Set it to true to stop it.
Wednesday, October 5, 2011
how to use Sql Server Profiler
Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring T-SQL Statements of Database Engine. We can save and reuse the state at a later point of time.
•We can do the following using SQL Server Profiler
◦Create a trace
◦Watch the trace results as the trace runs
◦Store the trace results in a table
◦Start, stop, pause, and modify the trace results as necessary
◦Replay the trace results
•Use SQL Server Profiler to monitor only the events in which you are interested
How To Start SQL Profiler
>In Sql Server 2000
Start | Run | profiler | OK
>In Sql Server 2005
Start | All Programs | Microsoft SQL Server 2005 | Performance Tools | SQL Server Profiler.
•We can do the following using SQL Server Profiler
◦Create a trace
◦Watch the trace results as the trace runs
◦Store the trace results in a table
◦Start, stop, pause, and modify the trace results as necessary
◦Replay the trace results
•Use SQL Server Profiler to monitor only the events in which you are interested
How To Start SQL Profiler
>In Sql Server 2000
Start | Run | profiler | OK
>In Sql Server 2005
Start | All Programs | Microsoft SQL Server 2005 | Performance Tools | SQL Server Profiler.
Saturday, October 1, 2011
Integer Displaying as Hexadecimal When Debugging in Visual Studio.
If you Integers are displaying as hexadecimals (funny letters) then you've probably switched on the hexadecimal display option in your watch window.
You need to debug a project, open up the watch window: Debug > Windows > Watch 1 then right click on an entry and untick 'hexidecimal display'
You need to debug a project, open up the watch window: Debug > Windows > Watch 1 then right click on an entry and untick 'hexidecimal display'
Thursday, September 29, 2011
How to use GridViewDataRow with html contents.
If datasource(datatable) has html contents and bind this datasource to the gridview.
The GridView will show the data as it is in datatable.It means it will show the html content as it is.
For Example:
Your DataTable has html content "<Strong>Testing</Strong>" but gridview display same "<Strong>Testing</Strong>" instead of "Testing".
Solution:
Add the following code into gridView's Rowdatabound event.
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
foreach (TableCell cell in e.Row.Cells)
{
cell.Text = Server.HtmlDecode(cell.Text);
}
}
The GridView will show the data as it is in datatable.It means it will show the html content as it is.
For Example:
Your DataTable has html content "<Strong>Testing</Strong>" but gridview display same "<Strong>Testing</Strong>" instead of "Testing".
Solution:
Add the following code into gridView's Rowdatabound event.
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
foreach (TableCell cell in e.Row.Cells)
{
cell.Text = Server.HtmlDecode(cell.Text);
}
}
Tuesday, September 27, 2011
How to swap column value of a sql table.
Create Table tmp (A varchar(10),B VARCHAR(10))
insert into tmp values('a','1')
insert into tmp values('b','2')
insert into tmp values('v','3')
Select * from tmp
output
A B
a 1
b 2
v 3
Update #tmp Set A=B, B=A
Select * from tmp
swapped output
A B
1 a
2 b
3 v
insert into tmp values('a','1')
insert into tmp values('b','2')
insert into tmp values('v','3')
Select * from tmp
output
A B
a 1
b 2
v 3
Update #tmp Set A=B, B=A
Select * from tmp
swapped output
A B
1 a
2 b
3 v
Sunday, September 25, 2011
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
This error comes when you are trying to access iis7.0 or upgraded and iis is not register for asp.net.
Solution:Register IIS with ASPNET4.0 as follows......
c:\windows\microsoft.net\framework\v4.0.30319>aspnet_regiis -i
Solution:Register IIS with ASPNET4.0 as follows......
c:\windows\microsoft.net\framework\v4.0.30319>aspnet_regiis -i
Friday, August 19, 2011
External table is not in the expected format.
"External table is not in the expected format." typically occurs when trying to use an Excel 2007 file with a connection string that uses: Microsoft.Jet.OLEDB.4.0 and Extended Properties=Excel 8.0
Using the following connection string seems to fix most problems.
public static string path = @"C:\src\RedirectApplication\RedirectApplication\301s.xlsx";
public static string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;HDR=Yes;IMEX=1;";
Using the following connection string seems to fix most problems.
public static string path = @"C:\src\RedirectApplication\RedirectApplication\301s.xlsx";
public static string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;HDR=Yes;IMEX=1;";
Print Using Javascript.
function tablePrint(tblId)
{
var display_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
display_setting+="scrollbars=yes,width=750, height=600, left=100, top=25";
var lbtnPrint = document.getElementById('ctl00_CPHVmanage_FvVendorBillEntry_lbtnPrint');
lbtnPrint.style.display = 'none';
var content_innerhtml = document.getElementById(tblId).innerHTML;
var document_print = window.open("","",display_setting);
//document_print.document.open();
document_print.document.write('<html><head><title>Vendor Bill </title></head>');
document_print.document.write('<body onLoad="self.print();self.close();" >');
document_print.document.write(content_innerhtml);
document_print.document.write('</body>
{
var display_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
display_setting+="scrollbars=yes,width=750, height=600, left=100, top=25";
var lbtnPrint = document.getElementById('ctl00_CPHVmanage_FvVendorBillEntry_lbtnPrint');
lbtnPrint.style.display = 'none';
var content_innerhtml = document.getElementById(tblId).innerHTML;
var document_print = window.open("","",display_setting);
//document_print.document.open();
document_print.document.write('<html><head><title>Vendor Bill </title></head>');
document_print.document.write('<body onLoad="self.print();self.close();" >');
document_print.document.write(content_innerhtml);
document_print.document.write('</body>