Showing posts with label functionality. Show all posts
Showing posts with label functionality. Show all posts

Wednesday, March 28, 2012

Calling a Webservice from within a javascript object - closure issue?

Hi,

I'm making a client side call to a web services but I need to wrap up the functionality that makes the call within another object. The code is below. The code worked fine before I wrapped it in the "ImageViewer" object but now when I try to call the Web Service Method it doesn't recognise the onComplete call back function and says "onComplete" undefined. (See the getImageIDs method). I suspect this is something to do with scope and/or closure but I've been unable to come up with a solution. What is the correct way to do this? Any help will be appreciated.

Type.registerNamespace(

"Raydius");

Raydius.ImageViewer =

function(ImageDivID, ImageListDivID){this.ImageDiv = $get(ImageDivID);this.ImageListDiv = $get(ImageListDivID);this.ImageIDs = [];this.Images = [];

}

Raydius.ImageViewer.prototype = {

getImageIDs:function(id){

// Call the WebService

RaydiusWS(id, onComplete);

},

onComplete:

function(results){

alert(results);

},

onTimeOut:

function(results){

alert(

"Timeout");

},

onError:

function(results){

alert(

"Error");

}

}

Raydius.ImageViewer.registerClass(

'Raydius.ImageViewer');function initImageViewer(){

var viewer =new Raydius.ImageViewer("ImageDiv","ImageListDiv");

viewer.getImageIDs(1);

}

See if my example here helps you:

http://forums.asp.net/thread/1574034.aspx


Thanks for the response. There was actually a daft error in my code that was stoppinmg it working both the other post you directed me to was helpful. The userContext param is very useful.

Thanks

Mat

Wednesday, March 21, 2012

CalendarExtender with a ModalPopupExtender and missing weekdays

Hi

I am trying to use a CalendarExtender inside a Panel being shown as a ModalPopup. The functionality is fine , however the calendar has cropped two days of it the week of a week meaning that I am only seeing fron Sunday till Thursday. How am I to fix this or work around it ?

<asp:LinkButton ID="LinkButton1" runat="server">Godkend</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="modalBackground" CancelControlID="Button2" runat="server" TargetControlID="LinkButton1" PopupControlID="Panel1">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" style="display:none">
<div >
<fieldset>
<legend>Detajler</legend>
<asp:RadioButtonList ID="RadioButtonList2" runat="server">
<asp:ListItem Value="0" Selected="True">Alle</asp:ListItem>
<asp:ListItem Value="1" >Valgte</asp:ListItem>
</asp:RadioButtonList>


<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="2" Selected="True">Godkendt</asp:ListItem>
<asp:ListItem Value="1">Afvist</asp:ListItem>
<asp:ListItem Value="0">Afventer</asp:ListItem>
</asp:RadioButtonList>
<asp:Label ID="Label4" runat="server" Text="Dato"></asp:Label><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox2" >
</cc1:CalendarExtender>
</fieldset>
<div>
<asp:Button ID="Button1" runat="server" Text="Ok" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Cancel" />
</div>
</div>
</asp:Panel>

Regards

I copied your code and it worked just fine for me. What timezone are you in?


I copied your code and it worked just fine for me. What timezone are you in?


I copied your code and it worked just fine for me. What timezone are you in?

I

I copied your code and it worked just fine for me. What timezone are you in?

I know

I copied your code and it worked just fine for me. What timezone are you in?


...


DisturbedBuddha:

I copied your code and it worked just fine for me. What timezone are you in?

I am in CET +1h. I can see others having experienced this issue also. They have been able to work around with some CSS tricks , but I have not been able to.

http://forums.asp.net/p/1089990/1642856.aspx