Monthly Archives: March 2012

WinForm Model View Controller Using VB.Net WebBrowser Control


A lot of example of Model View Controller Pattern (MVC) are related to Web application but we can make it on Winform.

As a brief, Model View Controller is a way to separate between bussiness logic and presentation. Each layers are independent from others or loose coupling.
Model layer is a business logic. It can be database access or any business rules. View layer is a application layout design. Controller is a connector between model and view and act as main program at MVC.
Users see a controller in the application. MVC is useful for developing medium to large product with several programmers. Those programmers can work simultanously. They can work independently as much as possible.
I already have simple example of web MVC using php at Web Model View Controller (MVC) Concept with PHP example

In this example I use VB.Net Winform Application and using WebBrowser Control as a user interface. I have earlier post that explain on Using VB.Net WebBrowser Control as WinForm user interface.
I create 3 projects in the solution to represents Model View Controller them self.
The three projects are ClassLibDatabaseMVC.vbproj as Database/Model Layer, ClassLibPresentation.vbproj as View Layer and WinFormBrowserMVC as Controller Layer.

Continue reading

Easy Step by Step SSRS Parameter Validation Using Code & Conditional DataSet

At A Glance

Parameter Validation on web application is almost must all the time. Usually developer use javascript or server side script validation.

However, although SQL Server Reporting Service (SSRS) is a web app but as a default it does not have parameter (user input) validation. We have to write a Code at Report Properties Menu and implement it on Report Parameter.

The SSRS Parameter Validation mechanism must check if parameters do not meet specific criteria then related sql query is not running.

I use SSRS 2005 and AdventureWorks database to demonstrate creating this validation. I will show Purchase Order info based on Order Date.
Parameters are range of Order Date (Order Date From & Order Date To) but the range must not exceed 365 days or 1 year.
Continue reading

Create a PopUp Dialog with ModalPopupExtender AjaxControlToolkit


Simple dialog on web page can be created using client script / javascript functions like alert and confirm. function used to open an Url as dialog or new window.

Asp.Net Ajax provides ModalPopupExtender Control to create modal popup dialog. Basically the dialog is a panel control that associated with ModalPopupExtender. User have to click a button, hyperlink or controls to show this popup. We can make better dialog look and feel to the panel.

We need to add reference to AjaxControlToolkit.dll to build an ajax web page with all controls in AjaxControlToolkit. Also we have to register AjaxControlToolkit assembly, namespace and tagprefix.

Continue reading

Fill DataGridView and cancel process using DataAdapter and BackgroundWorker


Filling data to DataGridView with SqlDataAdapter is a common task but to cancel it in the middle of fill process need a tricky way. Especially when SqlDataAdapter returning large DataSet then no progress status informed to user since SqlDataAdapter need time to fetch DataSet. Also this project does not need to have button like “More records” to fetch more dataset. We can retrieve as much records you like and cancel it any time.


We need to show records immediately and user can cancel the retrieval process whenever they like. The basic idea is using int recordcount = SqlDataAdapter.Fill(int startrow, int maxrecords, DataTable dt) method at BackgroundWorker.DoWork event. That Fill method is similar to paging in web page. BackgroundWorker execute SqlDataAdapter.Fill in loop until it has no more record to fetch and we can cancel the process before or after SqlDataAdapter.Fill. 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