Web Application - iPad development resources

by marc walgren23. April 2013 05:16

We recently developed  a couple of warehouse support applications for a client. Not only was the application used in a regular desktop browser, but the warehouse personnel also accessed the application on an iPad out in the warehouse. The iPads were mounted on forklifts and connect to the internal network.

Several key resources we used include this article from the Safari Developers library:

https://developer.apple.com/library/safari/#technotes/tn2010/tn2262/index.html

We also tried these iPad simulators:

http://ipadpeek.com/

http://ipad-emulator.org/

We successfully overcame the challenge to balance the size of the controls and positioning on both browsing platforms.

Tags:

.NET | Development | General

Alternate for nbsp; when loading an xml file into a C# Xml Document

by marc walgren25. February 2013 07:41

I created an XML file to use as a template for building a page response for ASP.NET app we use internally. One of the requirements was to have an empty table cell  ("<td></td>"). The wrench in the works was the cell need to be underlined. As I modified the XML to include a "&nbsp;", visual studio displayed and error - "Entity nbsp not defined".

The first alternate I replace the "&nbsp;" with "&#160;" - the corresponding numeric value. Visual studio was happy but when I viewed the page response built with my template I discovered "Â " displayed.

To solve the "wrong" character display I need to force the character set as well. I had to add a meta tag into the head section of my XML

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

 

That did the trick for me.

 

Tags: , ,

.NET

Paging through a SQL result set

by jim morgan26. January 2013 14:38

For an application to browse a large dataset, you need to set a limit to the number of rows returned. As users page up and down through the results, the application needs to return the next block of results. This can be done with a Select with a Subquery. The Subquery have virtually no performance penalties over a straight query. The advantage is that you can use the TOP function to get the next block in the subquery, but return the results in a different order.

The key concepts here are:

1. Save the identifiers to the first and last row of the block for pagination.

2. To get the last or previous block, toggle the ASC/DESC on each element of the original order by.

3. To get the previous block, toggle the booleans <> in the Where Clause.

Examples of 30 row page blocks sorted by LastName, FirstName and SysID (to force uniqueness)

Last Page

SELECT * FROM (
    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    ORDER BY LastName DESC, FirstName Desc, SysID Desc) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

First Page

SELECT * FROM (
    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    ORDER BY LastName ASC, FirstName ASC, SysID ASC) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

Next Page

DECLARE 	@HighLastName varchar(30) = 'MidLN',
    @HighFirstName varchar(30) = 'MidFN',
    @HighSysID int = 1000;
SELECT * FROM (
    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    WHERE LastName > @HighLastName
        OR (LastName = @HighLastName AND FirstName > @HighFirstName)
        OR (LastName = @HighLastName AND FirstName = @HighFirstName AND SysID > @HighSysID)
    ORDER BY LastName ASC, FirstName ASC, SysID ASC) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

Previous Page

DECLARE 	@LowLastName varchar(30) = 'MidLN',
    @LowFirstName varchar(30) = 'MidFN',
    @LowSysID int = 1000;
SELECT * FROM (
    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    WHERE LastName < @LowLastName
        OR (LastName = @LowLastName AND FirstName < @LowFirstName)
        OR (LastName = @LowLastName AND FirstName = @LowFirstName AND SysID < @LowSysID)
    ORDER BY LastName DESC, FirstName DESC, SysID DESC) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

Summary
While you could certainly reduce these statements in verboseness, the optimization on the backend is negligible.
This patterns allows for a generic pagination function to be developed with nirtualy no added overhead.

Tags:

.NET | Development | General | SQL

Building ASP.NET Custom User Web Control

by marc walgren4. January 2013 01:00

I had an internal project that prompted for a start and end date. I also wanted to "pop-up" a calendar to make the date selection a bit easier. Since there were two date fields to enter and I didn't want to cut and paste code, I created a custom user control. (Thanks to Isaias Formicia-Serna and a CodeProject article from 2004 that got me started). 

 

Clicking the ellipsis bring up the calendar as pictured above. The custom control (ascx) contains all the markup for the controls. The code behind (ascx.cs) contains the page load, property and event handling code. 

A couple key tidbits.

* To access the particular properties of any control (like a text box) inside the custom control, use a public properties (setter or getter) in the custom control's code behind. 

public partial class CtlCalendar : System.Web.UI.UserControl
{
    #region public properties
    public string CalendarDate
    {
        get
        {
            return this.tbCtlCalendarDate.Text;
        }
        set
        {
            this.tbCtlCalendarDate.Text = value;
        }
    }
...

}

* Remember to "Register"  the custom control (ascx) in the page.

 <%@ Register TagPrefix="fbWebReports" TagName="CtlCalendar" Src="~/CtlCalendar.ascx" %>

Using the custom control is easy. Add markup for the custom control just like any standard control.

<fbWebReports:CtlCalendar ID="fbCalStartDate" runat="server" />

 

My source code is available for download.

CtlCalendarUserControl.zip (1.63 kb)

Tags:

.NET | Development

Contact Us  Consulting  Web Development  Data Collection  Flexible Web Lists  Clarion Products  Downloads  How To Order  Site Map  Store  Home
Copyright (c) 1989-2013 Mitten Software Inc., All rights reserved.

Month List