Dynamically set control visibility inside ItemTemplate’s of GridView using Bind Expression September 1, 2011Posted by Abhijit Jana in .NET 4.0, ASP.NET, C#.
Tags: ASP.Net, Beginners, Binding, BindingExpression, GridView, ItemTemplates
GridView TemplateField allow us to specify custom controls, multiple fields and Html using a custom template. TemplateField allows us to define a completely customized template for GridView Column. We can bind the data with in template control using binding expression. ASP.NET provides number of ways to take control over the template control. In this post I am going to discuss how we can set template control visibility based on certain condition which depends on the data source data. For example, imagine you have a link button within template field. You want to set visibility if that control based on the some value of your data source.
Not able to view all the running Worker Process in Visual Studio – Process Attach Window – Resolution August 18, 2011Posted by Abhijit Jana in ASP.NET, Debugging, IIS, Visual Studio.
Tags: Beginners, Debugging, IIS, IIS 7.0, Process Attach, WorkerProcess
1 comment so far
This might be a very simple and known to most of us, but I found it as a query in a discussion forum of one of my article “Debug your ASP.NET Application while Hosted on IIS” which was published at Code Project . Question was regarding list of worker processes in “Process Attach window” of Visual studio. Though all the sites are running properly on IIS, still he was not able to view any processes in “Attach Process Window” while trying to attach a process from Visual Studio.
Tags: .NET, ASP.Net, ASP.NET Internals, IntelliTrace, page life cycle, Visual Studio 2010 Ultimate
Understanding the ASP.NET Page Life Cycle is an essential knowledge for developing ASP.NET Web Application. When request come from client to server there are many operations performed in backend before sending response to the client. When client request for some information from a web server, request first reaches to HTTP.SYS, which is the kernel level of IIS. HTTP.SYS then send the request to respective Application Pool. Application Pool then forward the request to worker process to load the ISAPI Extension which will create an HTTPRuntime Object to Process the request via HTTPModule and HTTPHanlder. Once request passed through the HTPP Pipeline, ASP.NET Page Life Cycle Start. You will find several articles that describes the What is ASP.NET Page lifecycle, what are the different events fired during page lifecycle. This post is something different, I will show you how you can see the each and individual Page life cycle events using IntelliTrace
Tags: ASP.Net, ASP.NET Internals, Difference between Session.Clear Vs Session.RemoveAll, Session, Session.Clear Vs Session.RemoveAll, state Management
ASP.NET Session is one of most common state management technique for any ASP.NET Web Application. If you want to do a quick refresh or want to know some thing more, please go ahead and read one of my article “Exploring Session in ASP.NET” published at Code Project. ASP.NET provides several methods for removing Session. But which methods needs to use at what time, is a must known stuff for asp.net developer. In this post I going to talk about bit internals of removing session variables from applications. Why this Post ? I found many people having some confusion around removing / clearing the session variable ( Mainly with Session.Clear(), Session.RemoveAll(), Session.Abandon()) , which method needs to use, what is the purpose of particular method etc.
Tags: ASP.Net, Bind, C#, Enum, LINQ, ListControls
In this post I am going to explain how we can bind a Enum with ASP.NET List Controls. These comprise of four different types of control, CheckBoxList, DropDownList, ListBox and RadioButtonList. This is one of the common requirements during development to bind a Enum with List Control and challenge is when we need to bind the both text and value.
Let’s consider we have the blow Enum. Now I am going to bind it with all the above mentioned type List Controls.
Well, One of the easiest way that we can implement is by Enum.GetNames(Type enumType)which retrieves the name list of enumberation and Enum.GetValues(Type enumType), which returns the list of values for each names .
Tags: ASP.Net, codeproject, jQuery, jQuery Context Sensitive Help
In this blog post I am going to explain how we can create a simple Context Sensitive Help for ASP.NET Controls using jQuery. This has been done based on the of a controls in a ASP.NET Web Form. On control selection / focus jQuery Loads a HTML Content from a remote file, then it’s apply the filter based on the control id and inject the filtered content into a predefined placeholder with in the DOM Hierarchy.
Run ASP.NET Web Application from Command Prompt February 28, 2011Posted by Abhijit Jana in ASP.NET, Tips and Tricks, Visual Studio.
Tags: ASP.Net, cmd, codeproject
Visual Studio has its own integrated ASP.NET Runtime engine, which helps to run any ASP.NET web application with in Visual Studio. While running application from Visual Studio, you must have seen a popup notification in System Tray (As shown in below image) , which is notification of ASP.NET Development Server.
This ASP.NET Development Server is nothing but a executable file (WebDev.WebServer) which used by Visual Studio to execute you web application when it’s running in the context of Visual Studio. You can find the executable file at <\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0> . This folder contain two different executable
WebDev.WebServer20 is targeted to CLR 2.0, which means all the ASP.NET Application which are targeted till FW .NET 3.5 will be taking care by WebDev.WebServer20.EXE and WebDev.WebServer40.EXE for ASP.NET 4.0 based application.
Now, let’s see how we can use these executable to run an ASP.NET 4.0 Application with out using Visual Studio.
How to make ViewState secure in ASP.NET ? January 26, 2011Posted by Abhijit Jana in ASP.NET, Tips and Tricks.
Tags: ASP.Net, codeproject, How To
The ASP.NET ViewState is a client side state management. ViewState is stored in hidden field with ID named __VIEWSTATE. Typically, stored ViewState information looks as below:
Now let us look at the value. It looks likes an encrypted string. This is nothing but Base64 Encoded string and it is not an encrypted string. So it can be easily decoded.
The main reasons for making it Base64 encoding are as follows:
1. Base64 makes a string suitable for HTTP transfer
2. It makes it a little harder to read .
But people often get confused that this is an encrypted string.
When we can use HttpContext.Current.Items to stores data in ASP.NET? January 14, 2011Posted by Abhijit Jana in ASP.NET, ASP.NET 4.0, Tips and Tricks, Visual Studio.
Tags: ASP.Net, codeproject, HTTPContext, Session
To answer this question In a single statement, you can use HttpContext.Current.Items for very short term storage. By Short term storage means, this data is valid for a single HTTP Request. There are many confusion around regarding storing data in HttpContext.Current.Items and storing data in Session variable. In this blog post I am going to describe what are the different scenarios where we can use HttpContext.Current.Items and what is the exact difference with session variable.
Items collections of HttpContext is and IDictionary key-value collections and that are shared across a single HTTPRequest. Yes, HttpContext.Current.Items valid for a single HTTPRequest. Once after processing, server information is sent back to the browser, the variables that were set in the Items collection will lost. Where as for Session Variable, information valid for multiple request as this is user specific. The session variable only expires either on Session Time Out or explicitly clear the values.
What is the difference between Web Farm and Web Garden ? October 1, 2010Posted by Abhijit Jana in ASP.NET, ASP.NET 4.0, IIS.
Tags: ASP.Net, Beginners, codeproject, Difference between Web Farm and Web Garden, IIS, Web Farm Vs Web Garden
I have been asked this question many times by different readers of my blog. They wanted to know about the fundamentals of Web Farms and Web Garden . In this blog post I am going to explain the what is the exact difference between web farm and web garden, what are the advantages and disadvantages of using them. I have also described how to create web garden in different version of IIS.
Visual Studio having its own integrated ASP.NET engine which is used to run the ASP.NET Web application from Visual Studio. ASP.NET Development Server is responsible for execute all the request and response from client. Now after the end of development, when you want to host the site on some server to allow other peoples to access, concept of web servers comes in between. A web server is responsible for provide the response for all the requests that are coming from clients. Below diagram showing the typical deployment structure of a ASP.NET Web application with a single IIS.
Clients request for resources and IIS Process the request and send back to clients. If you want to know more details on How IIS Process the request please read one of my article over “How IIS Process ASP.NET Request ?” .
Web Farm :
This is the case, where you have only one web server and multiple clients requesting for the resources from the same server. But when there is huge numbers of incoming traffic for your web sites, one standalone server is not sufficient to process the request. You may need to use multiple server to host the application and divide the traffic among them. This is called “Web Farm” . So when you are hosting your single web site on multiple web server over load balancer called “Web Farm”. Below diagram showing the over all representation of Web Farms.
How to remove Hyperlink from ASP.NET TreeView Control Nodes ? September 24, 2010Posted by Abhijit Jana in ASP.NET, ASP.NET 4.0, Tips and Tricks.
Tags: ASP.Net, Beginners, codeproject, Tips and Tricks, Tree View SelectionAction
ASP.NET Tree view control rendered as HTML Table – TR –TD elements. Each of the node are been represented as hyperlinks. Some times you may not want that fields as hyperlink and you want to be those nodes should be represent as static text. Many of the developer did the same using font style or css style change of the node, but it can be done very easily. In this small blog post I am going to describe how you can represent a tree view node as simple text instead of hyperlink.
This can be done very easily using Tree Nodes, SelectionAction properties. SelectionAction having 4 different values, they are.
Select is the default option which marked node as hyperlinked and on selection of the node, it raised SelectedNodeChanged event. For Expand Option, TreeNodeExpanded event will be raised while expanding the node. “SelectExpand” raised both the SelectedNodeChanged and TreeNodeExpanded events. Now if you don’t want to make the node as simple text, just change the SelectionAction properties to “None”.
Use “Obsolete” attributes to indicate Obsolete Methods September 3, 2010Posted by Abhijit Jana in ASP.NET, C#, General, Tips and Tricks, Visual Studio.
Tags: Beginners, codeproject, How To, Obsolete, Tips and Tricks, Visual Studio
In this post I have explained how you can use Obsolete attributes to mark some methods which are not no longer in used or may be remove in future release of the class. During the development cycle we may need to change the name or declaration of certain methods which may be using by some other developers. In this case if you changed the name or declaration of that method, application may crash in different point of times as it’s being used by other developer in the application. In this case you can use System.ObsoleteAttributes class to generate compiler warning and indicate the method as Obsolete.
Set source view as default view for Web Pages in Visual Studio August 13, 2010Posted by Abhijit Jana in ASP.NET, General.
Tags: ASP.Net, Beginners, How To, Tips and Tricks, Visual Studio
By default in Visual Studio for any web pages design view is the default view. Which may causes some time to load if your page is having many controls . So If you want to change the default view from Design View to Source View, just perform the following steps.
Go to “Tools” > “Options” and Navigate to “HTML Designer” Section.