Disabling mobile redirection in SharePoint

For specify device

  1. Navigate to C:\inetpub\wwwroot\wss\VirtualDirectories\<SiteName>\App_Browsers
  2. Open file compat.browser with text editor, such as notepad
  3. Set <capability name=”isMobileDevice”                        value=”true” /> ‘s value to false for the userAgent matching the specify device that you would like to disable

Disable it for any device

  1. Open up web.config of the web application you looking to disable mobile redirection
  2. Added the following code snippet under the <system.web> section

Code snippet

<browserCaps>
<result type=”System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” /> <filter>isMobileDevice=false</filter>
</browserCaps>

When I click the “#” links, my browser automatically navigate to the top of the page

How to stop this?

  1. Uses “#_” instead of “#”, on some browser it just worked same as “_top”
  2. Use JavaScript to prevent this happening

Code snippet

For example if you have a link similar as below:

<a href=”#” class=”noAction”>Click me</a>

You can add the follow function to prevent the navigation:

$(“a.noAction”).click(function (e) {
//You can add additional function here for execution
e.preventDefault();
});

Telerik grid client side databinding with additional parameters

Scenario: I got a Telerik grid, required to use client side binding, and it provide the search ability to allow user to filter the grid result, how can I achieve this?

  1. Specify SelectMethod and Location under the DataBinding section
  2. Construct your method to Select your data

example: lookup a person with first name and last name

method signature: public List<Person> lookupPerson(string firstName, string lastName)

  1. Under the ClientSettings section, add the ClientEvents section in
  2. Add the onDataBinding event in the ClientEvents

Code snippet

<ClientSettings>
<ClientEvents OnDataBinding=”onPersonLookupDatabinding” />
<DataBinding SelectMethod=”lookupPerson” Location=”\Services\PersonLookup.svc”>
</DataBinding>
</ClientSettings>

So, there are no option to put in firstName and lastName ?!?! Oh wait! How come I didn’t mention about what is in the OnDataBinding Event, that is a client side JavaScript to allow you to add in all the custom parameter

Code snippet

function onPersonLookupDatabinding(sender, args) {
try {
var fn = $(“#txtFirstName”).val();
var ln = $(“#txtLastName”).val();
var methodArguments = args.get_methodArguments();
methodArguments.firstName = fn;
methodArguments.lastName = ln;
args.set_methodArguments(methodArguments);

}
catch (e) { }
}

This code read the user input, and passing into the method once it’s trying to call the web service request for data.

Script level upgrade for database ‘master’ failed because upgrade step ‘sqlagent100_msdb_upgrade.sql’

Resolution:

  1. Run regedit.exe
  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Setup
  3. Note down the path of SQLDataRoot, example: C:\Program Files\Microsoft SQL Server\MSSQL10_50.<SQLInstanceName>\MSSQL
  4. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.<SQLInstanceName>\MSSQLServer
  5. Verify if the path in DefaultData/DefaultLog looks similar to the path in SQLDataRoot
  6. DefaultData path should be similar as: C:\Program Files\Microsoft SQL Server\MSSQL10_50.<SQLInstanceName>\MSSQL\DATA
  7. DefaultLog path should be similar as: C:\Program Files\Microsoft SQL Server\MSSQL10_50.<SQLInstanceName>\MSSQL\Log
  8. Update these path if it’s invalid
  9. Restart the SQL Server Agent if necessary
  10. Problem solve

*Replace <SQLInstanceName> with your database instance name