Archive for the ‘ASP.NET’ Category

Set focus on textbox

November 16, 2016 Leave a comment

Using Jquery

$(function() {

Using Javascript
window.onload = function() {

<input type="text" name="fname" autofocus>
Categories: ASP.NET

HEX Color Code Converter / Chooser

March 29, 2016 Leave a comment

null oid not supported Telerik OpenAccess

February 18, 2016 Leave a comment

Error : Null oid not supported 

Stack trace
[ArgumentException: null oid not supported]
at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
at OpenAccessRuntime.ExceptionWrapper.Throw()
at OpenAccessRuntime.common.StatesReturned.addImp(OID oid, State state, Boolean directFlag)
at OpenAccessRuntime.common.StatesReturned.add(OID key, State value_Renamed)
at OpenAccessRuntime.Relational.RelationalQueryResult.fetchManagedTypes(ApplicationContext context, Int32 fetchAmount, QueryResultContainer results)
at OpenAccessRuntime.Relational.RelationalQueryResult.fetchNextResultBatch(ApplicationContext context, QueryResultContainer results, Int32 fetchAmount)


Reason :

Its because of the there is an object where the id (Primary key) field contains a null.

if there is an entity having two fields set as Identity field. and one of the fields is purely unique (set a Primary Key in DB)  where as the other one is not so this kind of error raised by Telerik ORM.


Telerik ORM is not supporting  ‘null’ values as part of the identity. Each member that makes up the identity of a class must have a non-null value. There is no workaround either to this problem.

Hope this help !

Order by Date Descending issue (Linq)

February 12, 2016 Leave a comment

Issue :

 Dim list As List(Of Eventlist) = (From d In EventList
 Order By d.Status Descending, d.StartDate Descending, 
 Select d).ToList()

It gives me the date ordered by month and day, but doesn’t take year into consideration. for example:


Needs to be more like:


Solution :

 Dim list As List(Of Eventlist) = (From d In EventList
 Order By d.Status Descending, Year(d.StartDate) Descending, Month(d.StartDate) Descending, Day(d.StartDate) Descending
 Select d).ToList()

Hope it helps !

Opening project in Visual Studio fails due to nuget.targets not found error

January 22, 2016 Leave a comment

I try to open project in Visual Studio and get all these nuget errors:

The imported project "C:\Twitterizer\.nuget\nuget.targets" was not found. 
Confirm that the path in the <Import> declaration is correct, and that the file 
exists on disk.

Follow the following steps to resolve above error
  1. Install Nuget.
  2. Right click on the solution and select “Enable NuGet Package Restore”.
  3. Click Ok on the warning.
  4. Close and re-open the solution.
Hope this help!

Add Days to Javascript Date Object

November 19, 2015 Leave a comment

To add days to javascript date object use following syntax

var dayOffset = 20;

var millisecondOffset = dayOffset * 24 * 60 * 60 * 1000;

december.setTime(december.getTime() + millisecondOffset);

Bootstrap and datepicker

November 17, 2015 Leave a comment