Justin Cooney

Web Development Tips and Examples

  • Why/How

    It can be useful to be able to call a JavaScript function after an ASP.NET event has completed, but it is not immediately intuitive how this can be done.

    Adding an onClientClick event to an ASP.NET button control will execute the JavaScript call before the ASP.NET server side code executes, so an alternate solution is required.

    For example today I was working on a WebForms page that has a Gridview presenting data, and that displays a detailed form page for each row in the GridView in an IFrame when one of the GridView rows is clicked. I use a FormView to handle the detailed form page information.

    After editing the data contained in the detailed form page, a user can click the save button at which point the FormView’s ASP.NET Update event is triggered, and then subsequently the button’s click event fires.

    (more…)

  • Overview:

    When working with ASP.NET Webforms the ability to quickly generate working forms that are bound to your datasource can be a huge advantage.

    Earlier I was creating a Webform in Visual Studio 2010, and as part of the process I dragged a SQLDataSource object onto my page, hooked it up to a stored procedure I had written, and then dragged a FormView control onto the page and associated the FormView with my SQLDataSource.

    The great thing is that I was able to simply click an option on my Form Designer control that populated the entire form for me. In Visual Studio it’s just that simple!

    I then just had to add my own styling for the page and convert some of my fields to editable textboxes and dropdown lists. In general this is incredibly fast and simple and allows you to add content to the Web quickly.

    I will go step by step through setting up a simple ASP.NET WebForms site and populating a form from a datasource (in this case a MS SQL Server Stored Procedure) without writing a single line of code.

    Step by Step; Here’s How:

    (more…)

  • Recently I was looking into some old VB6 code and for my own reference decided I’d put together a simple summary of how VB6 data types map to .NET data types.

    This is nothing new, but I thought it would be handy to have a quick comparison chart available. I obtained the information for this chart directly from the MSDN VB6 and MSDN VB.NET documentation pages (see below for the reference links).

    Here is the summary: (more…)