Loading ...

ASP.NET Blogs | CodeAsp.Net

Who is online?  0 guests and 0 members
home  »  blogs

Communifire Blogs

Blogs: Most Recent postings

Raghav Khunger

jQuery Tools Tabs: Tab index lost on postback

yesterday by Raghav Khunger · 0 · 39

A person on the forums was struggling with jQuery tools tabs index issue on postback. On clicking the tabs and doing some postback the selected tab index was getting lost. Below is the solution on how to retaing the previous selected index which was there before postback. Complete Source: <%@ Page Language="C#" %> <script type="text/javascript"> </script> <%@ Import ...

Raghav Khunger

jQuery Tools Tabs: Set initial selected index by default

yesterday by Raghav Khunger · 0 · 22

I was working with jQuery tools tabs today and I had to set the initial index of tab selected by default. The solution is to set initialindex property in the options. Source: $("ul.tabs").tabs("div.panes > div", { initialIndex: 1 }) ; Complete code to test above: <html> <head> <title>jQuery Tools standalone demo</title> <script src="http://cdn.jquerytools.or...

Raghav Khunger

ASP.NET: Get formauthentication cookie and get the data present in it

3 days ago by Raghav Khunger · 1 · 65

A person asked me today how to get form authentication cookie and get the data present in it. I decided to write a short blog on it. Formauthentication cookie is saved with the name which we can get via FormsAuthentication.FormsCookieName property. The key here is to get the cookie via this name and Decrypt the data present in the cookie to get the data. Below is the code: HttpCookie aut...

Raghav Khunger

ASP.NET: Form authentication timeout in web.config overriding the manual ticket timeout

13 days ago by Raghav Khunger · 0 · 173

While working with one of the sample application I noticed that form authentication timeout in web.config was overriding the manual ticket's (which we created via code) timeout. Below is the code which was written in the application: var ticket = new FormsAuthenticationTicket(1, "UserName", DateTime.Now, DateTime.Now.AddMinutes(1), true, "Password"); string ticketValue = FormsAuthenticat...

Raghav Khunger

jQuery: Set cursor position in textbox

15 days ago by Raghav Khunger · 0 · 327

In this blog I will show how to select a range of characters in textbox with jquery. In my demo I have used one textbox and one button. On click of button arange of characters in textbox will be selected. Below is the sample code: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="http://ajax.go...

Raghav Khunger

Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0...

15 days ago by Raghav Khunger · 0 · 192

Recently we moved from Newtonsoft.Json 3.5 to 4.0 version. We noticed that we were getting Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0.. while working with Twitter authentication which we were using in our application. The third party dll which we were using for Twitter authentication was demanding Newstonsoft.Json 3.5 internally. So we had two ways to solve this ei...

Tim Eisenhauer

jQuery Mobile Login Dialog Box

4/23/2012 by Tim Eisenhauer · 22 · 63240

PRODUCT SPOTLIGHT This is an addition to my series of blog posts on jQuery Mobile: jQuery Mobile Introduction & Tips To Get Started jQuery Mobile Getting Started So, if you've been following my posts so far, you should have a good overview of jQuery Mobile, it's documentation, how to set up your Visual Studio environment, and the structure of a jQuery Mobile page. Today, I'm going to...

SONAL KHAIRE

message icon with count disply.

4/23/2012 by SONAL KHAIRE · 0 · 199

add message icon with count displayed on it as new messages come into my gridview. i want to do this in asp.net for web application.

Raghav Khunger

Remove css class in code behind

4/10/2012 by Raghav Khunger · 0 · 286

In this blog I will show how to remove a css class from an asp.net control from codebehind. It can be done just by replacing the particular class in CSSClass property value of that control with empty string. Below is the complete code: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> .bold { font-weigh...

Raghav Khunger

How to check if a querystring key is present via javascript

4/10/2012 by Raghav Khunger · 0 · 255

Following is the JavaScript code to check whether a key is present in querystring or not: <script type="text/javascript"> var queryKeyPresent = function(key) { var url = window.location.href; if (url.indexOf('?' + key + '=') != -1) { return true; } else if (url.indexOf('&' + key + '=') != -1) { return true; } return false; }; </script> Usage: var check = queryKeyPresent('...

Raghav Khunger

SQL: List of stored procedures modified in last n Days

2/21/2012 by Raghav Khunger · 0 · 719

Below is the script to get list of stored procedures in last n days. SELECT [name] FROM sys.objects WHERE [type] = 'P' AND DATEDIFF(dd, [modify_date], GETDATE()) < 10 Above 10 is the number of days. You can change that value according to your need. Below is the output of my screen after running the above script on AdventureWorks DB:

Raghav Khunger

2008R2: AdventureWorks Sample database missing, from where to download?

2/21/2012 by Raghav Khunger · 0 · 632

One of my programmers just installed SQL Server 2008 R2 and found the sample database AdventureWorks missing. He was struggling for precise information on how to download the sample database. I would like to share the link from where you can find the AdventureWorks for SQL Server 2008 R2. Download Link AdventureWorks 2008R2 SR1 After installing the sample db, the screenshot:

Raghav Khunger

SQL: Get created and modified date of a stored procedure

2/21/2012 by Raghav Khunger · 1 · 574

Today I was working with some Stored procedures and I was in a need where I need to know the created and modified date of stored a procedure. Following is the script which I would like to share which I used to get the desired result: GO SELECT name, create_date, modify_date FROM sys.objects WHERE type = 'P' --AND name = 'sp_dts_getfolder' GO Output at my screen:

Raghav Khunger

ASP.NET: Enable Gzip compression via web config

2/15/2012 by Raghav Khunger · 0 · 1125

Gzip can lead your applications to perform faster since the sizes of the files delivered to client is reduced via gzip algorithm which leads to saving of bandwidth. In ASP.NET applications you can do it via some settings web config. Below is the code which you can put in your web config in system.webServer tag <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compre...

Raghav Khunger

CSS: Vertical align text next to image

2/15/2012 by Raghav Khunger · 0 · 735

Today I was working with an image and some text which I had to put next to it. The issue which was coming was to vertical align the text to middle of image. <div> <img style="height:50px" src="http://jsfiddle.net/img/logo.png" /> <span style="vertical-align:middle">:( Not coming in the middle.</span> </div> Here is the code which was not working http://jsfid...

websoftCreation Websoftcreation

Announce training of asp.net from 16 Jan,2012 for MCA and Btech students

2/8/2012 by websoftCreation Websoftcreation · 0 · 402

Hi, Websoftcreation started new batch of asp.net and PHP for MCA,M.Sc,B.tech from 16 Jan,2012 at Jaipur centre. You can take part in this training by just post request on websoftcreation.co.in website. Regards Websoftcreation,Jaipur

Vincent Maverick  Durano

My Last Post

1/25/2012 by Vincent Maverick Durano · 0 · 621

Well this is really not my last post but I will not be blogging anymore here to avoid cross posting of contents. Instead you can visit my official blog at: Vinz' Blog Note: Stop blogging here doesn't mean I will stop contributing to the codeasp community, of course I will still be moderating posts and participating in the forums and try my best to answer to questions to the best that I c...

Vivek Thakur

Application Pool Failure: Rapid Fail Protection

12/15/2011 by Vivek Thakur · 0 · 1008

We were stuck with a weird issue. Our ASP.NET web app was crashing for some reason and the event log only displayed Stackoverflow exception. We want to narrow down the reason for the crash and since stackoverflow exceptions are easy to debug (even crash dumps didnt give help much), we wanted our app to shut down the moment first time this excepton occured. Application pool recycles itsel...

Vivek Thakur

Sql Server Timeout expired. The timeout period elapsed prior to completion of the operation

12/9/2011 by Vivek Thakur · 0 · 875

The default SqlCommand timeout is 30 seconds, so you might get this error while executing a lengthy Sql operation (like creating a DB and its schema via C# code): Error : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. In order to fix this, just increase the command time out as follows: myCommand.CommandTimeout = 120; // 2...

Vivek Thakur

Microsoft.SqlServer.SMO and Microsoft.SqlServer.Management assemblies issue

12/2/2011 by Vivek Thakur · 0 · 986

We had created a Visual Studio project in C# to create SQL Server 2005 database via C# code. We were referencing these assemblies: Microsoft.SqlServer.Management.Sdk.Sfc.dll Microsoft.SqlServer.Smo.dll Microsoft.SqlServer.ConnectionInfo.dll We also added this DLL but did not reference it as we realized it was required internally by the above assemblies: Microsoft.SqlServer.SqlClrProvider...

Hajan Selmani

Speaking at Macedonian Code Camp 2011

11/24/2011 by Hajan Selmani · 0 · 758

This year again, Macedonian .NET User Group is organizing the biggest event in balkans... CODE CAMP 2011 Event will be held at 26th of November at FON University, Skopje, Macedonia. There are 24 speakers, 7 MVPs, 25 sessions and 5 tracks. In the first 15 hours we got 600 registered attendees... and we expect this number to reach 1000 by the end of registrations. I will be speaking on top...

Raghav Khunger

C#: Casting with ENUM

11/22/2011 by Raghav Khunger · 0 · 670

In this blog I will show how to cast an int to enum, enum to int and string to enum. Let's make a sample enum: MyEnum.cs namespace Sample.Console { public enum MyEnum { Item1 = 1, Item2 = 2, Item3 = 3, Item4 = 4, Item5 = 5, } } 1. Int to Enum int integerValue = 2; MyEnum myenum = (MyEnum)integerValue; //Output: item2 2. Enum to Int MyEnum myenum = MyEnum.Item3; int integerValue = (int)my...

Raghav Khunger

C#: How to get the end of the day

11/22/2011 by Raghav Khunger · 0 · 623

Yeterday I had a requirement where I needed to find the end of day in datetime. I decided to make extension on datetime to achieve it. Below is the sample code: DateTimeExtension.cs: #region Using Directives using System; #endregion namespace Sample.Console { public static class DateTimeExtension { public static DateTime GetEndOfDay(this DateTime datetime) { return datetime.AddDays(1).Ad...

Raghav Khunger

Visual Studio: The breakpoint will not currently be hit. no symbols have been loaded for this document

11/21/2011 by Raghav Khunger · 0 · 697

This message irritates me when I encounter this while debugging my code. I am writing the solution below by which this can be avoided. Step 1: Go to Build >> Configuration Manager and select "Debug " as the option for Active solution configuration. Step 2 : Go to your web project properties >> Build >> General Uncheck the Optimized code checkbox. Step 3: Clean and Rebui...

Raghav Khunger

ASP.NET: Checkboxlist to string list

11/20/2011 by Raghav Khunger · 0 · 888

In this blog I will show how to get selected values of checkboxlist in ASP.NET. The selected value can be get by applying foreach iterator on checkboxlist items and then we can find the selected items. I decided to make an extension to do the same. Below is the code for it: Control Extensions: using System.Collections.ObjectModel; using System.Linq; using System.Web.UI.WebControls; names...

Top Blog Contributors

Product Spotlight

ASP.NET Hosting Spotlight

Join CodeAsp.Net for FREE Today!

It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.

enter your email address:

 

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?