Thursday, July 21, 2011

The Canvas Tag

I'm taking my much belated first stabs at using the HTML 5 canvas tag from scratch, and I found a great site I thought I would share to get you going on the basics.

The basic elements of Canvas seem easy enough, putting it all together to make something unique and useful might be a different story.

And there are lots of great Canvas libraries out there, but I figured I'd start low level and work my way upward.

Wednesday, July 13, 2011

Remembering the COMBGuids

The new SQL Server 2005+ NewSequentialID() function is great because you can use GUIDs for primary key's without suffering the the query performance hit normally associated with using random values for primary keys due to ordering in tables. have to create these NewSequentialID's on the SQL side of things, which means that you have to pass them back to your web application, and sometimes that is problematic. It is much easier to create a GUID on the Web side of things before doing the insert, so that you have the key on the web side to access the just inserted data without having to have that key generated and then passed back to you.

For some of you what I'm saying will make absolutely no sense. For others, you see where I'm going. But with a technique known as COMBGuids, you can create sequential GUIDs for IDs on the web side and then pass them into your database.

Here is an implementation of COMBGuids that I've used in the past.

Tuesday, July 05, 2011

Using A ValidationSummary Control's ShowMessageBox (kinda) with Telerik Controls in Medium Trust

 I guess there is an issue with Validation Summaries and Telerik Controls.  If your site is running under Medium trust, you can't use the ShowMessageBox and instead you have to use the ShowSummary method.  I noticed this through off the styling of some of my controls once the error summary was rendered so I came up with a work around. Note be careful where you call this code else you will get an error, this worked for me using the FormView_ItemCommand.

ValidationSummary vs =
(ValidationSummary)MyFormView.Row.FindControl ( "myvalidationsummaryname" );
if ( vs != null )
  string sErr = vs.HeaderText  + "\\n";
  for ( int i = 0 ; i < this.Validators.Count ; i++ )
    if ( !this.Validators[ i ].IsValid )
      sErr += "* " + this.Validators[ i ].ErrorMessage + "\\n";
  myRadAjaxManager.ResponseScripts.Add ("alert('" + sErr + "');" );

That should get you going.