General

  • Hertz and Aerlingus team up for new project HertzFlyDrive.com, designed and developed by Dragnet Systems

    HertzFlyDrive.com - A new car rental site from Hertz and Aerlingus, designed and developed by Dragnet Systems

    After many months of work I'm proud to announce my latest project HertzFlyDrive.com. This website was designed from the ground up provide Hertz with a more effective way to manage their car rental booking information and help speed up the booking process for end users.

  • how to sort a DataTable by a specific column using C#

    The majority of the time when displaying content to the end user you will want to order the data by certain criteria. More often than not you will want to sort by a specific column. If your data is in a DataTable how do you do that?

    You need to convert your DataTable into a DataView, apply your sort and save the results back to your DataTable. Let's say we have a DataTable that holds details of all our customers and we want to order the information by their names. To keep things simple I will hard code in only 2 customer values here. You would order the information by doing the following:

    using System.Data;

    //create our datatable and setup with 2 columns

    DataTable dt = new DataTable();

    dt.Columns.Add("CustomerFirstname", typeof(string));

    dt.Columns.Add("CustomerSurname", typeof(string));

    DataRow dr;

    //store some values into datatable

    //just using 2 names as example

    dr = dt.NewRow();

    dr["CustomerFirstname"] = "John";

    dr["CustomerSurname"] = "Murphy";

    dt.Rows.Add(dr);

    dr = dt.NewRow();

    dr["CustomerFirstname"] = "John";

    dr["CustomerSurname"] = "Doe";

    dt.Rows.Add(dr);

    //check to make sure our datatable has at

    //least one value. For this example it's not

    //really need but if we were taking the

    //values from a database then this would be

    //very important!

    if (dt.Rows.Count > 0)

    {

    //convert DataTable to DataView

    DataView dv = dt.DefaultView;

    //apply the sort on CustomerSurname column

    dv.Sort = "CustomerSurname";

    //save our newly ordered results back into our datatable

    dt = dv.ToTable();

    }

    //display your datatable to the user by databinding

    //to repeater/gridview

  • How to get the values of HTML checkboxes within a Repeater using C#

    If you want to read in a bunch of HTML checkboxes that are in a repeater using C# then you need to add a runat="server" element to you checkbox input tag. For example:

    In your code behind you can now read in this element by using the following code:

    using System.Web.UI.HtmlControls;

    foreach (RepeaterItem currentControl in MyRepaterList.Items)

    {

    HtmlInputCheckBox MyCheckBox = new HtmlInputCheckBox();

    MyCheckBox = (HtmlInputCheckBox)currentControl.FindControl("CheckboxName");

    if (MyCheckBox.Checked)

    {

    //logic if checkbox is ticked here

    }

    }

    The above code will loop through all the HTML checkbox elements within your repeater. You can easily modify this to let you look for HTML textboxes (HtmlInputText), HTML radio buttons (HtmlInputRadioButton), etc.

  • Reddybrek.com gets a new look

    I've gone with a new theme on my blog to help give it more of a modern look. This theme is a relatively new one for BlogEngine so it looks a bit fresher than some of the other themes out there.

    Out of the box this theme had a few bits wrong with it that I needed to patch up - mainly the 'comments form' section. The CSS was missing a few classes for the form so the 'Comment' 'Preview' tabs were a bit all over the place in IE. Still, it beats coming up with a new design from scratch - and it was free - so I'm not complaining :)

    I also took the chance to upgrade my BlogEngine software to the latest version. This upgrade was so easy to do. Just run one database query and upload the files. That's it! I think it's the easiest upgrade I've ever made!!

    I have some new posts about jquery and C# coming in the next few weeks that I'm currently busy writing up. If you have any suggestions for articles to write over the next few months feel free to get in touch.

  • Latest Projects on the go at Dragnet Systems

    It's been a while since I've done a little update on the new projects we have on the go at the moment inside in Dragnet so I thought I'd give you a quick sneak peek at what's currently bubbling in our creative studios ;)

    As many of you know, we have our own online store software that is currently a huge success for us. We are delighted to be working on not just one but three new online stores that will all be launching in the next few weeks. Some of these new stores will have even more features like allowing wholesalers to order without payments, full stock integration with point of sales systems and more powerful search options so that customers can get around the store even easier! Surprisingly, two of the new stores are gardening themed.

    I have been busy myself working on a really big project for the last two months that will be ready to drop sometime in the next two weeks. This new project is for one of the world's largest car rental companies and is designed to help them manage their micro sites better than their current setup. It will offer customers more choice than the existing site and help speed up the booking process - which is something I'm really proud of. This was a really interesting project to work on because it was my first multilingual asp.net site that I've worked on. Over the next few weeks there will be some great posts going up about how to develop multiple language sites (what to watch out for, tips and tricks, etc) and new posts on the new jquery stuff I've learned from doing this new project.

    So exciting stuff all round. Everyone inside here is buzzed about this new car rental project as it has huge potential to make some waves for both us and our client. Stay tuned for more info in the next few weeks.

  • Solution to storing lots of form information between pages - Use a Dictionary Object and store it into a Session

    I am working on a site at the moment that requires me to store a lot of user entered values from form elements from one page to the next before a user can complete an order. This is unusual as normally the user just enters all the required values on one screen but for this particular project the design required the project to be setup to work like this.

    ViewStates or hidden fields are a nice way to store form values on post back but it's very hard to carry those values across to other pages. The Session object was my only choice.

    I currently use the asp.net session state service for all my projects. This is a little slower (around 10%-15%) than using the default session setup of in-proc but it has the advantage that the sessions themselves are a lot more stable and tend to last the right amount of time I set them to before they expire.

    The main issue I had with the design was that it is a high volume site and that the number one requirement was that this new site was quick to use. I had around 15 values that needed to be carried through the site after page one and around 5 more items to be gathered from pages 2 and 3 before sending the values off to a third party through XML. A database table would have worked except that it would have been slower than using a session and I had some values that were in dynamic Lists which would made it trickier to save into a table.

    I did some research and found that List objects are great but slow down if you store a lot of information in them so I decided to use a Dictionary object to hold the user values. I would then store this object into a Session to hold my values from page to page.

    It's quiet easy to setup a Dictionary object to hold these user values. First thing you need to do is setup the object. Once you've done that you can add new items to it very easily. Once you have stored all your items into your Dictionary object, simply store it in a session.

    To get your values out of your session all you have to do is:

    Although this isn't ideal, because of the current site setup I wasn't left with much of a choice but to go down this route. The downside to storing my values in a Dictionary object in a session using the State service is that every time I pull the item out of the session or store it to the session there is an overhead as .net serializes my data. It's a small price to pay though. On the plus side I have a setup that allows me to store a lot of variables but just use one session value to hold them.

    This particular project is on a brand new Win Server 2008 with buckets of memory and so far, thankfully, the site has worked and scaled up quite well for us.

  • Hide a submit button when clicked and show loading message using jQuery and asp.net

    This is a nice feature to add to your forms. One of the main reasons you might want to hide a submit button and display a message to the user is to stop them from clicking the button again which, depending on your code, could duplicate a request on the server. This isn't something you want to happen - especially if you're taking payments!

  • Uncheck all checkboxes when a page loads using jquery

    I am working on a project at the moment that requires checkboxes to do animations using jquery. It's all working fine unless I return to the page using the back button. As a work around I decided it would be best to just clear out any checkbox that were already selected. It's not ideal, but it saves me having to fire off an animation on page load which looks very slow as everything else on the page is loading in.

    To uncheck all of the checkboxes on your page using jquery all you need to do is use this code:

    $().ready(function() {

    //on page load uncheck any ticked checkboxes

    $("input:checkbox:checked").attr("checked", "");

    });

Get In Touch

Follow me online at TwitterFacebook or Flickr.

Latest Tweets