Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts

Wednesday, March 28, 2012

Ajax Beta WebService with Sessions

Hello all, I need help here. I have a little app that requires getting the session within a webservice. I can't seem to access the session object. Here is my little webservice:

[WebMethod (EnableSession =true)]

[ScriptMethod]

publicstaticArrayList getProductsData()

{

return (ArrayList)Session["productsAL"];

}

Here is my call to the service:

[Microsoft.Web.Script.Services.ScriptMethod]

publicstaticint GetProductCount()

{

returnQuickShipService.getProductsCount();

}

I'm getting a compilation error. With this setup I get the error

Error 1 An object reference is required for the nonstatic field, method, or property 'System.Web.Services.WebService.Session.get' C:\Projects\TMR\POSOrdering\POSWWW\App_Code\Retail\QuickShipService.cs 31 27 C:\...\POSWWW\

It compiles if I remove the static keyword from the service, but then the webservice callreturnQuickShipService.getProductsCount(); is invalid.

Thanks f

or

your method is static, try

return (ArrayList)HttpContext.Current.Session["productsAL"];

Monday, March 26, 2012

ajax asp tags not available in head anymore?

Prior to this release I had a (?potentially bad?) habit of putting my script manager tag inside the <head> tag. Now it looks like that can't be done, or at least the intellisense won't work there. Any comments on

1) this was a stupid idea to begin with ?

2) its a bug or a feature - but get used to it?

Thanks.

hello.

1. if i'm not mistaken, now theymust be inside a form (which is good since after all we're talking about a server control)

2. well, not getting intellisense is surelly a bug :)


In the early CTPs they worked inside the head, which in 2.0 is a programmable container.

The loss of this ability to me to be a 'breaking change' from CTP to Beta. Its 'adjustable' but cuts down some scenarios for wiring in clientside scripts using web service proxies declared in the header, but meant to be used via dhtml outside of serverside form tags. Working through my scenarios now.


hello.

well, in my opinion, the previous behavior was a bug, since all server controls must be declared inside a server form.


Not all controls are required to be within the form;

The SM is required to be within the form in the beta, but this may be relaxed. The partial page postback model (UpdatePanel) requires it to be in the form, but when EnablePartialRendering is not on and/or Updatepanels are not around, then it might be 'allowed' outside. Still being debated however.


hello again.

well, from looking at the control hierarchy, i think that my previous statement was wrong since it only inherits from control. so, maybe it could be put outside the form tag (if it doesn't break the page postback model)

Saturday, March 24, 2012

Ajax and Web custom Control

Hi all ,

Can any budy tell the approach for building a treeview web custom control using ajax

I cant getting the idea of rendring the tree view(HTML for Tree view ie using ajax)

Any help

Hi

Have you tried nested Datalists?

Thanks


No Jin

Nerver Header give some hint...

Another thing ,i start to build the tree using ul and li of html tag and rendering in the following manner

protected void BuildDivContainingTree(HtmlTextWriter output)
{

// Start building the HTML
output.Write("<div><ul><li>");
output.Write("<table><tr><td><IMG src='../../images/minus.gif'></td><td style='cursor:hand' onclick='onTextClicked(0,0);'>");
output.Write("<font color=red>");
output.Write(this.BaseNodeText + "</font></td></tr></table>");
output.Write("<div id='treeview_0'></div><div id='DivInPage'></div>");
output.Write("</li></ui>");

output.Write("<script>document.onreadystatechange=StartLoading('" + this.Type + "')</script>");

}

now i want to send a ajax cal for filling the node of the tree...

what should i do ?

as i created in the custom control i send a request to a aspx page and execute server function and place the out as response text as xml dox and render it in <li> inner text .

any suggestions