Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 08, 2007 10:04 AM by Jason Hill
Oct 06, 2007 06:31 PM|LINK
Can you say whether it is possible to return html-formatted contents instead of just text to the autocomplete extender and have it display in the drop-down list? If not, another thought would be if dynamicpopulate can be triggered from typing in a text field
instead of clicking a control, and have it show a panel with contents reflecting that string.. Your thoughts?
Oct 07, 2007 10:32 PM|LINK
You could monitor the key presses in the textbox and then call the populate() method on a dynamicpopulate control to reload every key press. You will need to set the context key of the dynamicpopulate to the value in the textbox before calling populate().
Something along the lines of:
<asp:TextBox id="MyTextBox" runat="server" onkeypress="MyFunction()"/>
and the JS:
var dp = $find('MyDynamicPopulateControl');
Oct 08, 2007 06:17 AM|LINK
Hmm, I get the error "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." on the line with "dp.set_ContextKey($get('<%=MyTextBox.ClientID%>').value);"
Oct 08, 2007 06:24 AM|LINK
Try using #MyTextBox.ClientID instead of =MyTextBox.ClientID.
Oct 08, 2007 08:46 AM|LINK
Yes, thanks - this solves the error. The problem is now - the control is triggered when I click in the textbox or type a letter, and remains like that, no matter what I type afterwards (hints.cs returns the result of a select * from table where name like
var dp = $find('sHintsExtender');
<asp:Panel ID="sHintsPanel" runat="server" />
<ajt:DynamicPopulateExtender ID="sHintsExtender" runat="server" TargetControlID="sHintsPanel" ServicePath="/hints.asmx" ServiceMethod="showhints" PopulateTriggerControlID="sTextBox" ClearContentsDuringUpdate="true" />
<asp:TextBox id="sTextBox" runat="server" onkeypress="sAutoComplete()"/>
Oct 08, 2007 10:04 AM|LINK
Not sure I fully understand the problem now...are you saying that the panel is being populated correctly or not on key presses.
You will need to then have some JS that handles the selection of the value from your HTML content and then places a value back into the textbox.