Tag Archives: ASP .Net Example

Using Asp .Net TabContainer To Create Professional Entry Form/View

Asp .Net TabContainer is useful for multi view purpose via clicking its Tab Panels.
The idea is using two TabPanels as containers for Entry form and list view. The first Tab Panel contains Entry Form and second for List View as we can see at above screen shots.

I use simple Northwind Database and Products Table to create Entry and View to this table.

Asp .Net TabContainer Basic

We must add reference to Asp .Net Ajax Control Toolkit since TabContainer Control is inside it.

  • Add ToolkitScriptManager Control inside form tag
  • Add TabContainer Control after ToolkitScriptManager.
     <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    	<asp:TabContainer ID="TabContainer1" runat="server" >
    		 <asp:TabPanel ID="tabpanel1" runat="server" HeaderText="Entry">
    		 <asp:TabPanel ID="tabpanel2" runat="server" HeaderText="View">

Basic TabContainer is already created with simple above Asp .Net Script. You can switch between TabPanels but these still contains nothing.
Continue reading

Applying ReportViewer Ver. 10 (RDLC) in Asp.Net and using Visual Web Developer 2010 Express Edition

Many organizations require to have Reporting that can be accessed online. There are many options on the web including SQL Server Reporting Service (SSRS) and Asp.Net ReportViewer Control.
If you install SSRS in server then the server becomes Report Server. SSRS makes easy on report development also deployment. After developer creates report he can deploy it to Report Server so users can view that report by browsing to Report Server Url.
The lack of SSRS is the SSRS service needs to be installed on top of SQL Server so that organization must manage their SQL Server and SSRS even if your main database is not using SQL Server. Cient validation is also often being issue since developer can not use javascript in Report Designer.

On the other hand, ReportViewer Control is more flexible. It is built on Asp.Net and Reporting by ReportViewer doesn’t need to have SQL Server if you don’t want to install it. Also client validation is not an issue anymore. Asp.Net has many techniques to do validation before Data Source is sent to ReportViewer.

This blog post will focus on applying ReportViewer Ver. 10. I use VS Web Developer 2010 Express and did some steps below before coding:

  1. Get ReportViewer Control Ver.10 from this link http://www.microsoft.com/en-us/download/details.aspx?id=6442 and install it
    That component will be registered on C:\Windows\assembly folder after install.
  2. Using xcopy command, copy lib file which is Microsoft.ReportViewer.WebForms.dll from folder C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\ to your own folder
  3. Create New Asp.Net Empty Web App Project
  4. Add reference to copied Microsoft.ReportViewer.WebForms.dll previously
  5. Add ReportViewer Ver.10 Control to your toolbox list
  6. Open Web.Config file. Make sure ReportViewer Version is and add <httpHandlers> tag. Below is my web.config file:
    		<compilation debug="true" targetFramework="4.0">
    				<add assembly="Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    				<add assembly="Microsoft.ReportViewer.Common, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    				<add assembly="Microsoft.Build.Framework, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    				<add assembly="System.Management, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
                <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Continue reading

Understanding Asp .Net CascadingDropDown AjaxControlToolkit Tutorial

Populating DropDown is a common process in web application. We can set dropdown listitem manually or load from array / database.

Sometimes we deal with more than one dropdown that related to each other. It calls Cascading DropDown.

Many ways to create Cascading DropDown with asp .net which are using autopostback that page refresh everytime dropdown item selected, plain asp .net ajax that only reload partially and using CascadingDropDown Ajaxcontroltoolkit that also use ajax process.

The benefit of using CascadingDropDown Ajaxcontroltoolkit are increasing productivity due to a lot of design work has been done in its functionality and also the web page doesnt have to reload a whole page since its process is using ajax.

CascadingDropDown AjaxControlToolkit Description

Tag example:
<ajaxToolkit:CascadingDropDown ID=”CascadingDropDown1″ runat=”server” TargetControlID=”DropDownList1″
Category=”category” PromptText=”….” LoadingText=”[Loading …]”
ServiceMethod=”GetDropDownContents” />
Continue reading

Starting & Aborting/Cancelling Asp .Net Ajax Request Techniques

Starting an Ajax request is easy task. We can use ScriptManager, UpdatePanel and UpdateProgress controls but aborting it requires more client script.
Common web example of abort/cancel ajax request has abort() method to XMLHttpRequest. On the other hand Asp .Net has its own way to accomplish this.

Example 1 (Sys.WebForms.PageRequestManager)

  1. Create new Website Application
  2. Add new Webform, Default.aspx:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <script type="text/javascript">
            function aborttask() {
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            <asp:UpdatePanel ID="updpanel" runat="server">
                    <asp:Button ID="btnstart" Text="Start Ajax for 10 seconds" runat="server" /> &nbsp;
                    <asp:Button ID="btnstop" Text="Abort" runat="server" OnClientClick="aborttask()" /><br />
                    <asp:Label ID="msg" runat="server"></asp:Label>
            <asp:UpdateProgress ID="updprog" runat="server" AssociatedUpdatePanelID="updpanel">
                <ProgressTemplate>Sleeping ..</ProgressTemplate>

    Continue reading

[Resolved]Cannot Consume/Access/Use Asp .Net Classes in App_Code / Bin folder and WebService ‘Compilation Error’


We can create Asp .Net classes or bussiness objects inside App_Code or using compiled library .dll file in Bin folder.
Alternatively classes may be write inside WebService. If nothing is wrong then we can access our web app classes when it is launched via Visual Studio.
Unfortunately, after we deploy it to IIS and try to access deployed classes or WebService an error “Compilation error .. Type xxx is not defined ..” occurs.


Let’s make a New Website Asp .Net Empty Web Application to make problem and solution clear.
Continue reading

Quickly Mastering: Create And Use Asp .Net Web Service From Basic, Database Access To Ajax-Enabled


Web services are components on a Web server that a client application can call by making HTTP requests across the Web. ASP.NET enables you to create custom Web services or to use built-in application services, and to call these services from any client application
Source: http://msdn.microsoft.com/en-us/library/t745kdsh.aspx

Web Services are an integral part of the .NET framework that provide a cross-platform solution for exchanging data between distributed systems. Although Web Services are normally used to allow different operating systems, object models and programming languages to send and receive data, they can also be used to dynamically inject data into an ASP.NET AJAX page or send data from a page to a back-end system. All of this can be done without resorting to postback operations.
Source: http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-web-services

Web Service In Code

Web Service in Asp .Net is an object that can be accessed in the same way as a class.
Website project must add Web reference to a WebService’s Url address so that the website can access it.
In code point of view, writing access to WebService is same as accessing a regular class in Asp .Net. This regular class usually located in App_Code folder.
WebService located at a web server and reference it through http protocol.

Inside WebService code file is a class and its member. We can put class member, properties and methods in WebService. We can build WebService to operate with files, database etc Continue reading

Cascading DropDownList with Asp .Net Ajax

Populating list to DropDownList Control is one of most common process in web application. Web page reload every time to populate with data.
Images, textboxes and other components will reload and it increases load between client and server.

Asp .Net Ajax makes web page not entirely reload. Populating process will only affect to related DropDownList Controls. Other controls will not reload everytime.

The Example use SQL Server AdventureWorks Database. It will have Department DropDownList and when selection changed second DropDownList will populate related Employee.
Third DropDownList contains Sales Order Number to chosen Employee. Show Sales Data Button will provide brief information based on chosen sales order number.
Continue reading