Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.
  • SignalR

    Sharing Photos using SignalR

Search This Blog

Wednesday, 22 December 2010

Enable HTTPS for a Website using IIS

Testing your website with HTTPS might be one of the customer requirement. IIS allows you to create a dummy SSL that enables you to test the website using HTTPS. So Now to enable HTTPS follow below steps : [First lets create a certificate] 1. Goto IIS -> select the machine name 2. Now from features select "Server Certificates" 3. select...

Monday, 20 December 2010

Width 100% not working in IE compatibility mode

At time its so frustrating to get css styles work correctly in various circumstances such as cross-browser , IE compatibility mode etc. Recently notice an issue which is setting width 100% does not work in IE compatibility mode. The page display a input:select and input:textbox. It works fine in various places but was having issue at one particular table. After trying out various options and finally the option that worked...

Friday, 17 December 2010

Format date based on client time zone using javascript and ASP.NET AJAX

At time you might want to format date based on the client's browser configuration of language. If you are using ASP.NET AJAX then you will have the provision of using Sys namespace. Here is a sample snippet that show how to use it :- function ToClientFormat(ClientDate) { var dt = new Date(ClientDate); return dt.localeFormat(Sys.CultureInfo.CurrentCulture.dateTimeFormat.FullDateTimePattern); } Now this will display...

Monday, 13 December 2010

Change default browser running VS2010

At times we might have to test various things for cross-browser compatibility as part of validation. But if you want to default your visual studio to run the web application in a specific browser then follow these steps :- 1. Select the page you want to view in Visual Studio 2. Now right click on the file and select "Browse With", the following...

Thursday, 2 December 2010

Adding custom buttons to jquery datepicker showButtonPanel

JQuery solves most the requirements of date with the datepicker. Ok now, to add some extra functionality for datepicker such as providing some custom buttons in the buttonpanel after enabling it via "showButtonPanel : true". Here is a snippet of code that should do the trick:- $("#datepicker2").datepicker({ showButtonPanel: true, ...

Tuesday, 30 November 2010

CSS Cursor as pointer not working

Working on website development for quite a bit now. Just had come across a style sheet issue in a web page. With the following style sheet:- .linkbtn { cursor:pointer; text-decoration: underline; } What would anyone expect for this simple html as : Find Certainly to show a different cursor when user hovers on the text. Yes it works on IE !! but not on firefox & chrome. Ok lets debug and see what's happening, the...

Tuesday, 23 November 2010

Filename validation in VC++

Validating files names should not be very difficult, Is it? . Yes, it is if you trying to do in VC++. Here is a small snippet of code that helps :- CString fileName = "test:11"; for (int i = 0; i < fileName.GetLength(); i++) { if (!(PathGetCharType(fileName[i]) & GCT_LFNCHAR)) { bValid = FALSE; break; } } Do not forget to include "Shlwapi.h" “If people never did silly things, nothing intelligent would ever get...

Friday, 12 November 2010

Display progress bar inside JQGrid

Considered displaying a JQuery progress bar inside JQGrid. Here is a small example how this can be achieved. Consider the json data returned by a web service is as follows:- { "page":"1", "total":1, "records":"5", "rows":[ {"id":"1","cell":["1","Scott","US","10"]}, {"id":"2","cell":["2","Charles","UK","20"]}, {"id":"3","cell":["3","Dan","Astralia","30"]}, {"id":"4","cell":["4","Chris","Canada","25"]}, {"id":"5","cell":["5","Paul","China","80"]}...

Thursday, 11 November 2010

Display Icons in JQGrid

JQGrid is one of the best plug-in to display data as grid. Using JQGrid is very simple and easy to use. In this article we will look into displaying icons in JQGrid. Consider the following code that makes an ajax call: jQuery("#grid").jqGrid({ url:'GetDetails.asmx?team=All', datatype: "json", colNames:['ID','Team', 'Name', 'Designation'], ...

Wednesday, 10 November 2010

Getting 401 Unauthorized error consistently with jquery call to webmethod

ASP.NET with JQuery provides a flexible method of making ajax calls via a webservice. Making an ajax call using JQuery API would be as simple as $.ajax({ url: "TestService.asmx/Test", data: "{'JSONData':'" + JSON.stringify(id) + "'}", // For empty input data use "{}", dataType: "json", type: "POST", contentType: "application/json", complete: function (jsondata,...

Monday, 1 November 2010

Unable to debug published ASP.NET website

Have been struggling to debug ASP.NET application but had no success what so ever. For time being drop the thought of publishing the website using Visual Studio (2005/2008/2010). Lets start with the Manual process :- 1. Create a folder under C:\inetpub\wwwroot for eg: MyWebsite 2. Goto IIS, right click on Default Website -> Select Add application 3. Specify Alias, select location, select the required application pool and...

Server.GetLastError() giving error as 'File does not exist.'

In general Server.GetLastError() is the more used way of getting the last generated error. But have you ever got an error message and does not exactly know what went wrong. Such as the error below:- {"File does not exist."} which has actually occurred in the source code at protected void Application_Error(Object sender, EventArgs e) { HttpException Error = Server.GetLastError() as HttpException; Session["Error"] = Error; ...

Tuesday, 26 October 2010

Invalid postback or callback argument on Post back

One of the most familiar error while working on ASP.NET ajax update panels is :- 505|error|500|Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally...

Friday, 22 October 2010

Updating contents of IFrame using JQuery

Now a new challenge !!! Updating the contents of iframe using jquery, sounds easy as jquery by default provides the option as follows:- $("#iframe1").contents() Now that you are able to retrieve the contents, updating data is quite easy. for eg:- $("#iframe1").contents().find("#mydiv").css("background-color","red"); In order to update the contents of #mydiv in iframe1 first iframe1 should be loaded with another page. Its...

Tuesday, 19 October 2010

LoadViewState not firing on post back in custom control

Recently started developing a custom control with complex data handling. So far so good. Now lets try adding view state content to the custom control. Oh no! its not working. What's wrong is there a design flaw or some thing overlooked. Have been struggling for quite a decent number of hours to fix this. After revisiting the code and looking into event life cycle for ASP.NET . Ha ha ... yes overlooked a basic detail but have...

Tuesday, 28 September 2010

Displaying jquery progressbar with ajax call on a modal dialog

Working on a website of which one of the requirement is to display a progress bar while completing an ajax call. Yes this is a simple and straight forward requirement and lets look to the details of how to implement it. 1. Create a web service 2. Using jQuery do the following :- 2.1 Show modal dialog box 2.2 show progress bar on the modal dialog box as 0% completed 2.3 Make an ajax call (estimated time of 5 mins) 3. While ajax...

Monday, 13 September 2010

Unable to uninstall: assembly is required by one or more applications

Un-installing from GAC can be done in various methods such as :- 1. Using windows explorer goto C:\Windows\assembly 2. Locate the assembly 3. use delete button (or) right click -> Uninstall Alternate method is 1. Goto Visual Studio Command prompt 2. type gacutil /u Me.Test.Assembly If both of these doesn't work then the assembly is used by some of the component. Ok now that you have known that assembly has a dependency...

Tuesday, 7 September 2010

Sys._ScriptLoader is null or not an object

Working on a website and have got following error :- "Sys._ScriptLoader is null or not an object" Have been using the methodology of downloading multiple javascript files after the visible content. When combine script is enabled the above error is displayed. The reason for this error being the definition of the following function :- $type = Sys._ScriptLoader = function _ScriptLoader() { has not been loaded so need to exclude...

Thursday, 2 September 2010

Unable to get readonly textbox value from server side ASP.NET

Unable to get textbox value from server side is not a bug in ASP.NET but is a feature. Textbox value cannot be read from code behind if it is readonly as per MSDN .But the value can be read using the following syntax : txtFirstName.Text = Request[txtFirstName.UniqueID]; “The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.”– Stephen Hawk...

Thursday, 26 August 2010

"Response.Redirect" or "Server.Transfer" raises ThreadAbortException

Both methods calls Response.End method internally ends the page execution. Then executes Application_EndRequest event in the application's event pipeline and hence the line of code that follows Response.End is not executed which is raising the exception.To overcome this just disable Response.End in both methods as follows :-Server.Transfer(Request.FilePath);Response.Redirect(Request.FilePath);toServer.Execute(Request.FilePath);Response.Redirect(Request.FilePath,false);Computers...

Monday, 16 August 2010

Ajax Control Toolkit 3.5 : The script 'Timer.js' has been referenced multiple times.

Developed a website using Fast ASP.NET Web page loading by downloading multiple JavaScripts after visible content and in batch using .NET 2.0, Ajax 1.0 and Ajax Control toolkit. After migrated to .NET 3.5 getting the following error:-"Microsoft JScript runtime error: Sys.InvalidOperationException: The script 'Timer.js' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode...

Migrating Web application from .NET 2.0 with Ajax 1.0 to .NET 3.5

Migrating a web application developed in .NET 2.0, Ajax 1.0 and Ajax control tool kit 2005 to .NET 3.5 is quite simple following below steps :-1. Open the solution using Visual Studio 2008 (this is migrate automatically all the projects in the solution and will update the references accordingly.2. Remove the reference to Ajax control toolkit 2.0 and add the new reference to ajax control toolkit 3.5.3. Since Ajax control toolkit...

Tuesday, 6 July 2010

.NET VC++ Compilation in x64

Compiling VC++ projects for x64 build might give following errors :-eg:-fatal error LNK1181: cannot open input file 'version.lib'So as to fix the issues library directories should point to 64bit libraries and also 64bit SDK needs to be installed.To install 64-bit SDK :-http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en“The more you know, the more you realize you know...

Saturday, 3 July 2010

Unable to get updated project from source control

At times while getting project from source control the following message is displayed :-Follow the steps below :1. Source Control - Get specific version 2. select option "Force get of file versions already in workspace"3. select "Get"This should override your files, but if the files are not retrieved using this method then the issue is with...

Friday, 2 July 2010

Type Sys.UI._Timer has already been registered

Having a webpage with multiple update panels and multiple timers might be bit annoying when you the below error:-Sys.InvalidOperationException: Type Sys.UI._Timer has already been registeredIf scripts are loaded using an user control update attributes for asp:ScriptManager as follows ...

VS 2005 - VC++ Include directories invalid for $(VCInstallDir)

At times if Visual studio 2005 doesn't recognize $(VCInstallDir) paths, static paths might be a better option. select the include & library directories manually as below :andThe computer was born to solve problems that did not exist before. – Bill Ga...

Thursday, 1 July 2010

Displaying elapsed time with multiple asp:timer's on a page

In cases where a web page consists of multiple asp:updatepanel and multiple asp:timer controls. Each update panel getting refreshed at specific timer intervals (different timings), instead of display stale data before the refresh its good to display the user with elapsed time for an update panel. This gives users feel of live data and user...

Corrupted Visual Studio 2005 settings for VC++ directories

To reset to default setting of VC++ directories follow below steps :-1. Tools -> Import and Export settingsFig 12. select "Export selected environment settings" and select "Next"3. select "All settings" and select "Next" 4. select "Finish"This should give the default settings and if any thirdparty libraries are used manually add the include...

Wednesday, 30 June 2010

ASP.NET - Handling Impersonation failures of web.config

Impersonation is possible in number of ways. One of the most common method is to to store encrypted user credentials in registry. Configure web.config to pickup the credentials for authentication as below :-Use encrypted attributes in the configuration file web.configSo far so good, now consider if the user credentials have failed the following...

Monday, 28 June 2010

Issue with user control getting loaded with asp:timer

I have been working on a web application which requires loading a user control using asp:timer control. Application is completely based on widgets.The default page has number of widgets that are loaded dynamically at runtime and all widgets has the facility to enable or disable timer.All events were working fine except "User Widget" not firing any events. Here is how the code is :-WidgetTimer.ascx UserControl.ascx<%@...
Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers