Archive for the ‘community site building’ Category

Data Binding using ASP.NET

Tuesday, February 2nd, 2010

Data Binding creates a link between a particular control to a specific column of a table in the database or to an entire table in the database. With ASP.NET data binding you can also bind any server control to the output of different methods and expressions.

On ASP.NET pages when we are doing databinding it is necessary to use the basic syntax for all expressions.

For example:

<%# EmpID %>  This syntax is for a simple property.

<asp:ListBox datasource=’<%# firstArray %>’ runat=”server”>  This syntax is for a collection.

<%# (emp.First Name + ” ” + emp.LastName ) %>  This syntax is for an expression.

<%# GetSalary(EmpID) %>  This syntax is for the result of method GetSalary().

If you are using a list control the following syntax is used:

<asp:Label runat=”server”

Text=’<%# Container.DataItem(“EmployeeName”) %>’

If you are using a RadioButtonList control to bind data then the syntax is:

<html>

<body><form runat=”server”>

<asp:RadioButtonList runat=”server” />

</form></body>

</html>

In multiple data bound Values in a Hyperlink Control with a GridView:

<form runat=”server”>

<asp:SqlDataSource runat=”server”

ConnectionString=”server=localhost;database=Northwind;uid=x;pwd=y”

SelectCommand=”SELECT ProductID, ProductName, QuantityPerUnit,

UnitPrice, UnitsInStock, Discontinued FROM Products” />

<asp:GridView DataSourceID=”datasource1″ runat=”server” />

</form>

If one wants to navigate between the fields then the syntax is:

DataNavigateUrlFields=”ProductID,SupplierID,ProductType”

In the following example, the code below uses a feature to provide a hyperlink that contains two values, both extracted from the current row of the employees table, for the href attribute:

<asp:SqlDataSource runat=”server”

SelectCommand=”SELECT EmpID, CompanyName, City FROM employees”/>

<asp:GridView DataSourceID=”datasource1″ runat=”server”

AutoGenerateColumns=”False”>

<Columns>

<asp:BoundField DataField=”EmpID” HeaderText=”BoundField” />

<asp:HyperLinkField runat=”server”

DataTextField=”employeeName”

DataNavigateUrlFields=”EmpID,City”

DataNavigateUrlFormatString=

“http://yoursite.com/showemployee.aspx?id={0}&city={1}” />

</Columns>

</asp:GridView>

The resulting value for the href attribute will be something like this:

“http://yoursite.com/showemployee.aspx?id=00123&city=Mumbai”

In the above example city of the employee is “Mumbai” and employee id is “00123”.

Databinding simplifies applications; and with less code a fast execution is done. .Net helps the programmer by reducing his/her work and time spent coding a data abstraction layer.

A review of Adobe Flex Builder

Saturday, January 30th, 2010

Adobe’s FlexBuilder is the Software Development Environment for Flex, Adobes Rich Internet Application platform. FlexBuilder is built on Eclipse, so any computer you run on it should have > 1 GB of ram and a processor > 2 ghz.

FlexBuilder is a very satisfying environment to work in. It is much more natural (as a programmer) to use than the actionscript editors in Adobe Flash. Because you are working in a fairly heavyweight Eclipse environment, those used to working in Microsoft Visual Studio may find FlexBuilder a bit slow. FlexBuilder does have a set of very capable debugging tools however, and these tools alone make the near-$250 price tag worth it. The addition of the powerful Designer mode (much like the Design view in Visual Studio) also adds a lot of value. Because of these features I strongly recommend Adobe FlexBuilder for development, and consider it a worthwhile addition to any Rich Internet Application programmers toolkit.

Rating: 8 out of 10
Pros: Feature packed, Eclipse environment is very configurable, Natural environment for experienced programmers.
Cons: Eclipse is a resource hog, so check to make sure your computer meets the minimum specs before buying.

Google Analytics is made of win

Friday, January 29th, 2010

This week, for the first time, I got on the Google Analytics bandwagon. I never thought charts and graphs could be so damn fun. Look at this:

Google Analytics site overlay

Google Analytics site overlay function

That is what Google calls the “Site Overlay” (it’s under the Content menu, if you’re looking for it, Googlers/Bingers). I was FLOORED when I saw it for the first time. The numbered percents everywhat represent the percentage of visitors that clicked the link – but I’m sure you didn’t need to be told that, since the data is clear as day.  WAY TO GO GOOGLE for taking data visualization to the next level.  Mad props.

Newly upgraded WordPress

Saturday, January 9th, 2010

Have an old WordPress install? I was recently amazed at how easy it is to upgrade to the latest and greatest. The WordPress Codex has an article on how to do it here.

Create a restricted area on your website

Thursday, September 4th, 2008

If your website is running on an Apache server, its very easy to restrict access to a folder to only yourself or a select few people. This is very useful if parts of your site are not yet fully operational, or if you want to run a small “beta”. (more…)

How to ban people from your site by IP address

Thursday, September 4th, 2008

I found this neat trick the other day… If you notice someone is trying to hack your website, or just would rather a certain individual not stop by anymore, its very easy to ban the offender if you’re using Apache as your webserver. (more…)

A chat with a professional designer

Tuesday, December 11th, 2007

If you are, work with or want to be a professional designer, you MUST READ THIS…

I had a chat with MD, a professional designer friend of mine. I wanted to get an idea of what his design process is, as well as his thoughts on the current “Web 2.0″ situation and what it means for professional designers right now. He graciously agreed to allow me to post the conversation to the blog!

(more…)

New updates to iswapyou.com

Tuesday, December 11th, 2007

Theres been a lot of new functional changes made to iswapyou in the last two weeks. Summary is listed below.

(more…)

Why should my site use a database? Dynamic Data for Web 2.0

Saturday, December 1st, 2007

Databases run just about everything on the web, from ebay to the latest social networking site. Any site that generates a lot of content and updates on a daily, weekly, or monthly basis should use some sort of online database. There is a reason that most blogs use either a “flat file” database (i.e. MoveableType), or a commercial or open source database application (i.e. WordPress – which this blog uses). Databases store your data so you can output and shape it based on the function that your sites user wishes to perform. This is the meaning of “dynamic data”, the benefits of which i will describe below.

(more…)

Create the next Youtube clone

Monday, August 20th, 2007

Howtoforge.com posted a great article yesterday on creating a Youtube-like streaming video site using Debian linux running lighttpd as the web server and FlowPlayer to play the flash-encoded videos…

(more…)