I have a Formview which in the edit template contains a textbox with an AutoCompleteExtender. Which requires a JS function call to set the Hidden Id field to a Hidden Field so it can be bound.
This all works perfectly till i surround the FormView with an UpdatePanel. Now it cant find the JS function which is right below it,
```
<asp:TextBox ID="PlaceBox" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Locality") + ", " + DataBinder.Eval(Container, "DataItem.City") %>' onfocus="this.select()" onMouseUp="return false" />
<ajaxToolkit:AutoCompleteExtender ID="PlaceACE" runat="server" ServicePath="~/Resources/Services/AutoComplete.asmx"
ServiceMethod="GetCompletionList" CompletionInterval="0" FirstRowSelected="true" OnClientItemSelected="setValue"
MinimumPrefixLength="1" CompletionSetCount="6" CompletionListCssClass="acl1" CompletionListItemCssClass="aci1" CompletionListHighlightedItemCssClass="ach"
TargetControlID="PlaceBox" UseContextKey="true" ContextKey="LocalityCity" EnableCaching="true" />
<asp:HiddenField ID="HiddenFieldLocalityId" Value='<%# Bind("LocalityId") %>' runat="server" />
<script type="text/javascript">
function setValue(source, eventArgs) { document.getElementById(" <%=VenueFV.FindControl("HiddenFieldLocalityId").ClientID %>").value = eventArgs.get_value(); }
</script>
```
Then the error i get in Chromes Console is Uncaught ReferenceError: setValue is not defined
Now if I take out the update panel it works fine
or place the script outside the formview it detects the script but then I cant find a control which hasnt been created yet (as the initial view is ItemTemplate)
This all works perfectly till i surround the FormView with an UpdatePanel. Now it cant find the JS function which is right below it,
```
<asp:TextBox ID="PlaceBox" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Locality") + ", " + DataBinder.Eval(Container, "DataItem.City") %>' onfocus="this.select()" onMouseUp="return false" />
<ajaxToolkit:AutoCompleteExtender ID="PlaceACE" runat="server" ServicePath="~/Resources/Services/AutoComplete.asmx"
ServiceMethod="GetCompletionList" CompletionInterval="0" FirstRowSelected="true" OnClientItemSelected="setValue"
MinimumPrefixLength="1" CompletionSetCount="6" CompletionListCssClass="acl1" CompletionListItemCssClass="aci1" CompletionListHighlightedItemCssClass="ach"
TargetControlID="PlaceBox" UseContextKey="true" ContextKey="LocalityCity" EnableCaching="true" />
<asp:HiddenField ID="HiddenFieldLocalityId" Value='<%# Bind("LocalityId") %>' runat="server" />
<script type="text/javascript">
function setValue(source, eventArgs) { document.getElementById(" <%=VenueFV.FindControl("HiddenFieldLocalityId").ClientID %>").value = eventArgs.get_value(); }
</script>
```
Then the error i get in Chromes Console is Uncaught ReferenceError: setValue is not defined
Now if I take out the update panel it works fine
or place the script outside the formview it detects the script but then I cant find a control which hasnt been created yet (as the initial view is ItemTemplate)