But cookieless sessions or authentication is not working with this example...
Maybe I have to check the webparts... Does anyone have a small example
project where I can start right now?
Regards,
Michael
On 5/18/06, Roman <[EMAIL PROTECTED]> wrote:
>
> Thanks for reply Michael.
>
> I tried passing the Page as a parameter but it doesn't help.
>
> I did some quick debugging (thank you for providing source code) and
> see that Utility.page_PreRender() method is not called. I believe this
> is something specific to webparts, maybe webparts cannot trigger
> preRender event. I'm new to the whole .net/asp/webpart thing so don't
> know for sure. I still hope there is some easy solution to it I don't
> know yet.
>
> For now I tried to include scripts manually and it seems to work (at
> least at my local setup, didn't try to deploy to sharepoint yet).
>
> Here what I did in case somebody wants to know.
>
> In webpart code, added OnPreRender() method added code to include
> scripts manually:
>
>
> using System;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.WebControls.WebParts;
> using AjaxPro;
>
> namespace WebControlLibrary2
> {
> public class WebCustomControl1 : WebPart
> {
> protected override void OnPreRender(EventArgs e)
> {
>
> ClientScriptManager cs = Page.ClientScript;
> cs.RegisterClientScriptInclude(this.GetType(), "prototype",
> "/WebSite3/ajaxpro/prototype.ashx");
> cs.RegisterClientScriptInclude(this.GetType(), "core",
> "/WebSite3/ajaxpro/core.ashx");
> cs.RegisterClientScriptInclude(this.GetType(), "converter",
> "/WebSite3/ajaxpro/converter.ashx");
> cs.RegisterClientScriptInclude(this.GetType(),
> "WebCustomControl1",
> "/WebSite3/ajaxpro/WebControlLibrary2.WebCustomControl1,WebControlLibrary2.ashx");
>
> cs.RegisterClientScriptInclude(this.GetType(), "mytest",
> "./JScript.js");
>
> base.OnPreRender(e);
> }
>
> [AjaxMethod]
> public string GetInfo()
> {
> return "hello world from webpart";
> }
>
> protected override void CreateChildControls()
> {
> Button btn = new Button();
> btn.Text = "OK";
> btn.Attributes.Add("onMouseOver", "test2()");
> Controls.Add(btn);
>
> base.CreateChildControls();
> }
>
> }
> }
>
>
> After this I can access ajax method from JScrip.js:
>
> function test2()
> {
> var res = WebControlLibrary2.WebCustomControl1.GetInfo()
> alert(res.value);
> }
>
> Regards,
> Roman
>
>
> >
>
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---