Note that there are some explanatory texts on larger screens.

plurals
  1. POMaster page containing User Control with AutoCompleteExtender
    primarykey
    data
    text
    <p><strong>Brief of Application:</strong></p> <p>I am creating a website which has a master page , a sub master page and some content pages.</p> <p>I have created some user controls to display information on the main master page. I have registered those controls directly on my main master page and have specified their position.</p> <p>I have used some content pages and other master page in ContentPlaceHolder.</p> <p><strong>Description:</strong></p> <p>I have a textbox on one of my user control, which i want to use with AutoCompleteExtender to help the user in finding the specific text by displaying him the related results.</p> <p>Here is the sample piece of code:</p> <pre><code>&lt;asp:TextBox ID="TxtSource" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:AutoCompleteExtender ID="AutoCompleteSource" TargetControlID = "TxtSource" MinimumPrefixLength="1" ServiceMethod="GetSourceList" runat="server" UseContextKey="True"&gt; &lt;/asp:AutoCompleteExtender&gt; </code></pre> <p>Code Behind of Custom Control:</p> <pre><code>[System.Web.Services.WebMethod(), System.Web.Script.Services.ScriptMethod()] public static string[] GetSourceList(string prefixText, int count, string contextKey) { string[] SourceList = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"}; return (from m in SourceList where m.StartsWith(prefixText.ToUpper()) select m).ToArray(); } </code></pre> <p>I am not using the webservice but the codebehind to call the method.</p> <p><strong>Issue:</strong></p> <p>The function in codebehind is never called.</p> <p>I am aware of the fact that i have to keep the function in aspx file, but with my bad luck i am not adding the control on aspx file but on master file and master page is again treated as a control and not the page.</p> <p>One solution :</p> <blockquote> <p>I can add the custom control on every content page.</p> </blockquote> <p>Problem : </p> <blockquote> <p>1) No code re-usability, which i want to achieve.</p> <p>2) Page layout will be changed.</p> </blockquote> <p>Can there be any other solution, with least code changes?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload