Showing posts with label tag. Show all posts
Showing posts with label tag. Show all posts

Wednesday, March 28, 2012

PageMethod in the codebehind

I have a method in my codebehind that I would like to call from javascript. My script manager tag has EnablePageMethods="true" and the method in my codebehind is tagged with [WebMethod] and [ScriptMethod]. When I trigger the javascript, I get errors. I've found some things that say that if you want to call a server side method (not in a web service) from your javascript with the PageMethods collection, you have to have that in a script block in your aspx. I've created a script block with a method in my aspx that just calls the function in my codebehind, but I think that's kind of ugly. Is there something I might have just missed that would allow me to just call my codebehind?

Thanks

Here's a code example: http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/


Your pagemethod has to be public and static. If that doesn't help, try posting some sample code for us to help debug.


Thanks. That's what I was trying and it didn't work for me. I found some posts around that said that if you wanted to do this, the server side method you were calling had to be in the ASPX. Seemed to fit because of the errors I was getting and the fact that putting a wrapper function in my ASPX for the actual method I wanted to call worked. However, I gave it one more shot this morning (same exact code that didn't work before, I swear) and it's gold.

Saturday, March 24, 2012

Panel inside an absolute positioned div tag and DropShadowExtender.

I have a Panel inside an absolutly positioned DIV tag. The drop shadowextenders targed control is the Panel. The DropShadow dosn't render properly. It seems to render double the distance of the div from the top and the left side. I am using the Atlas July CTP and the toolkitRelease 60731.

In the example below the div is set to 100px from the left of the page. The DropShadow is then rendered 200px from the left. When I position the div in normal flow it works correctly but this dosn't suit my needs.

Can anyone tell me how to fix this behavoir.

Thanks in advance

David O'Shea

<atlas:ScriptManagerID="ScriptManager1"runat="server"/>

<divstyle="z-index: 101; left: 100px; width: 250px; position: absolute; top: 100px;

height: 228px">

<asp:PanelID="Panel1"runat="server"BackColor="Blue"Height="200px"Width="200px"></asp:Panel></div><cc1:DropShadowExtenderID="DropShadowExtender1"runat="server"><cc1:DropShadowPropertiesOpacity=".8"Rounded="true"TargetControlID="Panel1"TrackPosition="True"/></cc1:DropShadowExtender>

I removed the div tag and set the style of Panel1 to absolute position and it works fine.

Rgds

David O'Shea