Geeks With Blogs

News

Microsoft MVP


Moderator at CodeASP.NET


Quiz Master




free counters
Free counters
Added on January 19,2012


Follow Me @vmsdurano

A bit About Me



Disclaimer
The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers. Nor does it represent the opinion of my dog, because I don’t have one.


Vinz' Blog (ProudMonkey) "Code, Beer and Music ~ my way of being a programmer" ASP.NET There are 182 entries for the tag ASP.NET
Book Review: Microsoft .NET Framework 4.5 Quickstart Cookbook
I had a review copy of Jose Luis Latorre Millas's Microsoft .NET Framework 4.5 Quickstart Cookbook. This book was given to me by Packt Publishing few months ago but didn't got a chance during that time to give an insight about the book. While i am very much eager to sit down and read them, I was not able to do it right away because of the projects that I've been working on. It's been very busy and will always be. Thankfully, I did find some time few days ago to finally give this a read and publishing ......

Posted On Wednesday, March 26, 2014 3:41 AM

ASP.NET SignalR: Building a Simple Real-Time Chat Application
Introduction SignalR is a pretty new and very exciting feature in ASP.NET. It offers a simple and clean API that allows you to create real time web applications where the server needs to continuously push data to clients. Common applications are chat, news feeds, notifications and multi-player games. For this exercise we’re going to build a simple chat application in ASP.NET MVC 4 using the power of SignalR. I presume that you already have the basic knowledge on ASP.NET MVC and how stuff works (e.g. ......

Posted On Thursday, February 27, 2014 3:03 AM

Speaking with the Cebu Developers
Yesterday’s training session was a success with few developers from Cebu attended the session. The core topic I’ve talked about was ASP.NET MVC. Here’s the full list of the topics below: An Intro to ASP.NET MVC MVC and MVP Pattern – The Difference MVC and WebForms – The Difference What does ASP.NET WebForm and MVC values? Core ASP.NET MVC and it’s core features An Intro to Entity Framework and LINQ Sample MVC Application Demo Creating a Sign-Up page Creating a LogOn page Fetching, Editing and Updating ......

Posted On Thursday, October 3, 2013 8:15 PM

2013 Microsoft ASP.NET/IIS MVP
I am very honored to have received this award again. This is my fifth year in a row now and it feels really great! ;) That past year was a really blast and had a great time with the MVP Global Summit, was able to create and published new versions of my open-source controls at Codeplex, technical forum contributions, blogging,writing articles and speaking. I’m glad and very happy that I made it again this year despite of all the busy stuffs at work and life, I still manage to contribute to the ASP.NET ......

Posted On Monday, July 1, 2013 11:01 PM

ASP.NET 4.5 - FAQs on SignalR Script Exceptions
ASP.NET SignalR is pretty new and very exciting feature in ASP.NET. You might want to play around with it and may encounter some hiccups during your implementation. This post will cover some issues that you may encounter and how to avoid it. If you have declared the following scripts in your View(.cshtml/.aspx) <script src="~/Scripts/jquery.signa... <script src="/signalr/hubs" type="text/javascript">&... <script type="text/javascript"> $(function ......

Posted On Tuesday, March 5, 2013 4:24 PM

GridView–Implementing Cascading DropDownList on Edit Mode
Introduction: This question has been asked many times at the forums (http://forums.asp.net) and definitely there are already bunch of different solutions provided. Most of the examples from the web are using DataSource controls (e.g SqlDataSource, ObjectDataSource, etc..) to implement cascading DropDownList in GridView and I can’t seem to find a formal example that demonstrate how to implement it without using DataSource controls. Note: Before you proceed, make sure that you already know the basics ......

Posted On Saturday, March 2, 2013 5:17 AM

Tip of the Day–Set ReadOnly for AutoGenerate Columns in GridView
This question was asked from the forums.asp.net and thought I’d blog about it for future reference. The question is “how do we set ReadOnly for autogenerated columns in gridview when it’s on edit mode?”. Well as you may know autogenerated columns are created dynamically on the fly and so we need to manually access each columns in the code before we can set their properties. To make it more clear we’ll create a simple demonstration. Consider that we have this HTML mark-up below: <asp:GridView ID="GridView1" ......

Posted On Monday, February 4, 2013 9:20 PM

A Blog Feature
Vishal Ranjan invited me to have a short interview about myself. The details of the interview was featured in his blog here: Interview with Vincent Maverick Durano Technorati Tags: Community,General,Asp.NET ......

Posted On Friday, February 1, 2013 5:30 PM

Another year of being a Microsoft MVP
Yes, Just got an email from Microsoft that I have been re-awarded as an ASP.NET/IIS Microsoft MVP for 2012. The last year for sure was very busy with projects and I’m glad I made it again and able to contribute to the ASP.NET community. It is really a big surprise to me! Wohooo!! =) I am looking forward to contribute more in the community. BIG thanks to Microsoft, my MVP Lead Lilian Quek, Clarisse Ng our SEA MVP Program Specialist, family, friends, readers, and everyone who has supported me!!! Technorati ......

Posted On Monday, July 2, 2012 1:41 PM

Finally! ProudMonkey Controls is out on CodePlex!
I've been receiving requests for the source code of my MessageBox controls for ASP.NET and so I've decided to upload my project in CodePlex so everyone can use it. You can check and download the controls here: http://proudmonkeycontrols.... Download Documentation Feel free to visit my project page and provide your valuable feedback! Thanks ......

Posted On Wednesday, February 1, 2012 10:08 PM

Using ProudMonkey ConfirmBox Control in GridView
There are times that we need to prompt the users when doing certain actions on the page. One practical example is to confirm the user when deleting a certain record just like what I have demonstrated awhile back about Displaying a Confirmation Message on GridView Deleting. If you noticed on that demo I simply use plain JavaScript to display the confirmation message. In this post I’m going to demonstrate how to use the ConfirmBox control in delete scenario. Note that just for the simplicity of this ......

Posted On Wednesday, February 1, 2012 12:42 AM

A bit About Me
I work as a Tech Lead/Web Developer, focusing mainly in ASP.NET technologies. My exploration into programming began at the age of 15;Turbo PASCAL, C, C++, JAVA, VB6,Flash and a variety of other equally obscure acronyms, mainly as a hobby. After several detours, I am here today on the VB.NET to C# channel. I now work on ASP.NET+C#+MSSQL+EF+LINQ+AJ... which go together like coffee crumble ice cream. I am a Microsoft ASP.NET MVP since 2009, Microsoft Influencer and a regular ......

Posted On Wednesday, January 18, 2012 7:28 PM

Using MessageBox Control Outside UpdatePanel Control
Few days ago I wrote a simple demo about “Using ProudMonkey Controls with ASP.NET AJAX Update Panel”. One small problem is that if for some reasons you will place the MessageBox control outside UpdatePanel then you’ll notice that the MessageBox will not display properly in the page. So if you were setting your html mark-up like this: <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <%@ Register Assembly="ProudMonkey.Commo... Namespace="ProudMonkey.Comm... ......

Posted On Thursday, January 12, 2012 8:24 PM

ASP.NET MVC 3 - Editing and Updating the Form
This demo is a continuation of my previous article about "Creating a Simple Log-in Form". Basically in this post I'm going to demonstrate the basic on how to edit and update the form with ASP.NET MVC 3. Before you go any further, I'd suggest you to check out my previous article first about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" and "Creating a Simple Log-in Form". STEP 1: Creating the Model class Just for the simplicity of this demo, I'm just going to display the FirstName, LastName and ......

Posted On Monday, January 9, 2012 10:13 PM

Using ProudMonkey Controls with ASP.NET AJAX Update Panel
Using the MessageBox, ConfirmBox and FrameBox controls within Update Panel control is very easy. Just like other asp standard controls, you can just put the controls that you want to use within Update Panel and your good to go. Here's a simple demo I wrote just for your reference. ASPX: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProudMonkeyCont... Inherits="WebAppDemo.ProudM... %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml... ......

Posted On Thursday, January 5, 2012 10:47 PM

ASP.NET MVC 3 - Creating a Simple Log-In Form
This demo is a continuation of my previous article about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" which I wrote few months ago. Basically in this post I'm going to demonstrate how to create a simple LogOn form in which users can supply their username and password. And how to authenticate and validate users in ASP.NET MVC 3. I will not elaborate more in details about the model, view and controllers function so before you go any further, I'd suggest you to check my previous article first about ......

Posted On Friday, December 30, 2011 6:14 PM

ProudMonkey Controls for ASP.NET 4.0 - Version 3
First of all I am so happy to know that many developers around the world uses my controls (~ it's really a big surprise to me. =} ). Thank you all and hope you'll continue to provide feedback or feature suggestions so that I can work on it on my free time. I've seen a lot of developers asking me via email, forums, blog comments, and private messages requesting how to use those controls in ASP.NET 4.0 with the latest release of AjaxControlToolkit. As you may know the previous dll of ProudMonkey controls ......

Posted On Wednesday, December 28, 2011 8:27 PM

Product Review - ComponentOne Studio for MVC Wijmo
Wijmo is an awesome tool from ComponentOne. The goal of this tool is to help us web developers rapidly develop MVC applications with interfaces richer than WebForms. Main Features: 1.Over 30 UI Widgets with everything from interactive menus to rich charts. 2.MVC scaffolding automation. This means that Wijmo generates rich interactive Views and Controllers for your entire Model. Free Trial DownLoad: http://www.componentone.com... In this review we'll take a look at Wijmo ......

Posted On Monday, August 22, 2011 6:08 PM

Microsoft MVP Again for 2011
I just got a great news from Microsoft that I’m re-awarded as Microsoft MVP (Most Valuable Professional) for this year. This is my 3rd year in a row as an MVP and I’m of course very happy about and feel honored by it. Woohoo!! Here’s the Proof =} “Dear Vincent Maverick Durano, Congratulations! We are pleased to present you with the 2011 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate ......

Posted On Friday, July 1, 2011 10:29 PM

ASP.NET MVC 3: Creating a Simple Sign-Up Form
In this article I'm going to demonstrate how to create a simple sign-up form using ASP.NET MVC 3. So basically in this demo you will learn the following: How to insert data to the database with Entity Framework How to validate the Form using Data Annotations How to Authenticate users after sign up using FormsAuthentication Note that before you continue reading this article be sure that you have the basic understanding about ASP.NET MVC in general. You can refer the following links below to learn ......

Posted On Friday, June 3, 2011 8:44 PM

I'm on the Top of the World...
I just noticed that I get to the top contributor list again for the last 30 days at the Microsoft official Asp.net Community Forums (http://forums.asp.net/). Feels great! =} Technorati Tags: Community ......

Posted On Friday, May 6, 2011 2:32 PM

ProudMonkey Controls for ASP.NET 4.0 - Customizing the Modal
If you were using the customized MessageBox, ConfirmBox and FrameBox controls and wanted to modify the look and feel of the these controls then you should be happy because the new version of the ProudMonkey controls provide some properties that you can set to customize the modal controls including the header, buttons, body background color, header fonts etc. You can download the new version here: ProudMonkey Controls Version 2 The MessageBox provides the following properties: HeaderImageUrl - This ......

Posted On Monday, May 2, 2011 2:47 PM

Tip Of The Day - Remove GridView Row Highlighting on Edit Mode
Typically we will attach the mouseover and mouseout client-side events on the gridview rows to highlight rows on mouseover, but there are cases that we don't want to make the row highlighted when we are on edit mode. To do this we can check the GridView EditIndex to determine if the row is on edit mode and then do the validation there. Here's a sample code block below of what I am talking about: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) ......

Posted On Tuesday, April 26, 2011 2:17 PM

A Monkey Talks about ASP.NET
Last week, I was interviewed by Zandra Nilocas from Microsoft Philippines. It was my first time experience to talk about something in front of the camera so it's not surprising that I looked like an idiot in that interview (you know swiveling my chair back and forth without noticing it). Anyway in the interview we talked about ASP.NET WebForms, MVC and Web Matrix in general and just to elaborate a bit of what we talked about and to clarify things out, I have decided to write this post... WebForms ......

Posted On Thursday, April 14, 2011 2:50 PM

Entity Framework - Inserting Data to Database
Few months ago I wrote a series of articles regarding how to Insert, Update, Fetch and Delete data in the form using LINQ to SQL. You can view the series of articles below: Inserting Data to Database using LINQ to SQL Fetching Data from Database and Populating fields in the Form using LINQ to SQL Editing, Updating and Deleting Data in the Form using LINQ to SQL In this article I'm going to demonstrate the basics on how to work with MS Entity Framework. Basically in this part I'm going to show you ......

Posted On Monday, April 4, 2011 11:59 AM

Free ASP.NET MVC 3 Training Videos from Pluralsight
For those who are interested: The course looks at the features of the ASP.NET MVC 3 framework, including the new Razor View Engine, the new unobtrusive AJAX features, NuGet Package Management and more.. http://www.asp.net/mvc/plur... Technorati Tags: ASP.NET MVC,ASP.NET ......

Posted On Friday, March 11, 2011 4:11 PM

Using Radio Button in GridView with Validation
A developer is asking how to select one radio button at a time if the radio button is inside the GridView. As you may know setting the group name attribute of radio button will not work if the radio button is located within a Data Representation control like GridView. This because the radio button inside the gridview bahaves differentely. Since a gridview is rendered as table element , at run time it will assign different "name" to each radio button. Hence you are able to select multiple rows. In ......

Posted On Thursday, March 3, 2011 5:20 PM

A Simple Collapsible Menu with jQuery
In this post I'll demonstrate how to make a simple collapsible menu using jQuery. To get started let's go ahead and fire up Visual Studio and create a new WebForm. Now let's build our menu by adding some div, p and anchor tags. Since I'm using a masterpage then the ASPX mark-up should look something like this: 1: <asp:Content ID="Content2" ContentPlaceHolderID="MainC... runat="server"> 2: <div id="Menu"> 3: <p>CARS</p> 4: <div class="section"> 5: <a href="#">Car ......

Posted On Friday, February 4, 2011 5:02 PM

Dynamically Adding TextBox Control to ASPNET Table: Part 2
Few months ago I wrote an example about Dynamically Adding TextBox Control to ASPNET Table. As a recap that example demonstrate how to generate rows of TextBoxes in a Table control based on the number of rows and number of columns provided and as well as print the values entered by the user using the Request.Forms collections.. Recently,one of the user is asking if how are we going to accomplish the same thing by generating the TextBox in the Table based on the data from the database. So in this ......

Posted On Tuesday, January 25, 2011 5:24 PM

ProudMonkey Controls for ASP.NET 4.0
Few months ago I have posted an article on how to use the ProudMonkey customized MessageBox, ConfirmBox and FrameBox controls for ASP.NET 3.5 here. Many developers are asking me via email and private messages requesting how to use those controls in ASP.NET 4.0. Obviously the previous dll will not work in ASP.NET 4.0 version because those controls are using AjaxControlToolkit 3.0.1106.0 which is not compatible with .NEt 4.0 version. So if you want to use the MessageBox, ConfirmBox and FrameBox controls ......

Posted On Monday, January 24, 2011 6:20 PM

ASP.NET AJAX Modal Popup Control with CSS Rounded Corners
I was playing around with CSS and ASP.NET AJAX Modal Popup Control and wanted to have a popup that has a rounded corner outer shadows on it without using images. After searching the web for an existing solution I found this link and tried to apply it on my modal. Luckily I was able to make it work. Here's the whole code for my experiment: 1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml... 2: <%@ Register Assembly="AjaxControlToolkit" ......

Posted On Friday, January 21, 2011 11:55 PM

Displaying All Images from the Folder in the Page
In my previous post I have demonstrated how to upload an image to a folder and display the image after uploading here. In this post I will extend a little bit of what I have demonstrated on my previous post. Basically I'm going to demonstrate how to display all the uploaded images from the folder in the web page on click of the Button. Here's the html mark up: ASPX: 1: <asp:FileUpload ID="FileUpload1" runat="server" /> 2: <asp:Button ID="Button1" runat="server" Text="Upload" onclick="Button1_Click" ......

Posted On Thursday, January 20, 2011 11:13 PM

Uploading Image to a Folder and Display the Image after Upload
I wrote a series of blog posts awhile back before that demonstrates the following: Uploading and Storing Images to Database in ASP.NET Displaying Image to Image Control based on User Selection in ASP.NET FAQ: Displaying Image from Database to GridView Control Uploading and Storing Image Path to Database and Image to Folder - Part 1 Uploading and Storing Image Path to Database and Image to Folder - Part 2 (Displaying of Images) Validate Image extensions upon Upload In this post I'm going to demonstrate ......

Posted On Thursday, January 20, 2011 10:29 PM

Inserting and Deleting Sub Rows in GridView
A user in the forums (http://forums.asp.net) is asking how to insert sub rows in GridView and also add delete functionality for the inserted sub rows. In this post I'm going to demonstrate how to this in ASP.NET WebForms. The basic idea to achieve this is we just need to insert row data in the DataSource that is being used in GridView since the GridView rows will be generated based on the DataSource data. To make it more clear then let's build up a sample application. To start fire up Visual Studio ......

Posted On Tuesday, January 4, 2011 5:52 PM

Uploading and Importing CSV file to SQL Server in ASP.NET WebForms
Few weeks ago I was working with a small internal project that involves importing CSV file to Sql Server database and thought I'd share the simple implementation that I did on the project. In this post I will demonstrate how to upload and import CSV file to SQL Server database. As some may have already know, importing CSV file to SQL Server is easy and simple but difficulties arise when the CSV file contains, many columns with different data types. Basically, the provider cannot differentiate data ......

Posted On Monday, January 3, 2011 5:03 PM

FAQ: GridView Calculation with JavaScript - Editable Price Field
Recently I wrote a series of blog posts that demonstrates how to do calculation in GridView using JavaScripts. You can check the series of posts below: FAQ: GridView Calculation with JavaScript FAQ: GridView Calculation with JavaScript - Formatting and Validation FAQ: GridView Calculation with JavaScript - Displaying Quantity Total Recently a user in the forums is asking how to calculate the total quantity, sub-totals and total amout in GridView when a user enters the price and quantity in the TextBox ......

Posted On Thursday, December 9, 2010 11:43 PM

FAQ: GridView Calculation with JavaScript - Displaying Quantity Total
Previously we've talked about how calculate the sub-totals and grand total in GridView here, how to format the numbers into a currency format and how to validate the quantity to just accept whole numbers using JavaScript here. One of the users in the forum (http://forums.asp.net) is asking if how to modify the script to display the quantity total in the footer. In this post I'm going to show you how to it. Basically we just need to modify the javascript CalculateTotals function and add the codes ......

Posted On Thursday, December 9, 2010 5:54 PM

FAQ: GridView Calculation with JavaScript - Formatting and Validation
In my previous post here we've talked about how to calculate the sub-totals and grand total in GridView using JavaScript. In this post I'm going take more step further and will demonstrate how are we going to format the totals into a currency and how to validate the input that would only allow you to enter a whole number in the quantity TextBox. Here are the code blocks below: ASPX Source: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml... ......

Posted On Thursday, December 9, 2010 5:17 PM

FAQ: GridView Calculation with JavaScript
In my previous post I wrote a simple demo on how to Calculate Totals in GridView and Display it in the Footer. Basically what it does is it calculates the total amount by typing into the TextBox and display the grand total in the footer of the GridView and basically it was a server side implemenation. Many users in the forums are asking how to do the same thing without postbacks and how to calculate both amount and total amount together. In this post I will demonstrate how to do this using JavaScript. ......

Posted On Wednesday, December 8, 2010 10:29 PM

Master Page: Dynamically Adding Rows in ASP Table on Button Click event
In my previous post here, I wrote an example that demonstrates how are we going to generate table rows dynamically using ASP Table on click of the Button control. Now based on some comments in my previous example and in the forums they wanted to implement it within Masterpage. Unfortunately the code in my previous example doesn't work in Masterpage for the following main reasons: The Table is dynamically added within the Form tag and so the TextBox control will not be generated correcty in the page. ......

Posted On Friday, December 3, 2010 8:35 PM

A Customize MessageBox, ConfirmBox and FrameBox Control for ASP.NET
I've been seeing many developers in the forums asking: How can I display a message box from the server (code behind)? How can I customize the javascript confirm and alert popup? How can I display a message box like in windows application? As some of you may already know that displaying a pop-up message box has always been a pain for most developers in web programming. Everyone has probably used the Page.ClientScript.RegisterS... or the ScriptManager.RegisterClien... method to call ......

Posted On Tuesday, November 2, 2010 11:01 PM

Joined the Professional Level at CodeASP.Net Community
I just noticed that I have reached the Professional level at the http://www.codeasp.net. Technorati Tags: Community ......

Posted On Thursday, October 7, 2010 8:54 PM

Tip/Trick: Fixing GridLines Border Color in IE8
There are times that we need to set the border color of the GridView just like in my case, I was told to set the border color of GridView to a particular color instead of the default black. What I did is simply use the BorderColor property of the GridView and set it declaratively like below: <asp:GridView ID="GridView1" runat="server" GridLines="Both" BorderColor="Red"><as... Here's how it looks when we run that one in the browser. Firefox 3.5 Safari 5 IE 8 Noticed that in IE8 ......

Posted On Thursday, October 7, 2010 8:38 PM

Master Page and JQuery: Solving Object Expected Error
I was working with a project that uses the concept of master page. Within the master page I have a bunch of UserControls for some specific purposes and one of the UserControl is for the site dynamic menu. The menu was basically built using JQuery and CSS. The menu works fine if you are using it as an anonymous user but if you logged in as authorize user the menu will no longer work for some odd reasons and produces the following script error below in the browser: Message: Object expected Line: 122 ......

Posted On Wednesday, October 6, 2010 7:44 PM

Moderator at CodeASP.NET
Today, I was surprised to know that I have been selected as one of the moderators at the Code.ASP.Net community. I feel honored to be one of the moderation team. I know this is not an easy role but I will try my best to contribute more and help grow the community. I hope to be able to keep up the good work there for years to come. Technorati Tags: Community ......

Posted On Tuesday, September 28, 2010 4:04 PM

Create, Build, Run,Test and Debug codes online with CodeRun Studio
Hajan posted a blog at codeasp.net and discovered an awesome tool that would let you Create, Build, Run, Test and Debug codes online. I find this tool very useful and handy because I can easily run and test codes without Visual Studio and without installing something in my computer. What is this awesome tool by the way? They called it CodeRun Studio - CodeRun is A free, cross-platform browser-based IDE designed for the cloud. It enables you to easily develop, debug and deploy web applications using ......

Posted On Wednesday, September 15, 2010 6:57 PM

Adding Dynamic Rows in GridView with TextBox and DropDownList - Validation
In my previous post here I have demonstrated how to add dynamic rows in Gridview with a combination of TextBox and DropDownList. Just in case you need to validate empty TextBox values before adding a new row to the GridView then here's a JavaScript function that you can use for validation: function ValidateEmptyValue() { var gv = document.getElementById("&l... Gridview1.ClientID %>"); var tb = gv.getElementsByTagName("in... for (var i = 0; i < tb.length; i++) { if (tb[i].type == "text") ......

Posted On Thursday, August 5, 2010 4:10 PM

Adding Dynamic Rows in GridView with TextBox and DropDownList
Few months ago I wrote a sample demo on how to Add Dynamic Rows in GridView with TextBoxes and how to Add Dynamic Rows in GridView with DropDownLists. I have had a few comments and emails asking how to do the same with a combination of TextBox and DropDownList. In this post, I'm going to show you the way on how to this. Here are the code blocks below: ASPX: <asp:gridview ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false"... <Columns> <asp:BoundField DataField="RowNumber" ......

Posted On Tuesday, August 3, 2010 2:41 PM

GridView BoundField Column: Accessing TextBox Control on Edit Mode
If you are working with GridView BoundField Columns and wanted to access the TextBox control on row editing for whatever reasons (which means when you click on the Edit link) then below is an example on how to do it. Let say for example you need to change the BackColor of the TextBox on edit mode. So at PreRender event of GridView, you can do something like this:protected void GridView1_PreRender(object sender, EventArgs e) { if (this.GridView1.EditIndex != -1) { TextBox tb = (TextBox)GridView1.Rows[Gri... ......

Posted On Wednesday, July 14, 2010 11:42 PM

Display animated gif before Iframe content is loaded
If you are working with iframe in which the content takes time to load, you may want to display a simple loading indicator to the end users instead of letting the users see a blank screen in the page. To do this, here's one way on how to implemet it using javascript. <html xmlns="http://www.w3.org/19... > <head runat="server"> <title></title> <script type="text/javascript"> function hideLoading() { document.getElementById('di... = "none"; document.getElementById('di... ......

Posted On Tuesday, July 13, 2010 8:31 PM

JQuery Tab: Retain Selected Tab Across Postbacks in ASP.NET
Few months ago I've been seeing many users in the forums asking how to retain the selected tab in JQuery Tab across postbacks, so I've decided to write this post as reference to others who might encounter this kind of scenario. To describe the scenario, lets go a head and create the HTML mark up and construct the tabs. Here’s the markup below: <html xmlns="http://www.w3.org/19... > <head runat="server"> <title>JQuery Demo</title> <link href="jquery-ui-1.8.1.custo... ......

Posted On Friday, July 9, 2010 4:22 PM

Introducing WebMatrix Beta
Microsoft has recently released the first beta version of WebMatrix. What is it? Taken from the WebMatrix official site: "WebMatrix is everything you need to build Web sites using Windows. It includes IIS Developer Express (a development Web server), ASP.NET (a Web framework), and SQL Server Compact (an embedded database). It streamlines Web site development and makes it easy to start Web sites from popular open-source apps. The skills and code you develop with WebMatrix transition seamlessly to ......

Posted On Wednesday, July 7, 2010 6:08 PM

MaskEditExtender and ClearMaskOnLostFocus
I was playing around with ASPNET AJAX MaskEditExtender control and ASPNET Validation controls when I was working with a profile page and doing some input validations. Everything seems to be fine until I was told to always retain the phone mask format in the TextBox. Here’s my code for Phone number masking: <asp:TextBox ID="TXTPhoneNumber" runat="server" MaxLength="13" ValidationGroup="GroupA" /> <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TXTPhoneNu... ......

Posted On Thursday, July 1, 2010 11:04 PM

Joined the 100,000 Recognition Points Club in the ASP.NET Forums

I am the fourth person who reached the 100,000 recognition points in the ASP.NET forums and I am really honored be one in the club. Feels great!

Posted On Monday, May 17, 2010 3:25 PM

Editing, Updating and Deleting Data in the Form using LINQ to SQL
In my previous example we talked about how to fetch data from database and how to populate the form with data using L2S. In this example I’m going to extend a little bit of what I have demonstrated in my previous example. Basically I’m going to show you the basic way on how to edit and delete data from the form and update the database using L2S technology. Since this is a continuation of my previous example so I would suggest you to refer that first before you go any further. STEP 1: Setting up the ......

Posted On Wednesday, May 5, 2010 4:52 PM

Why double quotes does not work in inline databinding statement?
Over the ASP.Net forums where I frequently participate, a member asked the difference between using single quotes and double quotes in a databinding expression. So I thought of sharing the answer that I have provided on that thread as a reference to others. Here's the actual question of the user: I have always been wondering what can be the reason behind the following? <asp:GridView runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:HiddenField runat="server" ......

Posted On Thursday, April 15, 2010 4:53 PM

Fetching Data from Database and Populating fields in the Form using LINQ to SQL
In my previous example I have demonstrated how to create a simple form that would allow users to insert data to the database using L2S. In this example I’m going to demonstrate how to fetch and filter data from database and fill the fields in the form using L2S. This example is basically a continuation of my previous example here. So I would suggest you to take a look at my previous example first before you proceed reading this example. STEP 1: Setting up the GUI To get started, add a new WebForm ......

Posted On Thursday, March 11, 2010 3:26 PM

Inserting Data to Database using LINQ to SQL
Few months ago, I’ve created a simple demo about “Creating a Simple Registration Form using the ADO.NET way”. In this article, I'm going to demonstrate how to create a simple form that would allows users to insert data to the database using L2S. As an overview, LINQ to SQL is a technology that allow you to query sql server. LINQ to SQL is an O/RM (object relational mapping) implementation that ships in the .NET Framework "Orcas" release, and which allows you to model a relational database using .NET ......

Posted On Thursday, March 11, 2010 3:12 PM

Pluralsight On-Demand Training library
Technorati Tags: General Pluralsight is an online .NET Training library which provides online training materials for .NET developers. Example trainings available on demand: · .NET 3.5 · Agile Team Practices · ASP.NET 3.5 · ASP.NET AJAX · ASP.NET MVC · BizTalk 2006 · BizTalk Server 2006 R2 · BizTalk Server 2009 · iPhone ASP.NET · LINQ · Managed Services Engine · Silverlight 3 · SharePoint Services · SQL Server 2008 · VSTS · WCF · Windows Server AppFabric, formerly "Dublin" · Windows Workflow · WPF ......

Posted On Friday, February 26, 2010 5:39 PM

Learning ASP.NET: Where to Begin?
Technorati Tags: ASP.NET,General I often see questions at forums(http://forums.asp.net) asking stuffs like: Where to begin? Where Do I start? How to Get Started? So I decided to write this "boring" post to express my opinion and hopefully this can help beginners find their way to get started with ASP.NET. Based on my experience learning ASP.NET is just like learning how to play a guitar.. (oh really? why could I say that? ).(1) First you must have this what we call "interest" because if you don't, ......

Posted On Friday, February 26, 2010 5:29 PM

Highlight Multiple Dates in Calendar and Make it Selectable
Recently, one of the members at forums.asp.net is asking how to highlight multiple dates in the ASP Calendar and make it selectable and make rest of the un-highlighted dates disabled. So I thought of sharing the solution that I have provided on that thread as a reference to others who might need it. Here's the code block below: C# public partial class _Default : System.Web.UI.Page { private List<DateTime> listDates; protected void Page_Load(object sender, EventArgs e) { //Suppose that you have ......

Posted On Monday, February 1, 2010 4:16 PM

FAQ: How to- Generate Dynamic TexBox in the Form and Save the values to Database
Few months ago I've been seeing many users in the forum asking how to generate dynamic textbox on the form and save the values to the database on Button click, so I've decided to write this post and wrap up all the examples that I wrote before on how to accomplish the task using different controls so that when I encounter such or similar questions again in the forum, I can simply refer them to this post. Here are those examples: Using ASP Table: FAQ: Dynamically Adding Rows in ASP Table on Button ......

Posted On Wednesday, January 27, 2010 7:49 PM

FAQ: Cross Browser GridView Fix Header and Footer with ASP.NET Ajax
Technorati Tags: ASP.NET,C#,GridView Many developers from the forums (forums.asp.net) are asking if how to implement fix header in GridView while scrolling. We all know that there are lots of examples out there that provide a solution that are available, however some of the solutions provided are not cross browser compatible. While searching for a cross browser solution, I found this article at devarchive.net and it seems very interesting to me. So I play around with the extender provided by devarchive ......

Posted On Wednesday, January 6, 2010 5:17 PM

Rank 3rd at the ASP.NET Community Hall of Fame
Wheew..looks like i've been so busy lately.. ;)... I never thought I’d achieve this, but I’ve somehow managed to get to the top 3 rank in ASP.NET Community Hall of Fame..This has been a very rewarding experience [~at least for me :) ]!Honestly, I really can't believe that I have helped hundreds, not only hundreds but I think thousands of geeks already within 2 years of contrinuting through forums at the official Microsoft ASP.NET site. Technorati Tags: Community ......

Posted On Sunday, December 6, 2009 8:11 PM

Limit the Number to be Selected in the ListBox control - (Server Side way)
One of the members in the forum (forums.asp.net) is asking how to limit the number of selected items in the ListBox and so contributors (including me) gave the OP (Original Poster) different ideas on how to validate it. Some of them provided solution using pure JavaScripts and a mixture of code behind and JavaScript. However the OP doesn’t want to use JavaScript validation for some reason, so I decided to post the solution that I have provided on that thread as a reference to others. Here it is: ......

Posted On Tuesday, November 24, 2009 2:52 PM

Hide Panel When Clicking Anywhere in the Page
This example shows how to hide a Div when clicking anywhere the page: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Untitled Page</title> <script type=”text/javascript”> function HideDiv(){ document.getElementById("Co... = 'none'; return false; } function ShowDiv(e){ document.getElementById("Co... = 'block'; if(!e){ e=window.event; } e.cancelBubble=true; return false; } </script> </head> ......

Posted On Sunday, October 18, 2009 2:22 PM

Move Multiple Rows Between GridViews
This example shows how to move multiple rows between GridViews. The main idea here is to use a CheckBox control for selecting the rows to be removed from one GridView to another and vise versa. Take a look at sample screen shots below: On initial load: Selecting rows from the left GridView: After Moving the selected rows to the right GridView: As you notice the selected rows are automatically sorted by its ID upon moving. Selecting rows from the Right GridView: After Moving the selected rows to the ......

Posted On Thursday, October 8, 2009 11:19 PM

How To: Reset Identity Column Value in SQL Table
Recently, one of the members at forums.asp.net is asking if how to reset identity count in sql table. So I thought of sharing the possible solution that we have discussed in this thread as a reference to others. HTH! Technorati Tags: ASP.NET,SQL,C# ......

Posted On Thursday, September 10, 2009 2:17 PM

BASIC: Binding ListBox and DropDownList using LINQ
This example shows the basic way on how to populate a data from database to a ListBox/DropDownList control using LINQ to SQL. Note that I used Northwind database here just for the simplicity of this example. To get started then let’s go ahead and add a new item in your website application in Visual Studio 2008 or VWD Express 2008. To do this, just right click on the web site -> select Add New Item -> and on the Templates select LINQ to SQL Classes as shown below and click ok: Now open up Server ......

Posted On Tuesday, September 1, 2009 6:33 PM

Passing Information from .HTM to ASPX page in ASP.NET
Just recently, one of the members at forums.asp.net is asking if how to pass data from .htm page to aspx page. So I decided to share with you of what we have discussed in this thread for a possible solution. Technorati Tags: ASP.NET ......

Posted On Wednesday, August 26, 2009 7:17 PM

How To: Prevent SQL Injection in ASP.NET
Mike Brind has written a very good example about "Preventing SQL Injection in ASP.NET". If you are new to Data Access manipulations in ASP.NET then I would strongly suggest you to read the article mentioned above. Technorati Tags: ADO.NET,ASP.NET,General ......

Posted On Wednesday, August 26, 2009 7:16 PM

Accessing Controls from ASPX to External JavaScript file
This example shows the basic way on how to access control from external javascript file (.js). Normally, we use the following line below when accessing control within our JavaScript method in the page. document.getElementById('&l... TextBox1.ClientID %>'); AFAIK, Using Inline expression like <% %> will not work within external js files. As a workaround we can pass the id of the control (eg. TextBox) to the funciton as a parameter instead like: External JS file: function GetControlValue(obj) ......

Posted On Tuesday, August 18, 2009 10:10 PM

Bind DataTable to DataList Control
This example shows how to bind a DataTable in a DataList control. Just for the simplicity of this demo I’m going to create a dummy data in the DataTable. See the code blocks below: private DataTable GetData() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new System.Data.DataColumn("Col... typeof(String))); dt.Columns.Add(new System.Data.DataColumn("Col... typeof(String))); dt.Columns.Add(new System.Data.DataColumn("Col... typeof(String))); dr = dt.NewRow(); dr[0] = "Column1 ......

Posted On Thursday, August 13, 2009 10:41 PM

Retain Leading Zeros when Converting from Int to String
Many members in the forums are asking if why is it that an integer value with a leading zero is being trimmed off when converting it to a string? Consider this example: int num = 0123456; // a 7 numbers string sNum = num.ToString(); //The result will give you 123456 What happened to the leading zero? Well basically, leading zero has no significance to an integer because by nature an integer with a value of 01 is simply the same as 1. So based on the example above we have an integer value of 0123456 ......

Posted On Wednesday, August 12, 2009 8:56 PM

UPDATED: Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality
In my previous post, I have posted the updated the codes about Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes because there is a bug on that. So obviously the codes in my other example about Adding a Delete functionality in Dynamic TextBoxes in GridView is affected. To fix the issue then you can refer to this updated code below: protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton lb = (LinkButton)sender; GridViewRow gvRow = (GridViewRow) lb.NamingContainer; int ......

Posted On Wednesday, August 12, 2009 5:21 PM

UPDATED: Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes
Well its seems that there is a little bug with my previous article about “ Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes “. The problem is that whenever you change the value of the previous data in the TextBox the updated values will not reflect on postbacks. So I have modified a bit of my codes at AddNewRowToGrid() and SetPreviousData() methods to fix the issue. Here are the code blocks below for the updates: private void AddNewRowToGrid() { int rowIndex = 0; if (ViewState["CurrentTable"] ......

Posted On Wednesday, August 12, 2009 5:08 PM

Removing Columns in DataTable
Recently, one of the members in the forum (http://forums.asp.net) is asking if how to remove a particular column in a DataTable if all values in the row of that column are null or empty. So I decided to post the solution that I have provided in that thread as a reference to others who encounter the same problem. Just for the simplicity of this demo, I created a sample DataTable with a dummy data on it just for us to test. Here’s the code block below: private DataTable CreateDataTable() { DataTable ......

Posted On Tuesday, August 11, 2009 8:32 PM

Hide WebPart Header and Border on BrowseDisplayMode
In order to hide those, we can set the BorderStyle and the PartChromeType attribute of the WebZone to none after we set the display mode of WebPartManager to browse just like below: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { WebPartManager1.DisplayMode = WebPartManager.BrowseDispla... foreach (WebPartZone wz in WebPartManager1.Zones) { wz.BorderStyle = BorderStyle.None; wz.PartChromeType = PartChromeType.None; } } } That’s simple! Technorati Tags: ASP.NET,WebParts,TipsTricks ......

Posted On Tuesday, August 11, 2009 8:31 PM

Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes
Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes

Posted On Monday, August 10, 2009 6:56 PM

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality
In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I’m going to show on how to delete a certain row in the dynamic GridView with TextBoxes. Note: Before reading this example, then be sure to refer my previous examples mentioned above so that you will have a basic idea on how does the ......

Posted On Sunday, August 9, 2009 6:47 PM

Why DataSet creates TableN as the Default Table name?
Few days ago I have encountered a question in asp.net forums asking if why does the DataSet creates a default name as Table1 well in fact the name doesn’t really exist in the database. So I thought I’d share the answer that I have provided in that thread as a reference to others. As the documentation states that: "Multiple Result Sets: If the DataAdapter encounters multiple result sets, it will create multiple tables in the DataSet. The tables will be given an incremental default name of TableN, ......

Posted On Monday, August 3, 2009 5:15 PM

Adding Line Breaks in JavaScript Alert and Confirm popup Message in ASP.NET
Ok it seems that lot’s of members at the forums is asking on how to display multi-line text in a JavaScript pop up box. So I decided to write this example so that other developers can reference it or if I encounter such a post in the forum then I can simply point them in this example. Check the following code blocks below: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Untitled Page</title> <script type="text/javascript" language="javascript"> ......

Posted On Monday, August 3, 2009 4:45 PM

Validate Image extensions upon Upload
In my previous two examples, we have learned on how to Upload and Save the Image to a Folder and path to database and how to Save the Image to the Database. The two previous examples only tackle the basics about uploading and saving a file without validating the file to be uploaded. In this example, I’m going to show on how to validate a file that only allows image files to be uploaded using server side validations. Here are the code blocks below: private void StartUpLoad() { if (FileUpload1.HasFile) ......

Posted On Monday, August 3, 2009 3:21 PM

Uploading and Storing Image Path to Database and Image to Folder - Part 2 (Displaying of Images)
In my previous example, we have learned on how to save the actual image to a folder and image path to the database. In this example, I’m going to show on how to display those images in a GridView and Repeater control. To get started, let’s create a method for fetching the image information from the database. Here’s the code block below: private DataTable GetData() { DataTable dt = new DataTable(); SqlConnection connection = new SqlConnection(GetConnection... try { connection.Open(); string ......

Posted On Sunday, August 2, 2009 5:55 PM

Uploading and Storing Image Path to Database and Image to Folder - Part 1
I decided to write this example because this has been asked many times at the forums. In my previous article I have shown on how to Upload and Save the Images to Database, In this article I will show on how to upload and save the image to folder and path to database. To get started, let’s create a simple database table for storing the Image information and path to the database. I this example I named the table as “ImageInfo” with the following fields below: Note:I set the Id to auto increment so ......

Posted On Sunday, August 2, 2009 4:58 PM

Save Dynamic TextBox Values from GridView to Database
In my previous article, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes. Now, seems that most of the developers are asking if how to save all the data that was entered from the dynamic textbox in the GridView to the database. So in this example, I’m going to show on how to save them all in the database. To get started then lets create a sample Table in SQL Server. In this example, I named the table as “SampleTable” with the following fields below: Note: I set the ......

Posted On Sunday, August 2, 2009 1:54 PM

My MVP Award Kit Arrived!
Today I received my MVP Award Kit from Microsoft. The kit consists of the following: * Certificate * MVP Plaque * MVP ID Card * MVP Badge I’m very excited and honored by having this reward as it shows recognition from Microsoft towards my continuous contribution in the ASP.NET community. Thanks to Microsoft! Technorati Tags: Community ......

Posted On Sunday, July 12, 2009 6:57 PM

Sorting GridView Manually with TemplateFields
I decided to write this example because this has been asked many times at the forums. In this article, I will show on how to sort GridView columns manually using a DataTable. Note that in this example, I used my own database for populating the GridView. See Adding Rows in GridView for more info. Now to get started lets set up the GridView with TemplateField columns. Since we are working with TemplateFields then we need to handle sorting manually by adding a LinkButton control inside the HeaderTemplate ......

Posted On Sunday, July 12, 2009 4:58 PM

ASP.NET WebPart FAQ
After a year of answering questions at the WebParts and Personalization forum section, I consider the following items below as “frequently asked questions”. I decided to write this so that I can point them to this post whenever I find a question that can be found here. The following are the list of items that I consider as FAQ: 1. How to Get Started with ASP.NET WebParts? ASP.NET Web Parts Overview ASP.NET WebPart Controls Implementing ASP.NET WebParts with Different Authentication modes Video: Utilizing ......

Posted On Thursday, July 9, 2009 6:16 PM

How To: Bind Collections to a DropDownList Control
In this example I’m going to show the basic way on how to bind a different collections to a DropDownList control. Note that you can also apply the code mentioned in this example to a ListBox, RadioButtonList and CheckBoxList. I just used DropDownList for this demo because I think it is the most commonly used in the page. To get started, let’s go ahead and grab a DropDownList control from the Visual Studio toolbox and place it in the WebForm. The ASPX mark up should look something like below: <html ......

Posted On Wednesday, July 8, 2009 6:47 PM

I am a Microsoft MVP
Today I got a pleasant surprise when I received an email from Microsoft stating that I have been awarded Microsoft MVP Award (ASP.NET) for 2009!! I still can't digest the news !! It was like a music to ears! This is the email I received . Dear Vincent Maverick S. Durano, Congratulations! We are pleased to present you with the 2009 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate ......

Posted On Wednesday, July 1, 2009 11:22 PM

Adding Dynamic Editable Rows in ASP Table with Multiple Delete
In my previous example, I wrote a simple demo on how to generate rows of TextBoxes in ASP Table on every click of the Button and retain the previous values on postbacks. In this article, I’m going to extend a bit of what I have shown in my previous example. Basically, I’m going to add multiple delete functionality in the Table by adding some rows of CheckBoxes. Here are the code blocks below: ASPX SOURCE VIEW: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Dynamic ......

Posted On Wednesday, July 1, 2009 5:05 AM

Adding Dynamic Rows in GridView with DropDownLists
Few days ago, a developer posts a comment in my previous article about “Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes” asking if how to implement the same functionality with DropDownList. In this example, I will going to show on how to generate a Row in GridView with DropDownList when clicking a Button that is residing inside a GridView Footer and retain the Selected Items of the DropDownList on postbacks. Here are the code blocks below: ASPX Source: <html xmlns="http://www.w3.org/19... ......

Posted On Tuesday, June 30, 2009 2:19 AM

FAQ: Dynamically Adding Rows in ASP Table on Button Click event
I decided to write this simple example because I always encounter this kind of issue at the asp.net forums including this thread: http://forums.asp.net/t/144... Basically this demo shows on how to generate rows of TextBoxes in ASP Table on every click of the Button and retain the entered values on postbacks. Here are the code blocks below: ASPX: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Dynamic Adding of Rows in ASP Table Demo</title> ......

Posted On Monday, June 29, 2009 2:27 AM

ASPNET WebPart FAQ: Accessing Controls from UserControls in ASPX page
I decided to write this example because I always encounter this type of questions at the asp.net WebParts and Personalization forums. Many of us have used UserControls as WebParts so that we can incorporate different server controls in a single WebPart element and there are times we need to retrieve or pass a value to a Control that‘s inside a UserControl. So in this example, I will show different ways on how to get or pass values to a control that is residing within a UserControl. Suppose that we ......

Posted On Thursday, June 25, 2009 1:17 AM

Ways on how to Hide AutoGenerateColumns in GridView.
I decided to write this example because this has been asked many times before at the forums. As you may know, we cannot "directly" hide AutoGenerateColumns in our codes using the code below: GridView1.Columns[index].Vi... = false; Why? This is because auto generated columns are not added in the GridView columns collection.Using the code above will give you "index was out of range error". In this example I will show the different ways on how to hide specific column in GridView with AutoGenerateColumns ......

Posted On Wednesday, June 24, 2009 8:14 PM

Fill ASP.NET Table with data from DataTable.
Few days ago, one of the members at asp.net forums ask if how to display the data that comes from the DataTable to a Table, so I decided to post the solution that I have provided there as a reference to others. In this example I’m going to create a DataTable by hand and define the columns and row values manually and then display data to the Table. Here are the code blocks below: private DataTable CreateDataTable() { DataTable dt = new DataTable(); DataRow dr = null; //Create the Columns Definition ......

Posted On Wednesday, June 24, 2009 8:03 PM

Moving ListItems between Two ListBox – Client Side Approach
This example demonstrates on how to move items between two ListBox using JavaScript. Here are the code blocks below: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>ListBox Demo</title> <script type="text/javascript" language="javascript"> function AddItemInList(fromLeftToRight, isAll) { var list1 = document.getElementById('&l... ListBox1.ClientID %>'); var list2 = document.getElementById('&l... ListBox2.ClientID %>'); if(Boolean(fromLeftToRight) ......

Posted On Tuesday, June 23, 2009 4:59 AM

Get All Server Control ID’s in the Page
This example shows on how to get all server controls ID in the page using recursive FindControl. Here are the code blocks below: protected void Page_Load(object sender, EventArgs e) { GetPageControlsID(Page); } public void GetPageControlsID(Control Parent) { string txBoxID = string.Empty; string ddListID = string.Empty; string lblID = string.Empty; System.Collections.Speciali... strColTxtBoxID = new System.Collections.Speciali... System.Collections.Speciali... ......

Posted On Tuesday, June 23, 2009 4:51 AM

Move TextBox Focus when Hitting Enter Key.
There are times that we need to use the enter key instead of using the Tab key for moving the focus of the TextBox controls from one to another to perform rapid data entry in the page. This example shows on how to achieve that with the use of JavaScript. Here are the code blocks below: ASPX: <html xmlns="http://www.w3.org/19... > <head id="Head1" runat="server"> <title>Demo</title... </head> <script type="text/javascript" language="javascript"> function controlEnter ......

Posted On Monday, June 22, 2009 9:09 PM

FAQ: How to Get Hidden Column values in GridView
I decided to write this simple demo because this issue has been asked many times at the forums. Hidden columns are fields in GridView that you don’t want to expose or show in the page, usually this field is the primary key of the data. Since a primary is a confidential data then you might want to hide it to the users. Most people usually use BoundField columns for displaying the data and just hide the field that contains the primary key. In this example, I will demonstrate two ways on how to access ......

Posted On Monday, June 22, 2009 5:57 AM

New ASP.NET Tutorial site
Just published few articles at ASP Snippets site. try to check the site and I'm sure you will find lots of useful articles there about ASP.NET... Good Luck! Technorati Tags: General ......

Posted On Monday, June 15, 2009 8:54 PM

Adding Rows in GridView with Edit, Update and Delete Functionality
This example is a continuation of my previous post about “Adding Rows in GridView”. In this example I will going to demonstrate on how we are going to do Edit, Update and Delete operations in GridView using TemplateField Columns. If you wan’t to implement those operations using BoundField Columns then you can refer to my previous example about “GridView: Insert, Edit, Update and Delete – the ADO.NET way”. Since this example is a continuation, then I would recommend you to start reading this example ......

Posted On Wednesday, June 10, 2009 2:28 AM

Adding Rows in GridView
This example shows on how to add rows of data in the GridView control. In this example, I created a simple database table called “Table1” for storing the data. The Table has the following columns: Id – PK Employees Position Team Note that I added some dummy data in table that I have created so that we can display something in the GridView when the page is loaded for the first time. To get started, let’s grab a GridView Control from the Visual Studio ToolBox and place it in the webform. Then set up ......

Posted On Tuesday, June 9, 2009 10:37 PM

Creating an Editable Label in ASP.NET
This demo shows on how to create an "Editable" Label in the page. As we all know, a Label control is intended for displaying read-only data information in the page and thus we cannot make it editable just like the TextBox control. As a workaround we can create a floating Div/Panel with a TextBox. Clicking on the Label will display a Div with a TextBox on it and a Button for updating the Text in the Label. In this demo, i used JavaScript for manipulating the elements in the page and apply a little ......

Posted On Tuesday, June 9, 2009 7:45 PM

Adding Dynamic Rows in GridView with TextBoxes
Introduction: I decided to write this article because this has been asked so many times before at the forums(http://forums.asp.net) . Basically, this example shows on how to generate a Row in GridView with TextBoxes when clicking a Button that is residing inside the GridView footer. To get started, let’s grab a GridView control from the Visual Studio Toolbox and put it in the WebForm. The mark up would look something like this: <asp:gridview ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false"... ......

Posted On Thursday, June 4, 2009 10:13 PM

Move AutoGenerate Columns at LeftMost Part of the GridView Columns
There are certain scenarios that we need to combine an AutoGenerated Columns with TemplateField Columns or even BoundField Columns in the GridView. As we all know, by default the GridView will automatically display all the AutoGenerated Columns to the rightmost column of the GridView. Consider this example below: Assuming that we have this GridView markup below: <asp:GridView ID="GridView1" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Button ID="Button1" ......

Posted On Wednesday, June 3, 2009 10:23 PM

Lists of WYSIWYG Editor
The following are the Lists of WYSIWYG Editor that you can pick: RadEditor (Telerik). AJAX-enabled. WebHtmlEditor (Infragistics). Cute Editor (CuteSoft) FreeTextBox (FreeTextBox.com). Free for basic edition. Source code available (for a price). Peter's Textboxes (Peter Blum). Suite of enhanced text box controls. UltimateEditor (Karamasoft) Asbru Web Content Editor (Asbru) ASP.Net XHTML WYSIWYG Editor (MoreNet) AspLib Component library (Astron Digital). Includes a WYSIWYG editor, among other things. ......

Posted On Wednesday, June 3, 2009 5:40 PM

How to: Generate Control Events that Resides within a GridView TemplateField
I decided to post this because this has been asked many times before at the forums. So for those who doesn't know how to generate a control event that are residing within the TempleFields of GridView then you can follow these few steps below: * Switch to Design View in Visual Studio Designer * Right Click on the GridView * Select Edit Template and then Select the Column where the Control that you wan't to generate the event resides (e.g Button, TextBox, etc..) * The GridView will then changed to ......

Posted On Tuesday, June 2, 2009 8:04 PM

Comparison Between Standard WebParts, ASPNET Futures WebParts and Custom WebParts in ASPNET 2.0
I decided to post this because I wan't to share this information that I have gathered during my investation about ASPNET WebParts last 2007. Maybe this will be useful for those who are using ASPNET WebParts in ASPNET 2.0. Basically this information shows the difference between the Standard WebParts that shipped in ASP.NET 2.0, ASPNET Futures and My Custom WebPart with Custom Verbs. Main OBJECTIVES: * Allows cross browser drag and drop capability (can be moved between WebZones) * Ajax enabled Findings ......

Posted On Monday, June 1, 2009 6:27 PM

Selecting One RadioButton Vertically and Horizontally
Recently I have encountered a question at the aspnet forums asking if how to select only one RadioButton vertically and horizontally in a Table.( see this thread). As you can see from that thread, the first solution that I was provided was to use a RadioButtonList Control because it allows you to set the RepeatColumns, RepeatDirection and RepeatLayout attributes. But unfortunately that doesn't actually meets the requirement of the Original Poster (OP). Basically the OP wanted to Select only one RadioButton ......

Posted On Monday, June 1, 2009 5:24 PM

Pre-Select Multiple ListBox items based on Database Value
I decided to write a simple demo about this because I always encounter this issue at the forums. Basically, this demo shows how to pre select multiple list items in the ListBox control based from database value. Assuming that we have this table definition with data below: As you can see, the Table has a "IsSelected" boolean field which indicates that a particular employee name is selected or not. Note that in this demo, I named the Table above as "Table1". Now lets set up our ListBox at the ASPX ......

Posted On Monday, June 1, 2009 1:45 PM

FAQ: Calculate Totals in GridView and Display it in Footer - Server side approach
I decided to write this post because I always encounter this kind of issue so many times before at the forums. The main question is that they want to automatically calculate the totals when a user enter an amount from the TextBox control that is residing in the GridView template. So this example shows the basic way on how to achieve this with the server side manipulations. Note that this demo requires that you know the basics of ADO.NET and for binding a GridView control with data from database. ......

Posted On Monday, June 1, 2009 1:20 PM

ListBox Control: Save Multiple Selected Items in the Database
This example shows the basics on how to save multiple selected items from the ListBox control to the database. Please note that this example requires a basic knowledge of ADO.NET. STEP 1: Setting up the User Interface (GUI) For the simplicity of this demo, I just set up the web form like below: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> Employee ......

Posted On Sunday, May 31, 2009 7:11 PM

Why Use DateTime.TryParse?
I decided to write this post because I always encounter some members in the forums.asp.net uses DateTime.Parse method when they try to convert a date string that comes from a TextBox value into a DateTime type (see this forum thread ). Please note that there are certain case why the DateTime.Parse method fails, consider this scenario below: * If the user enters a non valid date formats in the TextBox then the method DateTime.Parse will throw a FormatException because the method cannot recognize the ......

Posted On Wednesday, May 27, 2009 11:28 PM

Move ListItems Between Two CheckBoxLists
Recently I encounter question at the forums.asp.net asking if how to move selected ListItems from one CheckBoxList to another. So I decided to post the solution that I have provided in that thread so that others can refer this post if they will encounter the same thing. Here’s the code block below: ASPX: <table> <tr> <td> <asp:CheckBoxList ID="CheckBoxList1" runat="server"> <asp:ListItem>Player1... <asp:ListItem>Player2... <asp:ListItem>Player3... ......

Posted On Monday, May 25, 2009 2:42 PM

FAQ: Capturing Browser Close Event
Some time ago, I always encountered questions in the forums including this thread and this thread on how execute codes when a user closes the browser. AFAIK, the only events that you can use when the browser is closed is the onunload or the onbeforeunload event. The following code blocks below will simulates the closed button of the browser when the user invoked the button and display an alert message informing the user that the window is about to close.. Using the onunload event in the body element:<!DOCTYPE ......

Posted On Wednesday, May 20, 2009 6:24 PM

Pivot Data in GridView - A Generic Pivot Method with DataTable
This example shows how to “PIVOT” the original data that is displayed in the GridView. To start then lets grab two GridViews from the Visual Studio Toolbox and place it to your webform. The ASPX source would look something like this: ORIGINAL Table: <asp:GridView ID="GridView1" runat="server"> </asp:GridView><br /><br /> PIVOTED Table: <asp:GridView ID="GridView2" runat="server" ShowHeader="false"> </asp:GridView> Now, lets create the Generic method for Pivoting ......

Posted On Sunday, May 10, 2009 9:04 PM

Links to Read for Speeding Up your ASP.NET Application
Here are some useful articles that talks about how to improve the performance of ASP.NET Application. I also included here some links that talks about the best practices for speeding up your website. Improving ASP.NET Performance http://msdn.microsoft.com/e... Best Practices for Speeding Up Your Web Site http://developer.yahoo.com/... 10 ASP.NET Performance and Scalability Secrets http://www.codeproject.com/... 10 Tips for Writing ......

Posted On Thursday, May 7, 2009 8:41 PM

Add Spacing/Indention in DropDownList Items
The following code block below will allow you to display spacing or indention in the DropDownList items. protected void Page_Load(object sender, EventArgs e){ if (!Page.IsPostBack) { const string spaceChar = "&nbsp;&nbsp;&n... "; DropDownList1.Items.Add(new ListItem("Parent Item 1", "Parent Item 1")); DropDownList1.Items.Add(new ListItem("Parent Item 2", "Parent Item 2")); DropDownList1.Items.Add(new ListItem(Server.HtmlDecode(... + "Sub1 Item 2"), "Sub1 Item 2")); DropDownList1.Items.Add(new ......

Posted On Thursday, May 7, 2009 6:01 PM

Filter GridView Data based from Date Ranges
This example shows how to filter data in GridView based from two given dates. For example you have two Calendar Control which is allows you to select the Start Date and End Dates accordingly. These selected dates will then be displayed in TextBoxes and later on you wish to Grab the data from the database based from the dates (StartDate and EndDate) that is displayed in the TextBox and bind the result to a GridView control. Here are the code blocks below: private string GetConnectionString(){ //call ......

Posted On Thursday, May 7, 2009 5:11 PM

FAQ: Show Large Image on MouseOver using JavaScript
This example shows how to show a bigger Image when the mouse is hover into the original image. The trick here is we are just getting the path of the original image and set the actual size to a bigger size then display it in another Div. Check the code blocks below for your reference. <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Untitled Page</title> <script type="text/javascript" language="ecmascript"> function ShowBiggerImage(obj) { document.getElementById("La... ......

Posted On Thursday, May 7, 2009 4:49 PM

Save CheckBoxList Selected Items and Retain them on PostBacks.
I decided to write this example because I always encounter this kind of issues at http://forums.asp.net . This demo basically shows how to save the CheckBoxList selected items in the database and retain its selected items on postbacks or when the page is loaded again. To get started then lets start by creating the database for storing the data. STEP 1: Creating the database. Launch Sql Server Management Studion Express and then connect Expand the Databases folder from the Sql Server object explorer ......

Posted On Wednesday, May 6, 2009 9:15 PM

How to: Wrap the data of a Particular Column in GridView
One of the member at the http://forums.asp.net ask if how to wrap the data in the GridView Control. See this thread (http://forums.asp.net/t/14... I decided to post the solution that I was provided in that thread as a reference for all who needs a solution for the same issue. Here’s the code block below: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[0].Attributes.A... "word-break:break-all;word-... ......

Posted On Sunday, May 3, 2009 6:10 PM

How to: Disable Previous Dates in Calendar Control
Here an example on how to disable or set the calendar previous dates to not selectable. ASPX: <asp:Calendar ID="Calendar1" TodayDayStyle-Font-Underlin... runat="server" SelectionMode="None" OnDayRender="Calendar1_DayR... > <DayStyle Font-Underline="False" Wrap="False" /> </asp:Calendar> RELEVANT CODE: protected void Calendar1_DayRender(object sender, DayRenderEventArgs e){ if (e.Day.Date < DateTime.Now.Date){ e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; ......

Posted On Sunday, May 3, 2009 5:51 PM

Changing the Background Color of the Calendar Control based on the Dates from the Database.
I decided to write this example because I always encounter this kind of question at http://forums.asp.net/. This example basically changes the background color of the calendar dates based on the event dates from the database. You can tweak the codes provided in this example to suit your needs. Here are the code blocks below: protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { DataTable dt = GetDates(); DateTime eventDate; string eventType = string.Empty; if (dt.Rows.Count > ......

Posted On Sunday, May 3, 2009 5:41 PM

Links to Read before Working on Dynamic Controls in ASP.NET
I would like to share with you the following useful articles and FAQ's below about Dynamic Controls in ASP.NET: Dynamically Creating controls in ASP.NET http://support.microsoft.co... http://www.singingeels.com/... Truly Understanding Dynamic Controls http://weblogs.asp.net/infi... Key to ensuring dynamic ASP.NET controls save Viewstate - level 300 http://codebetter.com/blogs... ......

Posted On Sunday, May 3, 2009 3:33 PM

Creating a Simple Registration Form in ASP.NET
This example shows how to create a very simple registration form in ASP.NET WebForms. STEP1: Creating the Database. The following are the basic steps on how to create a simple database in the Sql Server: Launch Sql Server Management Studion Express and then connect Expand the Databases folder from the Sql Server object explorer Right click on the Databases folder and select “New Database” From the pop up window, input the database name you like and click add Expand the Database folder that you have ......

Posted On Thursday, April 30, 2009 8:09 AM

FAQ: Displaying Image from Database to GridView Control
I wrote this demo because I observed that lots of people in the forum (forums.asp.net) always ask questions on how to display Image that was stored in the database to GridView control. Before reading this example, be sure that you have already know how to upload image to the database. If you are not familiar with it then I would suggest you to read my previous example about “Uploading and Storing Images to Database in ASP.NET”. In this demo, we are going to use a Handler.ashx file for fetching the ......

Posted On Friday, April 24, 2009 8:52 AM

Displaying Image to Image Control based on User Selection in ASP.NET
This example is a continuation of my previous example about “Uploading and Storing Images to Database in ASP.NET”. In this demo, I’m going to show how to display image (binary format) from database to ASP Image control and display its corresponding image information based on user selection. In this demo, we are going to use a Handler.ashx file for fetching the binary data from the database and then stream it. What is a Handler? A handler is responsible for fulfilling requests from a browser. Requests ......

Posted On Friday, April 24, 2009 3:15 AM

Uploading and Storing Images to Database in ASP.NET
This example demonstrates how to upload image using the FileUpload control and store the uploaded file in the database in binary format. STEP 1: Creating the Database. The following are the basic steps on how to create a simple database in the Sql Server: Launch Sql Server Management Studion Express and then connect Expand the Databases folder from the Sql Server object explorer Right click on the Databases folder and select “New Database” From the pop up window, input the database name you like ......

Posted On Thursday, April 23, 2009 11:13 AM

Rank 5 at the ASP.NET Community Hall of Fame
I became one of the Top Community Members and reached the 5th level at the ASP.NET Community Hall of Fame after my 1 year and 6 months of contributing through forums at the official Microsoft ASP.NET site. This has been a very rewarding experience! I can't believe that I have helped hundreds, not only hundreds but I think thousands of people already in just a short period of time. I will continue contributing to the community while gaining more knowledge about ASP.NET technologies. I will start sharing ......

Posted On Monday, April 20, 2009 1:27 AM

Ways to Clear Control values in the Page.
This example shows the different ways on how to clear control values in the page. Here are the following approaches that you can use. 1. Creating a method that would loop through the page controls and clear its values accordingly like: private void ClearControls() { foreach (Control c in Page.Controls) { if (c.GetType().ToString() == "System.Web.UI.WebControls.... { TextBox tb = (TextBox)c; if (tb != null) { tb.Text = string.Empty; } } if (c.GetType().ToString() == "System.Web.UI.WebControls.... ......

Posted On Wednesday, April 15, 2009 1:10 AM

Enhanced Custom WebPartZone with Custom Move Option Verbs in ASP.NET 2.0
This example shows the enhanced version of my previous example about Creating Custom WebPartZones with Custom verbs (Move right/ Move Left). One of the most common issues with ASPNET WebPart in ASPNET 2.0 is the drag-and-drop functionality in firefox. As you may know the drag-and-drop feature of WebParts will not work in firefox once it is placed inside an UpdatePanel control. So in this article, I will show how are we going to move certain WebParts in different zones without the drag and drop functionality ......

Posted On Tuesday, April 14, 2009 12:20 PM

ASP.NET WebPart with Skins
This example demonstrates on how to apply Skins to ASP.NET WebParts. Before we begin let us first understand the concept of the skins in ASP.NET. What is a Skin file? A Skin enables us to modify any of the properties applied to the server controls in our ASP.NET page. Skins can work in conjunction with CSS files or images. To create a Theme we can use a single skin file in the Theme Folder. The skin file extension should be always .skin. For more information about ASPNET Themes and Skins then have ......

Posted On Tuesday, April 14, 2009 6:51 AM

Using Session to pass information between pages in ASP.NET
This example demonstrates the basics on how to store and retrieve data between pages using ASP.NET Session. As you may know there are lots of ways on how to pass information between pages and these includes the following: *Sessions *Querystrings *Cross-Page Posting *Cookies *Form Submit *Server.Transfer In this example, I'm going to show the basics on how to store the information in Session and retrieve the value of Session in the next page.. C# protected void Button1_Click(object sender, EventArgs ......

Posted On Tuesday, April 14, 2009 4:14 AM

Filtering Dates by Periods like (Today, Yesterday,This Week, Last Week, This Month)
This example below shows how to translate date period strings to date ranges based on the value selected from a DropDownList. ASPX: <html xmlns="http://www.w3.org/19... <head id="Head1" runat="server"> <title>Date Periods</title> </head> <body> <form id="form2" runat="server"> <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack ="true" AppendDataBoundItems="true" onselectedindexchanged="Dro... <asp:ListItem ......

Posted On Tuesday, April 14, 2009 3:52 AM

Passing and Retrieving Querystring using JavaScript in ASP.NET
This example shows on how to pass and retrieve query string values using JavaScript. Passsing QueryString to other pages with window.open JavaScript function <html xmlns="http://www.w3.org/19... <head id="Head1" runat="server"> <title>Passing Parameters between pages</title> <script type="text/javascript" language="javascript"> function PassValue() { var paramVal = "Hello ASPNET"; window.open("Default2.aspx?... + paramVal); } </script> </head> <body> ......

Posted On Tuesday, April 14, 2009 3:37 AM

Inserting and Removing ListItems in DropDownList using JavaScript
This demo shows on how to dynamically adding /removing ListItems in the ASP.NET DropDownList control using JavaScript. Here’s the mark up and the JavaScript code block below: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Dynamic DropDownList</title> <script type="text/javascript" language="javascript"> function AddItemInList() { var list = document.getElementById('Dr... var box = document.getElementById('Te... var newListItem ......

Posted On Tuesday, March 24, 2009 11:56 PM

Dynamically Adding TextBox Control to ASPNET Table
This demo shows how to generate a Table with TextBoxes dynamically based from the number of Columns and Rows entered from the TextBox control and print the values of the dynamically added TextBox on the page. See the screen shot below: To start, let’s declare the following global variables below: private int numOfRows = 0; private int numOfColumns = 0; Here’s the code block for the generating the Tables with TextBoxes. private void GenerateTable(int colsCount, int rowsCount){ //Creat the Table and ......

Posted On Tuesday, March 17, 2009 8:17 PM

Displaying two Column Fields in DropDownList Control
There are two basic ways on how to display two fields from database in the DropDownList. The first one is concatenating it in the sql query and the second one is concatening it programmatically in codes. Manipulating the sql query to concatenate two fields. Here’s the code block below. private void BindDropDownList() { DataTable dt = new DataTable(); SqlConnection connection = new SqlConnection(GetConnection... try { connection.Open(); string sqlStatement = "SELECT CustomerID + ' ---- ' + ......

Posted On Wednesday, March 11, 2009 4:15 PM

Tip/Trick: Show Header and Footer of GridView when no Data returned.
This example demonstrates how to show the Header and Footer of GridView when no data returned from the DataSet or DataTable. The trick here is to add a new blank row to the DataTable that you used as your DataSource if there was no data returned in your query. Here’s the method for showing the Header and Footer of GridView when no data returned in the query. private void ShowNoResultFound(DataTable source, GridView gv) { source.Rows.Add(source.NewR... // create a new blank row to the DataTable ......

Posted On Wednesday, March 11, 2009 4:10 PM

Tip/Trick: ASPNET Calendar Control with Multiple Date Selections
This demo shows on how to do multiple date selections in the standard ASP.NET Calendar Control. The basic idea here is we use List collection to hold the selected dates from the calendar control and store them into Session to keep the selected dates on postbacks and assigned the selected dates back based from the list values at SelectionChanged event.. Here's the code blocks below: First we need to declare the following namespace below for us to use the List Class using System.Collections.Generic; ......

Posted On Monday, March 9, 2009 3:56 PM

Search ListBox items using JavaScript
This example shows how to select ListItems in the ListBox based from the TextBox values using JavaScript. Here’s the code block below. <html xmlns="http://www.w3.org/19... > <head id="Head1" runat="server"> <title>Demo</title... </head> <script type="text/javascript" language="javascript"> function SearchList() { var l = document.getElementById('&l... ListBox1.ClientID %>'); var tb = document.getElementById('&l... TextBox1.ClientID %>'); if(tb.value ......

Posted On Wednesday, February 25, 2009 8:14 PM

Creating a Simple ShoutBox with MultiLine TextBox
Overview This demo explains how to create a simple ShoutBox using the ASP.NET MultiLine TextBox. A “ShoutBox” basically allow end users to post commentsin the page. To begin let’s create a WebUserControl and implement our ShoutBox there. Why UserControl? We used WebUserControl so that we can re-use and place the control anywhere in your page by simply dragging it to the WebForm. Step 1: Creating the Database In this demo, I presumed that you already have a basic background on how to create a simple ......

Posted On Tuesday, February 24, 2009 5:50 PM

Moving ListItems between Two ListBox – Server Side Approach
This example shows how to move items between two ListBox. Basically it allows you to add, remove and move multiple list items at a time. To start, let’s set up our GUI. Just for simplicity of this demo, I set up the web form like this: 1: <head runat="server"> 2: <title>Moving ListItems between two ListBox</title> 3: </head> 4: <body> 5: <form id="form1" runat="server"> 6: <div> 7: <table> 8: <tr> 9: <td ><asp:ListBox ID="ListBox1" runat="server" ......

Posted On Tuesday, February 24, 2009 5:41 PM

Adding Default Select Option in the DropDownList
This demo shows on how to add a default Select option in the DropDownList. I decided to write this sample demo because I always encounter this question at the ASP.NET forums. To make this work then you just need to set the property AppendDataBoundItems to TRUE in the DropDownList. Here’s an example for adding a Select option declaratively at the mark up. <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true"... <asp:ListItem Value="-1">Select</as... ......

Posted On Tuesday, February 24, 2009 5:37 PM

Binding DropDownList, ListBox and CheckBoxList Control the ADO.NET way.
This example shows how to bind DropDownList, ListBox and CheckBoxList control with data from database using the ADO.NET way. Note that in this demo, I’m using the Northwind database. Now let’s set up the connection string. STEP 1: Setting up the Connection string In your web.config file set up the connection string there as shown below: <connectionStrings> <add name="DBConnection" connectionString="Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirec... Integrated Security=True;User ......

Posted On Tuesday, February 24, 2009 5:31 PM

Tip/Trick: Highlighting GridView Rows on Mouseover
Here’s an example on how to highlight GridView rows on mousover at RowCreated or RowDataBound event of GridView by simply adding an attributes to the row. Here’s the code block: protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { string onmouseoverStyle = "this.style.backgroundColor... string onmouseoutStyle = "this.style.backgroundColor... if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmou... onmouseoverStyle); e.Row.Attributes.Add("onmou... ......

Posted On Tuesday, February 24, 2009 5:22 PM

Adding ASPNETDB.mdf file to SQL Server 2005
By default ASPNETDB will be automatically created under App_data directory in your application if personalization is use for the first time.If you wanted to locate ASPNETDB file in your Own Database (SQL Sevrer 2005) then just simply do the following -Copy the ASPNETDB that is located at the App_data Folder in your Apps and paste it anywhere in your drives.. the after copying -Remove the ASPNETDB in your App_Data folder -Open SqlServer 2005 or Studio Management Express -Right Click on Database Folder ......

Posted On Monday, February 23, 2009 4:40 PM

GridView Multiple Delete with CheckBox and Confirm
This demo describes how to implement multiple delete in GridView using CheckBox control and display a confirmation message upon deletion. Assuming that we have this GridView column mark up below <Columns> <asp:TemplateField> <HeaderTemplate> <asp:Button ID="ButtonDelete" runat="server" Text="Delete" /> </HeaderTemplate> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="CustomerID" ......

Posted On Sunday, February 22, 2009 2:01 AM

Display Confirmation Message on GridView Deleting
This demo describes the different approach to display a confirmation message when deleting a row in GridView and pass the id of the item to the confirmation message. Confirmation means a user is asked first if he/she wanted to delete a record by choosing an option (OK and CANCEL). In this demo, we use the JavaScript confirm function for displaying the confirmation message. Now let’s create our JavaScript confirm function. To do this switch to ASPX source and add the following code block within the ......

Posted On Sunday, February 22, 2009 1:52 AM

GridView Insert, Edit, Update and Delete – The Ado.Net way
This demo is a continuation of my previous example “Binding GridView with Data”. If you are not familiar of binding the GridView the ado.net way then I would suggest looking at my previous example first before you proceed to this example. Basically, this demo describes the basic way to do INSERT, EDIT, UPDATE and DELETE data in ASPNET GridView Control using the ADO.NET way. STEP 1: Creating a DataBase Table In this demo, I presumed that you already have a basic background on how to create a simple ......

Posted On Sunday, February 22, 2009 1:34 AM

Binding GridView with Data - The ADO.NET way
This example demonstrates how to populate GridView with data from the database using the ADO.NET way. Before you proceed reading this example be sure that you know the basics of ADO.NET manipulation. If you are not familiar with ADO.NET then I would suggest you to refer at the following link below: ADO.NET Tutorial STEP 1: Setting up the Connection String - Open your Web.config file and set up your connection string like below: <connectionStrings> <add name="MyDBConnection" connectionString="Data ......

Posted On Thursday, February 19, 2009 9:35 PM

Implementing ASP.NET WebParts with Different Authentication modes
Just follow these tutorials below regarding how to implement WebParts in ASP.NET based on different Authentication mode. WEBPART with Windows Authentication WEBPART with Anonymous Users WEBPART with FORM Authentication Good Luck! Technorati Tags: ASP.NET,WebParts ......

Posted On Tuesday, February 17, 2009 6:01 PM

Accessing Controls in GridView TemplateFields on GridView Edit Mode
This example demonstrates how to access ASP.NET server controls that resides within the TemplateField Column of GridView on Edit Mode. In this example we are using the PreRender event of GridView instead of RowEditing event since we cannot directly access controls at RowEditing event of GridView. See below for example: protected void GridView1_PreRender(object sender, EventArgs e){ if (this.GridView1.EditIndex != -1){ Button b = GridView1.Rows[GridView1.Ed... as Button; ......

Posted On Tuesday, February 17, 2009 5:35 PM

Displaying Wait Message on Page Load in ASP.NET
This example simulates on how to display a loading message with gif image when the page loads in ASP.NET. <html xmlns="http://www.w3.org/19... ><head id="Head1" runat="server"> <title>Load Wait Message Demo</title></head... type="text/javascript" language="javascript"> if(document.getElementById){ // IE 5 and up, FF var upLevel = true; }else if(document.layers) { // Netscape 4 var ns4 = true; } elseif(document.all) { //IE 4 var ie4 = true; } function ......

Posted On Tuesday, February 17, 2009 5:18 PM

Display Contents of MultiLine TextBox to Label Control and Retain its Line Breaks
This example demonstrates how to print or display the contents of the MultiLine TextBox in a Label Control and retain its line breaks. Basically MultiLine Mode of TextBox uses Environment.NewLine to create a new line. So if you try to display the values of TextBox in a Label Control or print it on the page and retain its position then you can replace the Environment.NewLine with <BR> Tag since Label control doesn't recognized Environment.NewLine. Here's a sample demo below for your reference: ......

Posted On Tuesday, February 17, 2009 5:04 PM

Automatically Adjust the Hieght of the TextBox based on its Contents
This example shows how we are going to set the Height of the MultiLine TextBox automatically when the contents of the TextBox is larger than the size of the TextBox. First thing you need is DON'T set the Height of the TextBox in the mark up (ASPX) and then do the following: C# protected void TextBox1_Load(object sender, EventArgs e){ int charRows = 0; string tbCOntent; int chars = 0; tbCOntent = TextBox1.Text; TextBox1.Columns = 10; chars = tbCOntent.Length; charRows = chars / TextBox1.Columns; int ......

Posted On Tuesday, February 17, 2009 4:50 PM

TextBox that Allows Only Numeric Inputs
This simple JavaScript function validates the TextBox input that allows only numeric values to be entered. <script type ="text/javascript" language="javascript" > function ValidateText(i) { if(i.value.length>0) { i.value = i.value.replace(/[^\d]+/g, ''); } } </script> In your textbox add the onkeyup event or onkeypress. <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_Tex... onkeyup = "javascript:ValidateText(th... Note: If you wan't ......

Posted On Tuesday, February 17, 2009 3:54 PM

Restrict number of characters to be entered in the MultiLine TextBox
This example shows how to limit the number of characters to be typed into the TextBox using JavaScript and display the remaining characters in a Label Control. <script type="text/javascript" language="javascript"> function validatelimit(obj, maxchar) { if(this.id) obj = this; var remaningChar = maxchar - obj.value.length; document.getElementById('&l... Label1.ClientID %>').innerHTML = remaningChar; if( remaningChar <= 0) { obj.value = obj.value.substring(maxchar... alert('Character ......

Posted On Tuesday, February 17, 2009 3:44 PM

Limit the Number to be Selected in the ListBox
This example shows how to limit the number of Listitems to be selected in the ListBox control. ASPX <html xmlns="http://www.w3.org/19... ><head runat="server"> <title>Untitled Page</title> <script type="text/javascript" language="javascript"> function GetCurrentItemsSelected(obj) { var o = obj; document.getElementById('&l... HiddenField1.ClientID %>').value = o; } </script></head>... <form id="form1" runat="server"> <asp:ListBox ......

Posted On Tuesday, February 17, 2009 3:19 PM

Get the Difference Between Two Time in ASP.NET
Here's an example (One Way) on how are we going to calculate the time difference between two give time: C# DateTime dFrom; DateTime dTo; string sDateFrom = "11:56:00"; string sDateTo = "12:12:00"; if (DateTime.TryParse(sDateFrom, out dFrom) && DateTime.TryParse(sDateTo, out dTo)) { TimeSpan TS = dTo - dFrom; int hour = TS.Hours; int mins = TS.Minutes; int secs = TS.Seconds; string timeDiff = hour.ToString("00") + ":" + mins.ToString("00") + ":" + secs.ToString("00"); Response.Write(timeDiff); ......

Posted On Tuesday, February 17, 2009 3:08 PM

AJAX Enabled WebParts and FireFox Drag and Drop
WebParts Cross- browser drag and drop is a very common issues on ASPNET WebPart Framework.. Basically WebParts doesn't support the Drag and Drop feature in Firefox browsers and this known to be a BUG for ASPNET Webpart Framework.. To get things working in all browsers including the cross browser drag-and-drop feature then you would need to use Visual studio 2008 / VWD 2008 with latest version of the Microsoft ASPNET Futures (AJAX Control Toolkit 3.5).. For more detail information then i would suggest ......

Posted On Friday, September 12, 2008 2:31 AM

Set Background Color for each ListItems of the DropDownList
The following snippet below describes on how we are going to set the ListItem Background Color based on the Color name displayed in the DropDownList ASPX MARKUP OF DROPDOWNLIST <asp:DropDownList ID="DropDownList1" AppendDataBoundItems="true" runat="server" AutoPostBack="True" OnSelectedIndexChanged="Dro... OnLoad="DropDownList1_Load"... <asp:ListItem Value="-1">Select</as... <asp:ListItem Value="0">Red</asp:Li... <asp:ListItem ......

Posted On Friday, September 12, 2008 2:10 AM

Formatting String number values to money in ASPNET
The following are ways on how to format string number values into a money format with decimals. Option 1: - Using String.Format method C# double formatToMoney; string num = "1500"; if (double.TryParse(num, out formatToMoney)) { string newNum = String.Format("{0:c}", formatToMoney); Response.Write(newNum); } VB.NET Dim formatToMoney As Double Dim num As String = "1500" If Double.TryParse(num, formatToMoney) Then Dim newNum As String = String.Format("{0:c}", formatToMoney) Response.Write(newNum) End ......

Posted On Friday, September 12, 2008 2:01 AM

Limiting the Data being displayed in the GridView and Display Tooltip
The following snippet below describes on how we are going to limit the Text displayed in the boundfield column of the GridView and display the original data in the ToolTip when user hovers the mouse for a particular cell. C# protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ViewState["OrigData"] = e.Row.Cells[0].Text; if (e.Row.Cells[0].Text.Length >= 30) //Just change the value of 30 based on your requirements { e.Row.Cells[0].Text ......

Posted On Friday, September 12, 2008 1:49 AM

Passing Multiple Querystring values with Response.Redirect method
Here's an example on how to pass Multiple querystrings in the page.. Page1 protected void Button1_Click(object sender, EventArgs e) { string strName = "VINZ"; string strAddress = "CEBU"; string strDate = DateTime.Now.ToShortDateStr... Response.Redirect(string.Fo... } The on Page2 you can get each values this way below protected void Page_Load(object sender, EventArgs e) { if ((Request.QueryString["para... ......

Posted On Friday, September 12, 2008 1:40 AM

Custom Login: Validating UserName and Password using the ADO.NET way
The snippet below describes on how we are going to validate the user credentials being supplied by the end user in Login page using the ADO.NET way.. C# protected void ValidateUserInfo(string user, string pass) { SqlConnection connection = new SqlConnection("YOUR CONNECTION STRING HERE"); string sql = "SELECT * FROM TableName WHERE UserID = @username AND Password = @password"; SqlCommand cmd = new SqlCommand(sql,connection); cmd.Parameters.AddWithValue... user); cmd.Parameters.AddWithValue... ......

Posted On Friday, September 12, 2008 1:26 AM

Bind TextBox and Label Control with Data from database
This sample snippet below describes on how we are going to Populate a TextBox and Label control in the page based on the data associated per user using the ADO.NET way.. C# private void getData(string user) { DataTable dt = new DataTable(); SqlConnection connection = new SqlConnection("YOUR CONNECTION STRING HERE"); connection.Open(); SqlCommand sqlCmd = new SqlCommand("SELECT * from TABLE1 WHERE UserID = @username", connection); SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd); sqlCmd.Parameters.AddWithVa... ......

Posted On Friday, September 12, 2008 1:16 AM

Manually Binding DropDownList based on the value selected on the first DropDownList
I decided to write this sample demo because I always encounter this kind of problem in the ASPNET Forum . So here's a sample (one way) solution on how to populate the second DropDownList based on the value selected on the first DropDownList using the ADO.NET way. Assuming that DropDownList1 contains the list of countries and we need to populate the list of States in a particular country based on the first DropDownList selection. protected void PopulateDropDownList1(){ string queryString = "SELECT ......

Posted On Thursday, September 11, 2008 10:56 AM

WEBPART: Count the number of Closed WebParts within PageCatalogPart
The following snippets below checks whether the PageCatalogPart Control contains any available WebParts in a page that have been closed in the page.. C# protected void PageCatalogPart1_Load(object sender, EventArgs e) { int count = 0; if (WebPartManager1.WebParts.C... > 0) { for (int i = 0; i < WebPartManager1.WebParts.Co... i++) { WebPart wp = (WebPart)WebPartManager1.We... if (wp.IsClosed) { Response.Write("Page Catalog contains Closed WebParts"); count++; } } Response.Write("<br/>... ......

Posted On Thursday, September 11, 2008 10:48 AM

Get the days difference between two Dates
Here's an example on how to get the date difference between two given dates using TimeSpan.C#protected void Page_Load(object sender, EventArgs e){ DateTime dFrom; DateTime dTo; string sDateFrom = "9/9/2007"; string sDateTo = "1/10/2008"; if (DateTime.TryParse(sDateFrom, out dFrom) && DateTime.TryParse(sDateTo, out dTo)) { TimeSpan TS = dTo - dFrom; int daysDiff = TS.Days; Response.Write(daysDiff.ToS... } }VB.NETProtected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim ......

Posted On Thursday, September 11, 2008 10:43 AM

Display Original Image Size in new window when clicking on the Image
The following snippet below will display the original Image size in new window when clicking on the image thumbnail using JavaScript.. JAVASCRIPT FUNCTION <script type="text/javascript" language="javascript"> function DisplayNewImageInWidnow() { var img = document.getElementById('&l... Image1.ClientID %>').src; html = "<HTML><HEAD>&l... + "</HEAD><BODY LEFTMARGIN=0 " + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTE... + "<IMG ......

Posted On Thursday, September 11, 2008 10:38 AM

Forcing Button Click event to fire up when pressing ENTER Key on TextBox
I decided to write this article because I always encounter this kind of problem in the ASPNET Forum frequently. So here's a simple (one way) solution on how to invoke the Button Click event when pressing the ENTER key in the TextBox control. ASPX Mark Up and JavaScript function <head> <title>Untitled Page</title> </style> <script type="text/javascript" language="javascript"> function controlEnter (obj, event) { var keyCode = event.keyCode ? event.keyCode : event.which ......

Posted On Thursday, September 11, 2008 10:31 AM

Binding one GridView with Different tables from the database based on user selection
Biding one GridView with Different tables from the database based on user selection By: Vincent Maverick Durano This article demonstrates on how are we going to bind a GridView with different data from different tables based from the selection in the RadioButonList.. In-order to achieve this functionality then we need to dynamically generates a boundfield columns because the GridView will have different datafields to display. Also note that Im using the Northwind database here just for demo. STEP ......

Posted On Wednesday, July 23, 2008 5:02 PM

Creating Custom WebPartZones with Custom verbs (Move right/ Move Left)
Creating Custom WebPartZones with Custom verbs (Move right/ Move Left) By: Vincent Maverick Durano Introduction: This article shows on how we are going to move a webpart from left or right directions in different zones without the drag and drop functionality of the standard webpart. In order to achieve this, we need to create a custom webpartzone with custom verb option “move right/move left” button. See Figure 1. Figure 1 The first thing to do is we need to create those custom verbs options by extending ......

Posted On Wednesday, July 23, 2008 4:42 PM

Adding Rows in GridView without using a Database
This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back. STEP 1: Add One TextBox, One Button and One GridView control the web form. The ASPX mark-up should look like these below <asp:TextBox ID="TextBox1" runat="server"/> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> <asp:GridView ......

Posted On Wednesday, May 7, 2008 6:22 PM

Adding Multiple Columns and Rows in GridView without using a Database
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back. STEP 1: Add Three TextBox, One Button and One GridView control the web form. The ASPX mark-up should look like these below <asp:TextBox ID="TextBox1" runat="server"/> <asp:TextBox ID="TextBox2" runat="server"/> <asp:TextBox ID="TextBox3" ......

Posted On Wednesday, May 7, 2008 6:19 PM

Creating Chart with Aspnet ReportViewer control
Introduction This article shows on how to generate a chart (a graphical representation of data) using the aspnet ReportViewer control. Basically, this report is called an rdlc file “Local Mode” which means that a report is generated at the client side and no connection established to the Sql Server Reporting Service Server. In this example, I am creating a report(chart) that would display the stock out movement. The page includes a DropDownList to allow users to filter a specific stock category that ......

Posted On Monday, February 4, 2008 2:04 AM

Creating an AJAX Enabled Webparts in Aspnet 2.0
Introduction: Most of the web applications nowadays prefer to be an AJAX enabled application. Ajax enabled applications is basically eliminates those annoying flickers occurred when a page is refreshed. This articles shows on how we are going make our webparts to be an ajax enabled one. Below are the steps in creating an Ajax enabled application. Open Visual Studio 2005 and Create new Website Select ASP.NET AJAX-Enabled Web Site then press OK (See Figure A) Figure A As what you have notice, the ScriptManager ......

Posted On Monday, February 4, 2008 1:44 AM

Creating a Simple Data Access Framework in ASP.NET
Introduction: This article describes on how to create a data access architecture using sqlclient objects that will returns a DataTable. It also discusses here on how to use and access a certain method in a particular class for you to manipulate the data into your codes. Please note that I am using the Northwind database here and all the codes in this article are written in C# language. STEP1: Adding a Class First, I added some folders under my App_Code folder to store some classes. This class includes ......

Posted On Friday, February 1, 2008 9:35 AM

Copyright © Vincent Maverick Durano | Powered by: GeeksWithBlogs.net | Join free