TFS steps to Force an Undo Check out (Force Check in)

visual studio Team Foundation ServerWhile working in the environment of Visual Studio with Team Foundation Server (TFS) with multiple check out Disabled. you might come across a scenario where your team members have checked out a files and they are not present to check in for you to be able to use those files. This is why TFS has an administrative command prompt commands, this will only work if you have administrative access on the TFS project, and should not be done from the same computer that checked out the file. Continue reading “TFS steps to Force an Undo Check out (Force Check in)” ItemCommand asynchronous postback in an UpdatePanel

In Simply adding an UpdatePanel to a ListView with an ItemCommand won’t do the trick of asynchronous postback. The Command should be registered to the script manager Dynamically.

To achieve an asynchronous postback you have to do the following trick front end Code Example

<asp:UpdatePanel runat=”server” ID=”upContent”>
<asp:ListView runat=”server” ID=”lvContent”
onitemdatabound=”lvContent_ItemDataBound” >
<div class=”trd-block”>
<asp:LinkButton Text=”Delete” runat=”server” ID=”lnkDelete” CommandArgument='<%#Eval(“ID”) %>’  />

The solution comes in the Code Behind C# on the ItemDataBound

protected void lvContent_ItemDataBound(object sender, ListViewItemEventArgs e)
LinkButton delete = (LinkButton)e.Item.FindControl(“lnkDelete”);


YouTube API with C#

aspnet youtube

aspnet youtubeYouTube is a major video hosting website. IF you want to have videos on your website and you don’t want to host them, you can always use YouTube as a CDN. 1st method is to upload the video on YouTube and embed the code on your website, 2nd method is to make your website directly upload the videos to YouTube and embed them. YouTube provides a .Net Api to do this from your website directly or from your application. Continue reading “YouTube API with C#”

Increasing Performance of ASP.Net web application

While developing large application performance is the major factor. Performance plays crucial role in development of any application. There are many ways to increase the performance of the application.Some of them are discussed below.

  1.  Page Level and Server controls:
  2.  State Management Level:
  3.  Data Access Level: 
  4.   Web Application Level:
  • Page Level and Server controls:
    • Avoid unnecessary round trips to the server.
      • use Microsoft Ajax and partial-page rendering to accomplish tasks in browser code.
    • use IsPostBack Property of page object to avoid unnecessary processing.
      • Avoid executing code on each postback if it only has to run the first time the page is requested.
    • while developing custom server controls. design them to render client script for some of their functionality.
      • Creating Custom Client Script by Using the Microsoft Ajax Library.
    • Use Server.Transfer and cross-page posting to redirect between ASP.NET pages in the same application.(For accessing controls and their values from the source page).
    • Leave buffering on unless you have a specific reason to turn it off .
      • There is a significant performance cost for disabling buffering of ASP.NET Web pages.
  •  State Management:
    •   Use View state of control when it is required.
      • By default, view state is enabled for all server controls. Disable it , by setting  EnableViewState property to false, as in the following example:
        <asp:datagrid enableViewState=”false” datasource=”…” runat=”server”/>
    • Avoid using view state encryption unless you have to.
      • View state encryption prevents users from reading view-state values in the hidden view-state form field.
    • Select appropriate session-state provider for your application. 
      • Asp.Net provides various ways to store data in a session.Based on the requirement and conditions of the application select appropriate session storage. Example:in-process session state, out-of-process session and creating custom session also possible.
    • Disable session state when you are not using it.
      • To disable session state for a page, set the EnableSessionState attribute in the @ Page directive to false, as in the following example:
        <%@ Page EnableSessionState="false" %>
        To disable it at application level,Use this property in web.config.
         <sessionState mode="Off" />
  •  Data Access Level:
    • Use SQL Server and stored procedures for data access:
      • SQL Server is the recommended choice for data storage to create high-performance, scalable Web applications.
    • Use the SqlDataReader class for a fast forward-only data cursor:
      • The SqlDataReader class creates a forward-only, read-only data stream that is retrieved from a SQL Server database.
    • Cache data and page output whenever possible:
      • use caching if there is no dynamic content request for every page request.
    • Use SQL cache dependency appropriately.
      • Use Table-based polling feature provided by SQL Server. In table-based polling, if any data in a table changes, all cache items that are dependent on the table are invalidated
    • Use data source paging and sorting instead of UI:
      • Don`t pull all the data from the database. use paging concepts and retrieve the number of records that are necessary to display.
    • Balance the security benefit of event validation with its performance cost.
    • Use SqlDataSource control caching, sorting, and filtering .
      • Set the number of threads per worker process.
          • Recycle processes periodically.
              • Preload the application.
                • initial start up response time can be improved by preloading.
              • Precompile Web site projects.
                • Initially project is batch compiled upon first request and this batch compilation compiles all pages in a directory to improve memory and disk usage.So  Precompile the whole project before deploying it into the server.
              • Disable debug mode. 
                • Disable debug mode before you deploy a production application.
              • Tune the configuration files for the Web server computer and for specific applications. Web Application Level:
    • For applications that rely extensively on external resources, enable Web gardening on multiprocessor computers.

Happy programming, share if you find usefull.


RegisterStartupScript with asp:updatepanel

Using if you want to add a script to the page from the code behind. The normal Page.RegisterStartupScript will not work if it is called from a button (or any other event) inside an updatePanel.

This is the normal code you would use ( this will work normally if you don’t have an updatePanel)

Page.RegisterStartupScript(“popup”, “<script type=’text/javascript’>alert(‘hello world’);</script>”);

It should be replaced with the following line of code

ScriptManager.RegisterStartupScript(PanelID, PanelID.GetType(), “script key”, “alert(‘hello world’);”, true);

or use it like this same result

ScriptManager.RegisterStartupScript(PanelID, PanelID.GetType(), “script key”, “<script type=’text/javascript’>alert(‘hello world’);</script>”, false);

Hope this was helpful and solved your problem