﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>DNNDev_Blog</title>
    <description>News, information, and thoughts about XMod and other DNNDev.com products as well as occasional articles on web and DotNetNuke development.</description>
    <link>http://www.dnndev.com/Blog/tabid/347/BlogId/3/language/en-US/Default.aspx</link>
    <language>en-US</language>
    <managingEditor>kford@knowbetter.com</managingEditor>
    <webMaster>kford@knowbetter.com</webMaster>
    <pubDate>Thu, 11 Mar 2010 02:45:39 GMT</pubDate>
    <lastBuildDate>Thu, 11 Mar 2010 02:45:39 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 3.5.1.19887</generator>
    <item>
      <title>Localization for Your DotNetNuke Solutions Made Easier With XMod Pro</title>
      <description>&lt;p&gt;It’s the holy grail of multi-language websites. If you’re running a French and English website, you want to present your French visitors with text in their language and your English visitors with text in their language. So, if you have built a real estate listing for your site, not only should labels (“Address”, “City”, “Number of Bedrooms”, etc.) be translated, but the actual data should be as well – like the description of the home.&lt;/p&gt;  &lt;p&gt;Content localization is a tricky thing to implement. While DotNetNuke (DNN) provides an architecture for dynamically changing the static text in your website, there historically hasn’t been a way to localize the data in your site. XMod Pro’s 2.1 release adds a host of options that should make localization much easier. As of this writing, version 2.1 is in beta and available for download for XMod Pro users to download from the Clients section on the site. &lt;/p&gt;  &lt;p&gt;Let’s start with the simple things:&lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Getting the Current Locale ID&lt;/h2&gt;  &lt;p&gt;To render the locale ID of the currently selected culture out to your form or view (template), use the [[Request:Locale]] token. If the user has selected Spanish from Mexico, the token will render "es-MX"; For English in Great Britain, it will be "en-GB"; for French spoken in France, it will be "fr-FR". You can use this in your Javascript, pass it around in URL’s, and store it in your database.&lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Formatting Dates and Values in Templates&lt;/h2&gt;  &lt;p&gt;While not new to version 2.1, XMod Pro provides the “format” tag which allows you to specify an Input culture and an Output culture – useful when converting dates and values to and from different cultures.&lt;/p&gt;  &lt;h2&gt;Localizing Dates in Forms&lt;/h2&gt;  &lt;p&gt;The DateInput control has a Culture property that enables you to accept dates in the specified culture’s format.&lt;/p&gt;  &lt;h2&gt;Localizing Static Text&lt;/h2&gt;  &lt;p&gt;If you just need to change the text that is displayed on your forms and views such as form labels or other text, you can use the [[Localize:keyName]] token in combination with resource files (.resx). The Localize token function like the other XMod Pro tokens. At run-time, it will be replaced with the translated text for the currently selected culture. &lt;/p&gt;  &lt;h4&gt;How it Works&lt;/h4&gt;  &lt;p&gt;First, you need to create a Resource File for each culture for which you have translations. Resource files follow the standard format for localization resource files in DotNetNuke. Files should be named using the following form:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;FormName.ascx.localeID.resx for forms or &lt;/li&gt;    &lt;li&gt;TemplateName.ascx.localeID.resx for templates &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Some examples:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;ContactUs&lt;/b&gt;.ascx.&lt;b&gt;es-MX&lt;/b&gt;.resx (Spanish-Mexico resource file) &lt;/li&gt;    &lt;li&gt;&lt;b&gt;EmployeeList&lt;/b&gt;.ascx.&lt;b&gt;fr-FR&lt;/b&gt;.resx (French-France resource file) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The resource file's base name must match the name of the form/templat to with which it is associated followed by ".ascx". This is then followed by "." plus the locale ID and ".resx". &lt;/p&gt;  &lt;h4&gt;Resource File Example:&lt;/h4&gt;  &lt;p&gt;The format of the resource file should follow that outlined for standard localization resource files in DotNetNuke. A sample file is provided below. The first section and the closing &lt;/root&gt; tag at the end, in gray, are boilerplate code and can be copied and pasted directly into your file. The highlighted section is the area you customize with your own text.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;pre class="brush: xml; highlight: [60,61,62,63,64,65,66,67,68];"&gt;&lt;root&gt;
  &lt;xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"&gt;
    &lt;xsd:import namespace="http://www.w3.org/XML/1998/namespace" /&gt;
    &lt;xsd:element name="root" msdata:IsDataSet="true"&gt;
      &lt;xsd:complexType&gt;
        &lt;xsd:choice maxOccurs="unbounded"&gt;
          &lt;xsd:element name="metadata"&gt;
            &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                &lt;xsd:element name="value" type="xsd:string" minOccurs="0" /&gt;
              &lt;/xsd:sequence&gt;
              &lt;xsd:attribute name="name" use="required" type="xsd:string" /&gt;
              &lt;xsd:attribute name="type" type="xsd:string" /&gt;
              &lt;xsd:attribute name="mimetype" type="xsd:string" /&gt;
              &lt;xsd:attribute ref="xml:space" /&gt;
            &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
          &lt;xsd:element name="assembly"&gt;
            &lt;xsd:complexType&gt;
              &lt;xsd:attribute name="alias" type="xsd:string" /&gt;
              &lt;xsd:attribute name="name" type="xsd:string" /&gt;
            &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
          &lt;xsd:element name="data"&gt;
            &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                &lt;xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /&gt;
                &lt;xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /&gt;
              &lt;/xsd:sequence&gt;
              &lt;xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /&gt;
              &lt;xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /&gt;
              &lt;xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /&gt;
              &lt;xsd:attribute ref="xml:space" /&gt;
            &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
          &lt;xsd:element name="resheader"&gt;
            &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                &lt;xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /&gt;
              &lt;/xsd:sequence&gt;
              &lt;xsd:attribute name="name" type="xsd:string" use="required" /&gt;
            &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
        &lt;/xsd:choice&gt;
      &lt;/xsd:complexType&gt;
    &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  &lt;resheader name="resmimetype"&gt;
    &lt;value&gt;text/microsoft-resx&lt;/value&gt;
  &lt;/resheader&gt;
  &lt;resheader name="version"&gt;
    &lt;value&gt;2.0&lt;/value&gt;
  &lt;/resheader&gt;
  &lt;resheader name="reader"&gt;
    &lt;value&gt;System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/value&gt;
  &lt;/resheader&gt;
  &lt;resheader name="writer"&gt;
    &lt;value&gt;System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/value&gt;
  &lt;/resheader&gt;
  &lt;data name="Name.Text" xml:space="preserve"&gt;
    &lt;value&gt;Nombre&lt;/value&gt;
  &lt;/data&gt;
  &lt;data name="Address.Text" xml:space="preserve"&gt;
    &lt;value&gt;Dirección&lt;/value&gt;
  &lt;/data&gt;
  &lt;data name="City.Text" xml:space="preserve"&gt;
    &lt;value&gt;Ciudad&lt;/value&gt;
  &lt;/data&gt;
&lt;/root&gt;&lt;/pre&gt;

&lt;p&gt;In the example above, we've created a small translation file for Spanish/Mexico. You can create one or more resource files for each language you need to provide translations for. Note that you should also provide a default resource file for your fallback language. Additionally, for the default/fallback language to be loaded properly, you should define a fallback language for each language you install in your DNN website.&lt;/p&gt;

&lt;p&gt;Within each file, for each block of text you want to translate, you must specify a &lt;data&gt; tag. This tag has a name property which contains the key name that XMod Pro will use to look up the translation. This name should be in the form "keyName.Text". The .Text portion is required for each of your names. The &lt;data&gt; tag also contains a &lt;value&gt; tag that contains the text you want to inject into the form or template. &lt;/p&gt;

&lt;h4&gt;Where to Place the Resource File&lt;/h4&gt;

&lt;p&gt;Once you've created your resource file, save it in the same directory in which your form/template is stored. For forms, this is: /Portals/_default/XModPro/Forms/XX where "XX" is the Portal ID. For templates, the folder is: /Portals/_default/XModPro/Templates/XX where "XX" is the portal's ID.&lt;/p&gt;

&lt;h4&gt;Linking Your Form/Template to the Resource File&lt;/h4&gt;

&lt;p&gt;In your form/template, you would simply add a localization token wherever it was needed - like so:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&lt;AddForm&gt;
...
   &lt;Label for="NameTextBox" text='[[Localize:Name]]'/&gt;
   &lt;TextBox id="NameTextBox" DataField="Name" DataType="String" /&gt;&lt;br /&gt;
   &lt;Label for="AddressTextBox" text='[[Localize:Address]]'/&gt;
   &lt;TextBox id="AddressTextBox" DataField="Address" DataType="String" /&gt;&lt;br /&gt;
   &lt;Label for="CityTextBox" text='[[Localize:City]]'/&gt;
   &lt;TextBox id="CityTextBox" DataField="City" DataType="String" /&gt;&lt;br /&gt;
...
&lt;/AddForm&gt;&lt;/pre&gt;

&lt;p&gt;At run-time, if the user has selected es-MX as his/her culture, then those tokens will be replaced by: Nombre, Dirección, Ciudad.&lt;/p&gt;

&lt;h2&gt;Content Localization Using Multiple Forms/Templates&lt;/h2&gt;

&lt;p&gt;Content localization is a tricky issue. It is potentially more complicated when an application like XMod Pro, does not have control over the data. To keep things as simple and flexible as possible, we have implemented the ability to use multiple forms and/or templates for this purpose. At run-time, XMod Pro will look to see if a form/template has been defined for the currently selected culture. If found, that file will be loaded. If not, XMod Pro will load the 'default' file. &lt;/p&gt;

&lt;p&gt;This method has many benefits:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;You can avoid having to create Resource Files and use [[Localize:keyName]] tokens. &lt;/li&gt;

  &lt;li&gt;You can create the forms/templates just as you do standard forms and templates &lt;/li&gt;

  &lt;li&gt;You have the opportunity to define distinct data commands for each culture. You could even write/read from distinct culture-specific database tables. &lt;/li&gt;

  &lt;li&gt;You can have a completely different layout and even completely different controls for each culture. &lt;/li&gt;

  &lt;li&gt;You can send notification emails to different addresses based on the culture. &lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;How It Works&lt;/h4&gt;

&lt;p&gt;First, define the form/template that will be your 'default' or 'fallback' file using the tools within XMod Pro.&lt;/p&gt;

&lt;p&gt;Second, either create another form/template from scratch or simply copy your form/template to act as a starting point. This second file must follow the following naming convetion:&lt;/p&gt;

&lt;p&gt;BaseName.localeID&lt;/p&gt;

&lt;p&gt;Where "BaseName" is the name of your 'default' form/template and "localeID" is the ID of the culture (es-MX, fr-FR, en-GB, etc.)&lt;/p&gt;

&lt;p&gt;So, for a form called "ContactUs", you might create the following forms:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ContactUs   (the default form) &lt;/li&gt;

  &lt;li&gt;ContactUs.es-MX   (Spanish in Mexico) &lt;/li&gt;

  &lt;li&gt;ContactUs.fr-FR     (French in France) &lt;/li&gt;

  &lt;li&gt;ContactUs.en-GB   (English in Great Britain) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The default file is always required. You can create as many or as few localized files as you need. Simply define your localized forms/templates as you would any other form/template, making changes as needed to accommodate the language&lt;/p&gt;

&lt;h4&gt;Configuring Your Module to Use Localized Forms/Templates&lt;/h4&gt;

&lt;p&gt;There is nothing special that you need to do when configuring your XMod Pro modules to use the localized forms and templates. Simply select the BASE form/template. If a localized version of the form/template exists and it matches the user's currently selected culture, that form/template will be loaded automatically. You can also force a certain localized file to be loaded by selecting it specifically on the configuration page.&lt;/p&gt;

&lt;p&gt;That's all there is to it.&lt;/p&gt;&lt;div class="d_itc_f" style="clear:both;height:11px;"&gt;&lt;script src="/DesktopModules/itcMetaPost/js/mg.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/131/Localization-for-Your-DotNetNuke-Solutions-Made-Easier-With-XMod-Pro.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/131/Localization-for-Your-DotNetNuke-Solutions-Made-Easier-With-XMod-Pro.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/131/Localization-for-Your-DotNetNuke-Solutions-Made-Easier-With-XMod-Pro.aspx</guid>
      <pubDate>Tue, 23 Feb 2010 16:08:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=131</trackback:ping>
    </item>
    <item>
      <title>Our Pro DotNetNuke Forms Module Just Got A Whole Lot Better</title>
      <description>&lt;p&gt;Have you heard the news? We've just released XMod Pro 2.0.  Just like we've done with XMod, we are letting our customers guide XMod Pro's development. In this release, you will see dramatic improvements in your ability to quickly create forms and views from your DotNetNuke databases. The best news is that, because of our policy of providing a year of upgrade protection to our customers, all XMod Pro 1.x owners get 2.0 for FREE. Read on for a list of new features&lt;/p&gt;&lt;a href=http://dnndev.com/Blog/tabid/347/EntryId/129/Our-Pro-DotNetNuke-Forms-Module-Just-Got-A-Whole-Lot-Better.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/129/Our-Pro-DotNetNuke-Forms-Module-Just-Got-A-Whole-Lot-Better.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/129/Our-Pro-DotNetNuke-Forms-Module-Just-Got-A-Whole-Lot-Better.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/129/Our-Pro-DotNetNuke-Forms-Module-Just-Got-A-Whole-Lot-Better.aspx</guid>
      <pubDate>Tue, 26 Jan 2010 05:13:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=129</trackback:ping>
    </item>
    <item>
      <title>New Editor Highlights XMod Pro 1.4 Release</title>
      <description>&lt;p&gt;Since it's initial release, XMod Pro (XMP) for DotNetNuke (DNN) has been keeping to a pretty regular schedule of a significant release every month – in addition to more frequent maintenance releases. Since all XMod Pro owners automatically have upgrade protection for one full year, all our customers and their clients have been enjoying the latest new features for free. This month is our biggest feature release yet.&lt;/p&gt; &lt;a href=http://dnndev.com/Blog/tabid/347/EntryId/127/New-Editor-Highlights-XMod-Pro-1-4-Release.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/127/New-Editor-Highlights-XMod-Pro-1-4-Release.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/127/New-Editor-Highlights-XMod-Pro-1-4-Release.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/127/New-Editor-Highlights-XMod-Pro-1-4-Release.aspx</guid>
      <pubDate>Mon, 26 Oct 2009 13:00:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=127</trackback:ping>
    </item>
    <item>
      <title>Extending XMod Pro Part 1: Custom Form Controls</title>
      <description>&lt;p&gt;Now that XMod Pro (XMP) for DotNetNuke (DNN) has been out for a few months, I'm starting to get a few questions about leveraging it's extensibility. Thus far, I've been responding to requests directly and haven't yet created any documentation for wider distribution. This series will help rectify that. We'll start with the most popular extension – custom form controls.&lt;/p&gt; &lt;a href=http://dnndev.com/Blog/tabid/347/EntryId/125/Extending-XMod-Pro-Part-1-Custom-Form-Controls.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/125/Extending-XMod-Pro-Part-1-Custom-Form-Controls.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/125/Extending-XMod-Pro-Part-1-Custom-Form-Controls.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/125/Extending-XMod-Pro-Part-1-Custom-Form-Controls.aspx</guid>
      <pubDate>Tue, 13 Oct 2009 17:20:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=125</trackback:ping>
    </item>
    <item>
      <title>MaxLength for TextArea in XMod Pro and XMod</title>
      <description>&lt;p&gt;With XMod Pro and XMod, you can limit the length of the text entered through a &lt;textbox&gt; (&lt; input &gt; for XMod). However, you cannot limit the length of text in a &lt; textarea &gt;. The reason stems from the underlying TEXTAREA HTML tag that is ultimately rendered for the control which has no maxlength property unlike the HTML INPUT tag which does.  Fortunately, both XMod Pro and XMod provide a way for you to implement a maximum length for the control.&lt;/p&gt; &lt;a href=http://dnndev.com/Blog/tabid/347/EntryId/123/MaxLength-for-TextArea-in-XMod-Pro-and-XMod.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/123/MaxLength-for-TextArea-in-XMod-Pro-and-XMod.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/123/MaxLength-for-TextArea-in-XMod-Pro-and-XMod.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/123/MaxLength-for-TextArea-in-XMod-Pro-and-XMod.aspx</guid>
      <pubDate>Fri, 09 Oct 2009 17:34:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=123</trackback:ping>
    </item>
    <item>
      <title>XMod Pro Problem Solving – Edit Form Always Edits Last Record In Table</title>
      <description>&lt;p&gt;No matter what application we're using, when we run into a problem, it becomes necessary to do a little fact-finding, trying to discover what is causing the problem. XMod Pro is no different in this regard. Knowing where to look can greatly speed up the amount of time it takes to resolve an issue. &lt;/p&gt;  &lt;p&gt;I received this question from a customer and not only wanted to post the solution but also provide a couple of things to look for should you encounter similar problems:&lt;/p&gt;  &lt;p&gt;"When I attempt to edit any record in my list, the edit form always shows the last record in the table. I followed the examples in creating the forms and templates and have checked my work many times over."&lt;/p&gt;  &lt;p&gt;The customer then supplied me with the form and template that was being used. The first thing I did was scan the Template for the Edit button. I wanted to ensure the Edit button (in this case it was an &lt;xmod:EditImage&gt; control) was properly formed:&lt;/p&gt;  &lt;pre class="brush: xml;"&gt;&lt;ItemTemplate&gt;
  ...
  &lt;xmod:editimage imageurl="~/images/edit.gif"&gt;
    &lt;parameter name="ContractorID" value='[[ID]]'/&gt;
  &lt;/xmod:editimage&gt;
...

&lt;/ItemTemplate&gt;&lt;/pre&gt;

&lt;p&gt;The customer was also using the Alternating template so I checked that as well:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&lt;AlternatingItemTemplate&gt;
  ...
  &lt;xmod:editimage imageurl="~/images/edit.gif"&gt;
    &lt;parameter name="ContractorID" value='[[ID]]'/&gt;
  &lt;/xmod:editimage&gt;
  ...
&lt;/AlternatingItemTemplate&gt;&lt;/pre&gt;

&lt;p&gt;Both of the tags look fine. They're well-formed with no syntax issues. The value attribute of the &lt;parameter&gt; tag is using a Field Token and that is properly delimited by single quotes. More importantly, it provides us with vital information we can use in the rest of our debugging. The tags are passing a parameter to the EditForm called "ContractorID". The value of the parameter is set to the "ID" column of the current record.&lt;/p&gt;

&lt;p&gt;The customer isn't reporting any errors being thrown when trying to edit the record. In fact, a record seems to be retrieved - it's just the last record each time. So, this step probably isn't required but since we're looking at the template, let's just check the &lt;ListDataSource&gt; to ensure the "ID" column is being retrieved:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&lt;listdatasource commandtext="EXEC dbo.GetContractorList" /&gt;&lt;/pre&gt;

&lt;p&gt;Well, since the customer is calling a stored procedure, there's no immediate confirmation that the "ID" column is being retrieved.  The next step would be to look at the stored procedure and verify "ID" is being returned from the procedure. Since the ID retrieval doesn't appear to be a problem in our case, we can move on and look at the EditForm.&lt;/p&gt;

&lt;p&gt;Specifically, we need to look at the &lt;EditForm&gt;'s &lt;SelectCommand&gt;. This is the command that is executed when the EditForm is loaded. It's job in an edit form is to retrieve a single record for editing.&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&lt;EditForm&gt;
  ...
  &lt;SelectCommand CommandText="SELECT [ID], [Company], [Address1], [City], [State], [Zip], [Phone], [Fax], [Email], [DateModified] FROM [dbo].[Contractor]" /&gt;
  ...
&lt;/EditForm&gt;&lt;/pre&gt;

&lt;p&gt;Now we see the problem. This command does not limit the records being retrieved. It simply pulls every record from the Contractor table. Instead, it should be using the information passed from the Edit button in the template. So, let's rewrite the SelectCommand:&lt;/p&gt;

&lt;pre class="brush: xml; highlight: [4];"&gt;&lt;SelectCommand CommandText="SELECT [ID], [Company], [Address1], [City], [State], [Zip], 
  [Phone], [Fax], [Email], [[DateModified] 
  FROM [dbo].[Contractor] 
  WHERE [ID]=@ContractorID" /&gt;&lt;/pre&gt;

&lt;p&gt;The only change I made is highlighted above. This uses the same name as the parameter in the &lt;xmod:EditImage&gt; that we saw earlier in this article.&lt;/p&gt;

&lt;p&gt;To sum up, here are the key items to look at:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The Edit button (or image or link) in your template that you're clicking to call up the edit form &lt;/li&gt;

  &lt;li&gt;The Edit button must contain a parameter that will be used by your &lt;EditForm&gt;'s SelectCommand. &lt;/li&gt;

  &lt;li&gt;Verify the value of the Edit button is actually being retrieved in the template. &lt;/li&gt;

  &lt;li&gt;Look at the &lt;EditForm&gt;'s &lt;SelectCommand&gt; tag. The CommandText should use the Edit button's parameter to limit the records being returned (usually via a WHERE clause) &lt;/li&gt;

  &lt;li&gt;The parameter name in the SelectCommand's CommandText must match the parameter name in the Edit button. &lt;/li&gt;
&lt;/ol&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:34ebca4b-5b8a-4898-b283-8835019f7ae5" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/XMod+Pro" rel="tag"&gt;XMod Pro&lt;/a&gt;,&lt;a href="http://technorati.com/tags/DotNetNuke" rel="tag"&gt;DotNetNuke&lt;/a&gt;,&lt;a href="http://technorati.com/tags/DNN" rel="tag"&gt;DNN&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Blog" rel="tag"&gt;Blog&lt;/a&gt;&lt;/div&gt;&lt;div class="d_itc_f" style="clear:both;height:11px;"&gt;&lt;script src="/DesktopModules/itcMetaPost/js/mg.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/122/XMod-Pro-Problem-Solving-ndash-Edit-Form-Always-Edits-Last-Record-In-Table.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/122/XMod-Pro-Problem-Solving-ndash-Edit-Form-Always-Edits-Last-Record-In-Table.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/122/XMod-Pro-Problem-Solving-ndash-Edit-Form-Always-Edits-Last-Record-In-Table.aspx</guid>
      <pubDate>Wed, 30 Sep 2009 13:07:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=122</trackback:ping>
    </item>
    <item>
      <title>Opening A Compiled Help File</title>
      <description>&lt;p&gt;I still create compiled help files for most of DNNDev.com's modules, including XMod and XMod Pro. The primary reason for this is to provide a single-file solution that has a clickable table-of-contents and topics that can link to one another. However, security changes at Microsoft make compiled help files tricky to open for some people. Here's how to open them&lt;/p&gt; &lt;a href=http://dnndev.com/Blog/tabid/347/EntryId/120/Opening-A-Compiled-Help-File.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/120/Opening-A-Compiled-Help-File.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/120/Opening-A-Compiled-Help-File.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/120/Opening-A-Compiled-Help-File.aspx</guid>
      <pubDate>Tue, 29 Sep 2009 18:18:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=120</trackback:ping>
    </item>
    <item>
      <title>XMod Pro 1.3 Released</title>
      <description>&lt;p&gt;A new week and a new version of XMod Pro for your DNN'ing pleasure. What's new and changed for the 1.3 version of XMod Pro for DotNetNuke (DNN)? Read On…&lt;/p&gt; &lt;a href=http://dnndev.com/Blog/tabid/347/EntryId/119/XMod-Pro-1-3-Released.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/119/XMod-Pro-1-3-Released.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/119/XMod-Pro-1-3-Released.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/119/XMod-Pro-1-3-Released.aspx</guid>
      <pubDate>Mon, 28 Sep 2009 13:00:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=119</trackback:ping>
    </item>
    <item>
      <title>XMod Pro 1.3 Status Update</title>
      <description>&lt;p&gt;This is just a quick note to give you the current status of the upcoming release of XMod Pro 1.3. I had originally hoped to have the version release by today. However, I wasn't happy with the syntax for using data from the &lt;SelectCommand&gt; within your forms. I'm currently working to simplify it. I have also found a way to catch more of those elusive errors and am working on that implementation. Assuming all goes well, I'm still looking to release sometime this week.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:04ba2c3a-82a1-468a-9437-fa3e3c047f98" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DotNetNuke" rel="tag"&gt;DotNetNuke&lt;/a&gt;,&lt;a href="http://technorati.com/tags/DNN" rel="tag"&gt;DNN&lt;/a&gt;,&lt;a href="http://technorati.com/tags/XMod+Pro" rel="tag"&gt;XMod Pro&lt;/a&gt;&lt;/div&gt;&lt;div class="d_itc_f" style="clear:both;height:11px;"&gt;&lt;script src="/DesktopModules/itcMetaPost/js/mg.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/118/XMod-Pro-1-3-Status-Update.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/118/XMod-Pro-1-3-Status-Update.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/118/XMod-Pro-1-3-Status-Update.aspx</guid>
      <pubDate>Thu, 24 Sep 2009 17:04:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=118</trackback:ping>
    </item>
    <item>
      <title>Blogging From My Desktop, Laptop and iPhone</title>
      <description>&lt;p&gt;With the recent upgrade of DNNDev.com to DNN 5, I've updated a number of modules – among them the DNN Blog module. I've been blogging very irregularly for a couple of years on the site. Previously I limited my missives to just product and site news and announcements mostly. The main reason for this is that the Blog module historically has not been quite up-to-snuff. It was OK for very basic blogging, but since my blogging involved a lot of source code, the module's editor caused more than a few frustrated episodes as it blew up my painstakingly formatted code snippets.  Since I didn't have time to write my own module to overcome the limitations of the Blog module, I ended up only posting when it was required or when I had a LOT of time to properly craft my posts. All that (well, most of that) has changed with the recent upgrades.&lt;/p&gt; &lt;a href=http://dnndev.com/Blog/tabid/347/EntryId/117/Blogging-From-My-Desktop-Laptop-and-iPhone.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dnndev.com/Blog/tabid/347/EntryId/117/Blogging-From-My-Desktop-Laptop-and-iPhone.aspx</link>
      <author>kford@knowbetter.com</author>
      <comments>http://dnndev.com/Blog/tabid/347/EntryId/117/Blogging-From-My-Desktop-Laptop-and-iPhone.aspx#Comments</comments>
      <guid isPermaLink="true">http://dnndev.com/Blog/tabid/347/EntryId/117/Blogging-From-My-Desktop-Laptop-and-iPhone.aspx</guid>
      <pubDate>Tue, 22 Sep 2009 21:49:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.dnndev.com/DesktopModules/Blog/Trackback.aspx?id=117</trackback:ping>
    </item>
  </channel>
</rss>