Pages

Understanding access modifiers in C#

I am writing this post for those who know what access modifiers are, but have some difficulties understanding exact differences, especially internal and protected internal. So i will explain the same with very simple code.

SqlDataSource - Advanatges & Disadvantages

I have seen many people asking about whether they should go with SqlDataSource or write the custom code for databinding. Or when should they follow either of the approaches. So i decided to list down few (in fact very few, but definitely major ones!) advantages and disadvantages of using SqlDataSource control, as i strongly believe writing code for databinding is the best approach.

Customize ValidatorCallout extender control

Today i am going to show how can a ValidatorCallout can be themed. Link says, for customizing ValidatorCallout "user would have to set the CssClass property to the name of the CSS style and define the styles for the individual classes so that the various elements in a ValidatorCallout control can be styled accordingly".

Split function in SQL

Its a common requirement to split delimited string and get a list of values. However, there is no built-in Split function in SQL.

HTML table search using JavaScript

Its a common practice to display large data using table elements. Moreover, many a times its obvious to provide facility to search through the displayed data especially when there are hundreds or thousands of rows and columns. One cannot expect users to keep scrolling vertically/horizontally for finding information of their interest.

Validate Gridview selection using Javascript

Its a common scenario where we provide checkbox in each row of gridview for selecting that record. And there are actions which need to be taken on selected records in gridview. Typical example would be an admin page where you display list of registered users and give facility to activate, deactivate, delete registrations.

Popup using JavaSript and CSS

Here is a simple way by which you can display a popup with faded background effect using JavaScript and CSS. No third party toolkit or controls required! Faded background will not be responsive while popup is being displayed.

_doPostBack function in javascript - asp.net postback mechanism

Big question!!! What is __doPostBack function in javascript and what it does? In asp.net all the web server controls except Button and ImageButton (discussed at the end) use javascript __doPostBack function to trigger postback. This behavior is known as asp.net postback mechanism.

Display data from SQL database using GridView

Here i will explain how to display data from SQL database using asp.net GridView control.

Define GridView

You can either define GridView by typing or simply by dragging the same from toolbox in Visual Studio (Referred as VS hereafter) . Go to Toolbox > Data and drag the control on the page (You can also double click on the item)
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>