Oops,
OK, here is the inline code. Thank's Peter. Also a quick note, I've tried
this with and without the UpdatePanel, and regardless, it has the same
behavior.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected object JSSafe(object text)
{
string safeText = text as string;
if (safeText != null)
{
safeText = safeText.Replace("'", "\\'");
safeText = safeText.Replace("\"", "\\\"");
return safeText;
}
return text;
}
protected string GetCopyMethod(object DataItem)
{
return
string.Format("setCopiedFields('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',{11},{12},{13},{14});
return false;",
JSSafe(DataBinder.Eval(DataItem, "AddressLine1")),
JSSafe(DataBinder.Eval(DataItem, "AddressLine2")),
JSSafe(DataBinder.Eval(DataItem, "City")),
JSSafe(DataBinder.Eval(DataItem, "State")),
DataBinder.Eval(DataItem, "Zip"),
DataBinder.Eval(DataItem, "StartDate"),
DataBinder.Eval(DataItem, "BaseOrFinalSalesPrice"),
JSSafe(DataBinder.Eval(DataItem, "LegalDescription")),
DataBinder.Eval(DataItem, "ApproximateClosingDate"),
JSSafe(DataBinder.Eval(DataItem, "HomebuyerFirstName")),
JSSafe(DataBinder.Eval(DataItem, "HomebuyerLastName")),
DataBinder.Eval(DataItem, "Grandfather").ToString().ToLower(),
DataBinder.Eval(DataItem, "SiteBuilt").ToString().ToLower(),
DataBinder.Eval(DataItem, "Manufactured").ToString().ToLower(),
DataBinder.Eval(DataItem, "Modular").ToString().ToLower()
);
}
protected bool IsPossibleDuplicate(object DataItem)
{
try
{
string addressLine1 = DataBinder.Eval(DataItem, "AddressLine1") as string;
if (addressLine1.Length > 6)
addressLine1 = addressLine1.Substring(0, 6);
string state = DataBinder.Eval(DataItem, "State") as string;
int homeId = (int)DataBinder.Eval(DataItem, "HomeID");
string filter = string.Format("HomeID < {0} AND AddressLine1 LIKE '{1}%' AND
State = '{2}'", homeId, addressLine1, state);
System.Data.DataRow[] found =
FormManager.Nos.MyNosForm.Step_2.Select(filter);
return found.Length > 0;
}
catch { return false; }
}
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="asdf" runat="server" />
<asp:UpdatePanel ID="asdff" runat="server">
<ContentTemplate>
<asp:GridView ID="HomesGridView" runat="server" DataKeyNames="HomeID"
DataSourceID="HomesDataSource"
ShowHeader="false"
AllowPaging="false"
AllowSorting="false"
AutoGenerateColumns="false"
GridLines="None"><%--OnRowCommand="HomesGridView_RowCommand"--%>
<EmptyDataTemplate>
You have not yet added any homes to this Notification of Starts, please use
the form below to input
and add a new home.
</EmptyDataTemplate>
<RowStyle CssClass="Row" />
<HeaderStyle CssClass="HeadingRow" />
<FooterStyle CssClass="GridFooter" />
<AlternatingRowStyle CssClass="AlternatingRow" />
<SelectedRowStyle CssClass="SelectedRow" />
<EditRowStyle CssClass="SelectedRow" />
<Columns>
<asp:TemplateField ShowHeader="false">
<ItemTemplate>
<asp
anel ID="ItemPanel" runat="server" DefaultButton="Edit">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td>
<asp:TextBox Enabled="false" Text='<%# Eval("AddressLine1") %>'
ID="AddressLine1" runat="server" Width="112px" MaxLength="50" />
</td>
<td>
<asp:TextBox Enabled="false" Text='<%# Eval("AddressLine2") %>'
ID="AddressLine2" runat="server" Width="112px" MaxLength="50" />
</td>
<td>
<asp:TextBox Enabled="false" Text='<%# Eval("City") %>' ID="City"
runat="server" Width="75px" MaxLength="50" />
</td>
<td>
<asp:TextBox Enabled="false" Text='<%# Eval("State") %>' ID="State"
runat="server" Width="22px" MaxLength="2" Style="text-transform:uppercase;"
onblur="this.value = this.value.toString().toUpperCase();" />
</td>
<td>
<igtxt:WebMaskEdit Enabled="false" RawText='<%# Eval("Zip") %>' ID="Zip"
runat="server" Width="75px" DataMode="rawText" DisplayMode="blankWhenEmpty"
InputMask="00000-9999" />
</td>
<td>
<igtxt:WebDateTimeEdit Enabled="false" Value='<%# Eval("StartDate") %>'
ID="StartDate" runat="server" Width="75px" DataMode="Text"
DisplayModeFormat="d" EditModeFormat="d" Nullable="true" NullText="" />
</td>
<td>
<igtxt:WebCurrencyEdit Enabled="false" Value='<%#
Eval("BaseOrFinalSalesPrice") %>' ID="BaseOrFinalSalesPrice" runat="server"
Width="75px" MinDecimalPlaces="two" Nullable="true" NullText=""
DataMode="Text" HorizontalAlign="left" />
</td>
</tr>
<tr>
<td class="tiny">Street</td>
<td class="tiny">Line 2</td>
<td class="tiny">City</td>
<td class="tiny">State</td>
<td class="tiny">Zip</td>
<td class="tiny">Start Date</td>
<td class="tiny">Base or Final Sales Price</td>
</tr>
<tr><td colspan="8"><div style="height:5px;"></div></td></tr>
<tr>
<td colspan="2">
<asp:TextBox Enabled="false" Text='<%# Eval("LegalDescription") %>'
ID="LegalDescription" runat="server" Width="234px" MaxLength="80" />
</td>
<td colspan="2">
<igtxt:WebDateTimeEdit Enabled="false" Value='<%#
Eval("ApproximateClosingDate") %>' ID="ApproximateClosingDate"
runat="server" Width="75px" DataMode="Text" DisplayModeFormat="d"
EditModeFormat="d" Nullable="true" NullText="" />
</td>
<td>
<asp:TextBox Enabled="false" Text='<%# Eval("HomebuyerFirstName") %>'
ID="HomebuyerFirstName" runat="server" Width="75px" MaxLength="50" />
</td>
<td>
<asp:TextBox Enabled="false" Text='<%# Eval("HomebuyerLastName") %>'
ID="HomebuyerLastName" runat="server" Width="75px" MaxLength="50" />
</td>
<td>
<asp:CheckBox Enabled="false" Checked='<%# Eval("Grandfather") %>'
ID="Grandfather" runat="server" Text=""Grandfather"" />
</td>
</tr>
<tr>
<td colspan="2" class="tiny">Legal Description</td>
<td colspan="2" class="tiny">Approx Closing Date</td>
<td class="tiny">Homeowner First</td>
<td class="tiny">& Last Name</td>
</tr>
<tr>
<td colspan="5">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="tiny" style="vertical-align:middle;">Check type of
construction:</td>
<td></td>
<td>
<asp:RadioButton Checked='<%# Eval("SiteBuilt") %>' ID="SiteBuilt"
runat="server" Text="Site Built" GroupName="Construction" Enabled="false" />
</td>
<td>
<asp:RadioButton Checked='<%# Eval("Manufactured") %>' ID="Manufactured"
runat="server" Text="Manufactured" GroupName="Construction" Enabled="false"
/>
</td>
<td>
<asp:RadioButton Checked='<%# Eval("Modular") %>' ID="Modular"
runat="server" Text="Modular" GroupName="Construction" Enabled="false" />
</td>
</tr>
</table>
</td>
<td align="right" colspan="2">
<asp:LinkButton ID="Delete" runat="server" Text="Delete"
CommandName="Delete" CausesValidation="false" OnClientClick="if
(!confirm('Are you sure you want to delete this home?')){ return false; }"
/> ::
<asp:LinkButton ID="Edit" runat="server" Text="Edit" CommandName="Edit"
CausesValidation="false" /> ::
<asp:LinkButton ID="Copy" runat="server" Text="Copy" CommandName="Copy"
CausesValidation="false" OnClientClick='<%#
GetCopyMethod(Container.DataItem) %>' />
</td>
</tr>
<tr runat="server" id="WarningRow" visible="<%#
IsPossibleDuplicate(Container.DataItem) %>">
<td colspan="7">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<img src="<%# Page.ResolveUrl("~/images/warning_small.gif") %>"
alt="Warning" title="Warning: Possible Duplicate Address" />
</td>
<td><div style="width:5px;"></div></td>
<td class="error">
Warning: This may be a duplicate entry, please ensure all addresses are
unique; if so please disregard this message.
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp
anel>
</ItemTemplate>
<EditItemTemplate>
<asp
anel ID="EditPanel" runat="server" DefaultButton="Update">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td>
<asp:TextBox Text='<%# Bind("AddressLine1") %>' ID="AddressLine1"
runat="server" Width="112px" MaxLength="50" />
</td>
<td>
<asp:TextBox Text='<%# Bind("AddressLine2") %>' ID="AddressLine2"
runat="server" Width="112px" MaxLength="50" />
</td>
<td>
<asp:TextBox Text='<%# Bind("City") %>' ID="City" runat="server"
Width="75px" MaxLength="50" />
</td>
<td>
<asp:TextBox Text='<%# Bind("State") %>' ID="State" runat="server"
Width="22px" MaxLength="2" Style="text-transform:uppercase;"
onblur="this.value = this.value.toString().toUpperCase();" />
</td>
<td>
<igtxt:WebMaskEdit RawText='<%# Bind("Zip") %>' ID="Zip" runat="server"
Width="75px" DataMode="rawText" DisplayMode="blankWhenEmpty"
InputMask="00000-9999" />
</td>
<td>
<igtxt:WebDateTimeEdit Value='<%# Bind("StartDate") %>' ID="StartDate"
runat="server" Width="75px" DataMode="Text" DisplayModeFormat="d"
EditModeFormat="d" Nullable="true" NullText="" />
</td>
<td>
<igtxt:WebCurrencyEdit Value='<%# Bind("BaseOrFinalSalesPrice") %>'
ID="BaseOrFinalSalesPrice" runat="server" Width="75px"
MinDecimalPlaces="two" Nullable="true" NullText="" DataMode="Text"
HorizontalAlign="left" />
</td>
</tr>
<tr>
<td class="tiny">Street
<asp:RequiredFieldValidator ID="AddressLine1Required" runat="server"
ControlToValidate="AddressLine1" Text="^^" ErrorMessage="Address Line 1 is
required" ValidationGroup="Update" />
</td>
<td class="tiny">Line 2</td>
<td class="tiny">City
<asp:RequiredFieldValidator ID="CityRequired" runat="server"
ControlToValidate="City" Text="^^" ErrorMessage="City is required"
ValidationGroup="Update" />
</td>
<td class="tiny">State
<asp:RegularExpressionValidator ID="StateValidR" runat="server"
ControlToValidate="State" Text="<br />^^" ErrorMessage="The State entered is
not valid. Remember that HBW <b>DOES NOT</b> accept enrollments for
<b>Hawaii</b> or <b>Alaska</b>." ValidationGroup="Update" Display="dynamic"
ValidationExpression="^(?
A[LRZ]|C[AOT]|D[CE]|FL|GA|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY]|a[lrz]|c[aot]|d[ce]|fl|ga|i[adln]|k[sy]|la|m[adeinost]|n[cdehjmvy]|o[hkr]|p[ar]|ri|s[cd]|t[nx]|ut|v[ait]|w[aivy]))$"
/>
<asp:RequiredFieldValidator ID="StateRequired" runat="server"
ControlToValidate="State" Text="<br/>^^" ErrorMessage="State is required"
ValidationGroup="Update" Display="dynamic" EnableClientScript="true" />
</td>
<td class="tiny">Zip
<asp:RequiredFieldValidator ID="ZipRequired" runat="server"
ControlToValidate="Zip" Text="^^" ErrorMessage="Zip Code is required"
ValidationGroup="Update" Display="dynamic" />
<asp:RegularExpressionValidator ID="ZipCodeFormat" runat="server"
ControlToValidate="Zip" ErrorMessage="Zip Code is not in the proper format,
please use either the 5 digit or 5 +4 US Standard format." Text="^^"
ValidationExpression="^\d{5}(\d{4})?$" Display="dynamic"
ValidationGroup="Update" />
</td>
<td class="tiny">Start Date</td>
<td class="tiny">Base or Final Sales Price</td>
</tr>
<tr><td colspan="8"><div style="height:5px;"></div></td></tr>
<tr>
<td colspan="2">
<asp:TextBox Text='<%# Bind("LegalDescription") %>' ID="LegalDescription"
runat="server" Width="234px" MaxLength="80" />
</td>
<td colspan="2">
<igtxt:WebDateTimeEdit Value='<%# Bind("ApproximateClosingDate") %>'
ID="ApproximateClosingDate" runat="server" Width="75px" DataMode="Text"
DisplayModeFormat="d" EditModeFormat="d" Nullable="true" NullText="" />
</td>
<td>
<asp:TextBox Text='<%# Bind("HomebuyerFirstName") %>'
ID="HomebuyerFirstName" runat="server" Width="75px" MaxLength="50" />
</td>
<td>
<asp:TextBox Text='<%# Bind("HomebuyerLastName") %>' ID="HomebuyerLastName"
runat="server" Width="75px" MaxLength="50" />
</td>
<td>
<asp:CheckBox Checked='<%# Bind("Grandfather") %>' ID="Grandfather"
runat="server" Text=""Grandfather"" />
</td>
</tr>
<tr>
<td colspan="2" class="tiny">Legal Description
<asp:RequiredFieldValidator ID="LegalDescriptionRequired" runat="server"
ControlToValidate="LegalDescription" Text="^^" ErrorMessage="Legal
Description is required" ValidationGroup="Update" />
</td>
<td colspan="2" class="tiny">Approx Closing Date</td>
<td class="tiny">Homeowner First</td>
<td class="tiny">& Last Name</td>
</tr>
<tr>
<td colspan="6">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="tiny" style="vertical-align:middle;">Check type of
construction:</td>
<td></td>
<td>
<asp:RadioButton Checked='<%# Bind("SiteBuilt") %>' ID="SiteBuilt"
runat="server" Text="Site Built" GroupName="Construction" />
</td>
<td>
<asp:RadioButton Checked='<%# Bind("Manufactured") %>' ID="Manufactured"
runat="server" Text="Manufactured" GroupName="Construction" />
</td>
<td>
<asp:RadioButton Checked='<%# Bind("Modular") %>' ID="Modular"
runat="server" Text="Modular" GroupName="Construction" />
</td>
<td style="padding-left:10px;">
<asp:LinkButton ID="resetOptions" runat="server" Text="reset"
CommandName="resetOptions" CommandArgument='<%# Container.DataItemIndex %>'
/>
</td>
</tr>
</table>
</td>
<td align="right">
<asp:Button ID="Cancel" runat="server" Text="Cancel" CommandName="Cancel"
CausesValidation="false" UseSubmitBehavior="false" />
<asp:Button ID="Update" runat="server" Text="Update" CommandName="Update"
ValidationGroup="Update" CausesValidation="true" UseSubmitBehavior="false"
/>
</td>
</tr>
</table>
</asp
anel>
<asp:ValidationSummary ID="MyValidationSummary" runat="server"
ValidationGroup="Update" DisplayMode="bulletList" EnableClientScript="true"
ShowSummary="true" ShowMessageBox="false" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="HomesDataSource" runat="server"
TypeName="FormManager+Nos"
SelectMethod="GetHomes"
UpdateMethod="UpdateHome"
DeleteMethod="RemoveHome"
InsertMethod="AddHome" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>