Here is the way to get the TextBox ID from the custom text source of RadSpell.
this.sources[i].get_element().id
Friday, April 29, 2011
Monday, March 14, 2011
Save the scroll position when doing Ajax
var scrollTop;
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args)
{
var elem = document.getElementById('<%= scrollBar.ClientID %>');
scrollTop=elem.scrollTop;
}
function EndRequestHandler(sender, args)
{
var elem = document.getElementById('<%= scrollBar.ClientID %>');
elem.scrollTop = scrollTop;
}
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args)
{
var elem = document.getElementById('<%= scrollBar.ClientID %>');
scrollTop=elem.scrollTop;
}
function EndRequestHandler(sender, args)
{
var elem = document.getElementById('<%= scrollBar.ClientID %>');
elem.scrollTop = scrollTop;
}
Wednesday, November 17, 2010
ASP.NET with SQL 2005 Cache Dependence
1) Check to see Service Broker is enabled
SELECT name, is_broker_enabled FROM sys.databases
2) To enable the Service Broker on your database
ALTER DATABASE Pubs SET ENABLE_BROKER
GO
3) Inform SQL Server that the user running IIS has permission to subscribe to query notificatoins.
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "IIS_SERVER\ASPNET"
4) Create a connectionStrings in the web.config
<connectionstrings>
<add name="myDbConnectionString" connectionstring="Data Source=localhost;Initial Catalog=MyDB;Integrated Security=True" providername="System.Data.SqlClient">
</connectionstrings>
5) Enable the website to be able to receive notifications.
protected void Application_Start(object sender, EventArgs e)
{
SqlDependency.Start(ConfigurationManager.ConnectionStrings["myDbConnectionString"].ConnectionString);
}
The following code also stops the listener:
protected void Application_End(object sender, EventArgs e)
{
SqlDependency.Stop(ConfigurationManager.ConnectionStrings["myDbConnectionString"].ConnectionString);
}
6) Sets up the cach dependency. Example code.
string tableName = query.Context.Mapping.GetTable(typeof(T)).TableName;
List result = HttpContext.Current.Cache[tableName] as List;
if (result == null)
{
using (SqlConnection cn = new SqlConnection(query.Context.Connection.ConnectionString))
{
cn.Open();
SqlCommand cmd = new SqlCommand(query.Context.GetCommand(query).CommandText, cn);
cmd.Notification = null;
cmd.NotificationAutoEnlist = true;
SqlCacheDependencyAdmin.EnableNotifications(query.Context.Connection.ConnectionString);
if (!SqlCacheDependencyAdmin.GetTablesEnabledForNotifications(query.Context.Connection.ConnectionString).Contains(tableName))
{
SqlCacheDependencyAdmin.EnableTableForNotifications(query.Context.Connection.ConnectionString, tableName);
}
SqlCacheDependency dependency = new SqlCacheDependency(cmd);
cmd.ExecuteNonQuery();
result = query.ToList();
HttpContext.Current.Cache.Insert(tableName, result, dependency);
}
}
SELECT name, is_broker_enabled FROM sys.databases
2) To enable the Service Broker on your database
ALTER DATABASE Pubs SET ENABLE_BROKER
GO
3) Inform SQL Server that the user running IIS has permission to subscribe to query notificatoins.
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "IIS_SERVER\ASPNET"
4) Create a connectionStrings in the web.config
<connectionstrings>
<add name="myDbConnectionString" connectionstring="Data Source=localhost;Initial Catalog=MyDB;Integrated Security=True" providername="System.Data.SqlClient">
</connectionstrings>
5) Enable the website to be able to receive notifications.
protected void Application_Start(object sender, EventArgs e)
{
SqlDependency.Start(ConfigurationManager.ConnectionStrings["myDbConnectionString"].ConnectionString);
}
The following code also stops the listener:
protected void Application_End(object sender, EventArgs e)
{
SqlDependency.Stop(ConfigurationManager.ConnectionStrings["myDbConnectionString"].ConnectionString);
}
6) Sets up the cach dependency. Example code.
string tableName = query.Context.Mapping.GetTable(typeof(T)).TableName;
List
if (result == null)
{
using (SqlConnection cn = new SqlConnection(query.Context.Connection.ConnectionString))
{
cn.Open();
SqlCommand cmd = new SqlCommand(query.Context.GetCommand(query).CommandText, cn);
cmd.Notification = null;
cmd.NotificationAutoEnlist = true;
SqlCacheDependencyAdmin.EnableNotifications(query.Context.Connection.ConnectionString);
if (!SqlCacheDependencyAdmin.GetTablesEnabledForNotifications(query.Context.Connection.ConnectionString).Contains(tableName))
{
SqlCacheDependencyAdmin.EnableTableForNotifications(query.Context.Connection.ConnectionString, tableName);
}
SqlCacheDependency dependency = new SqlCacheDependency(cmd);
cmd.ExecuteNonQuery();
result = query.ToList();
HttpContext.Current.Cache.Insert(tableName, result, dependency);
}
}
Friday, November 5, 2010
Re-Associate the dbo to sa login after db restored
You could use the following SQL script to relink the dbo user of a db to login.
ALTER AUTHORIZATION ON DATABASE::[db name] TO [login name]
ALTER AUTHORIZATION ON DATABASE::[db name] TO [login name]
Wednesday, October 27, 2010
Error : System.Security.Cryptography.CryptographicException: The system cannot find the file specified
Change the Identity of the application pool to "NetworkService".
Tuesday, October 26, 2010
Required components of IIS7.0 for installing SQL Server 2005 on Windows 7
When you try to install SQL Server 2005 on Window 7, you may receive the following warning message for the IIS Feature Requirement item on the System Configuration Check page in the SQL Server 2005 Setup program:
Microsoft Internet Information Services (IIS) is either not installed or is disabled. IIS is required by some SQL Server features. Without IIS, some SQL Server features will not be available for installation. To install all SQL Server features, install IIS from Add or Remove Programs in Control Panel or enable the IIS service through the Control Panel if it is already installed, and then run SQL Server Setup again. For a list of features that depend on IIS, see Features Supported by Editions of SQL Server in Books Online.
This problem occurs because not all the IIS 7.0 components that SQL Server depends on are installed on the computer. The following table lists the affected components.
| Component | Folder |
| Static Content | Common HTTP Features |
| Default Document | Common HTTP Features |
| HTTP Redirection | Common HTTP Features |
| Directory Browsing | Common HTTP Features |
| ASP.Net | Application Development |
| ISAPI Extension | Application Development |
| ISAPI Filters | Application Development |
| Windows Authentication | Security |
| IIS Metabase | Management Tools |
| IIS 6 WMI | Management Tools |
Monday, March 29, 2010
Add Date Time stamp to the Windows Backup File Name
1. Use the Windows Backup GUI interface to create a backup job. Make sure to
specify that it should not run now but later.
2. Open the Task Scheduler, then open the backup job that you just created.
3. Mark & copy the whole command line.
4. Create the new batch file "MyBackup.bat"
5. Paste the backup command line into it.
6. Create some blank lines at the top of the file, then paste the following
code into the empty space.
@echo off
set MyDate=%date:/=_%_%time::=_%
ntbackup /.. /.. /.. /F d:\Backups\%MyDate%_File_Backup.bkf
7. Adjust the last line of the above code so that it matches your own
switches, then remove the original Windows Backup command line.
8. Use the Task Scheduler to create a task that will invoke
"MyBackup.bat" instead of your previous Windows Backup command
specify that it should not run now but later.
2. Open the Task Scheduler, then open the backup job that you just created.
3. Mark & copy the whole command line.
4. Create the new batch file "MyBackup.bat"
5. Paste the backup command line into it.
6. Create some blank lines at the top of the file, then paste the following
code into the empty space.
@echo off
set MyDate=%date:/=_%_%time::=_%
ntbackup /.. /.. /.. /F d:\Backups\%MyDate%_File_Backup.bkf
7. Adjust the last line of the above code so that it matches your own
switches, then remove the original Windows Backup command line.
8. Use the Task Scheduler to create a task that will invoke
"MyBackup.bat" instead of your previous Windows Backup command
Subscribe to:
Posts (Atom)