Master Page and ajax toolkit

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/28/2011 4:26:05 PM
Gravatar
Total Posts 2

Master Page and ajax toolkit

Master Page and ajax toolkit
Hello,
I'm trying to put a ajax AutoCompleteExtender inside a maser page, but no luck yet, Ive managed to do it inside a regular web form with no master.

Here is my code:

the aspxmaster page)

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage2.master.cs" Inherits="MasterPage2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">

<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>

</div>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Services>
<asp:ServiceReference Path="~/MasterPage2.master.cs" />
</Services>
</asp:ScriptManagerProxy>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:AutoCompleteExtender ID="TextBox2_AutoCompleteExtender"
runat="server"
DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList2"
ServicePath="" TargetControlID="TextBox2" UseContextKey="True">
</asp:AutoCompleteExtender>
</ContentTemplate>
</asp:UpdatePanel>

</form>

</body>
</html>


the cs: (master page)

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList2(string prefixText, int count, string contextKey)
{
DBConnectionDataContext DB = new DBConnectionDataContext();

List<string> NamesList = new List<string>();
var NamesResaults = DB.WS_SearchForProduct(prefixText).Take(count);
foreach (var NamesResault in NamesResaults)
{
NamesList.Add(NamesResault.FinalProductName);
}
return NamesList.ToArray();
}


the webconfig:

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />

Also I have the ajax toolkit in my bin

If anyone could help me I will be greatefull. Its driving me mad.

Thanks !

3/1/2011 9:16:54 AM
Gravatar
Total Posts 18439

Re: Master Page and ajax toolkit

Seems like your question has nothing to do with mojoPortal, that is certainly not a master page for mojoPortal.

However, I recently implemented the autocomplete extender in one of my add on products WebInvoice Pro so I can give you a little advice about it.

  1. don't put code directly in your master page, instead create a UserControl.ascx and put it there then embed your UserControl in the master page.
  2. definitely do not put the service method in the master page nor in a UserControl, create a .asmx Web Service for that

Hope it helps,

Joe

3/6/2011 2:38:49 AM
Gravatar
Total Posts 2

Re: Master Page and ajax toolkit

Thank you very much !

I've tried it and it solved my problem. 

3/19/2012 10:09:57 PM
Gravatar
Total Posts 42

Re: Master Page and ajax toolkit

Hi Joe

I think My problem is related

I have created a simple user control , with a text box linked to simple autocomplete extender

I have created and tested/debugged a simple web service to return some values

I have added the user control to a simple page in MP, the text box is diplayed ok. note: I not using a master page.

but i just can not get the  autocomplete to fire up ...

I read a few articles about autoccomplete not working within a web controls.

is this the case ? 

 

Regards

 

Lee

3/20/2012 8:10:09 AM
Gravatar
Total Posts 18439

Re: Master Page and ajax toolkit

Hi Lee,

AutoCompleteExtender can work fine in a UserControl, but you cannot populate it from a page method, page methods only work in pages not in UserControls so you have to use a .asmx web service to populate it from an url.

So you have to implement an .asmx with the service method and then set the ServicePath="~/path/to/yourservice.asmx" on the AutoCompleteExtender

Hope that helps,

Joe

3/23/2012 7:19:32 PM
Gravatar
Total Posts 42

Re: Master Page and ajax toolkit

Thanks Joe

sorry for the the delay get back to you

got it wroking!!

the reason it was not working was the reference to the web service was incorrect.

plus i had two autocompletes with two different web services.  Only one web service worked so i combined the code into one web service . Not sure why they did not work they looked the same !!

anyway all working now :)

now working on the Style sheets :(

Leeb

You must sign in to post in the forums. This thread is closed to new posts.