Technical

Adding the specified count to the semaphore would cause it to exceed its maximum count

I got this unusual exception while working on an ASP.NET project:"Adding the specified count to the semaphore would cause it to exceed its maximum count error".I thought it is something related to SQL Server Database Connection String.After using Query Profiler I was able to run SQL queries directly without any...

How to disable some context menu items on Telerik TreeView

There is an event named "OnClientContextMenuShowing" for Rad Treeview that calls javascipt function and passes 2 arguments "sender, args".The Args parameter contains The current selected TreeNode and Context Menu Items.You can enable or disable any Context menu item based on any attributes for the Current Selected Tree Node.Here is a...

How to get year, month and say out of SQL Date in SQL Server

Let is say that we have the following Date 2007-04-05 10:13:14.109 and we want to get Year, Month and Day out of this date.There is a function named DATEPART() that can be used to archive this.DECLARE @MyDate AS DATETIME SET @MyDate = '2007-04-05 10:13:14.109' SELECT DATEPART(DAY, @MyDate) AS MyDay, DATEPART(MONTH, @MyDate) AS MyMonth, DATEPART(YEAR,...

How to avoid Uncaught ReferenceError: $ is not defined in jQuery

Sometimes while developing an existing Web Application, I wanted to use jQuery function and I got this error "Uncaught ReferenceError: $ is not defined".There are some reasons causing it and ways to avoid them:Make sure the references to the jQuery scripts is loading first, but them in the head of master page or...

How to programmatically create iFrame in ASP.NET

Sometimes we may need to create iFrames and use it within GridView or Repeater, and we want to pass some values to it.This example will show you how to create iFrame Programmatically and add it to a PlaceHolder.HtmlGenericControl myFrame = new HtmlGenericControl();myFrame.TagName = "IFRAME"; myFrame.Attributes["src"] = "MyPagePath"; myFrame.Attributes["id"] = "myFrame1"; myFrame.Attributes["name"] = "myFrame1"; myFrame.Attributes["width"] =...

Operation is not valid due to the current state of the object exception in ASP.NET

I got this error when I tried to save a Page with lots of form fields to SQL Server Database.The default max number of form fields that can be post is 1000.In order to solve this error add this Line to your Web.Config File:<appSettings> <add key="aspnet:MaxHttpCollectionKeys" value="10000" /> </appSettings>

How to convert SqlDataSource to DataTable and DataView in C#.NET

Sometimes I want to use SqlDataSource  returned data programmatically and here is how you can do this,In this example I will assume that SqlDataSource  ID is SqlDataSource1 which is the default ID:DataSourceSelectArguments args = new DataSourceSelectArguments(); DataView view = SqlDataSource1.Select(args) as DataView; DataTable dt = view.ToTable();