Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIHelp! dnnxmlhttp Control Method QuestionHelp! dnnxmlhttp Control Method Question
Previous
 
Next
New Post
3/19/2009 1:17 PM
 

Hi Oliver - ok, so I changed all of the namespaces to match on the code behind and on the javascript file just to make it easy. Clicked the "Hello" button that comes on the template and everything functions as expected. I added an alert to show the "this.get_id(); " and it does...just as expected. BUT - when I click the link that calls my method it shows that get_id() = null; and again, it can't find my method. However, I really think this is back to jQuery. I can't figure out how to do what I want to do using the Ajax Library and it's so easy with jQuery. Basically, what I've done is taken an ASP.NET menu and used the CSSAdapters to output a tableless menu using UL  and  LI. I've got jQuery adding an accordion to the menu. Then, I also do:

//bind functions to menu buttons
var target = '.veListItems';
jQuery(target).each(function() {
//This = [HTMLLIItem]
jQuery(this).bind('click', jQuery(this).attr('value'), function() {
Healthcomp.Modules.xEDI.ViewxEDI.prototype._onLoadMyControl(jQuery(this).attr('value'))
});
});
 

**  I THINK what's happening is that then the .onLoadMyControl function is called it still thinks it is a jquery object so the "this.get_id();" comes back null because its no longer referring to the Healthcomp.Modules.xEDI.ViewxEDI.prototype. Does that make sense? So, I guess what I'm wondering is how can we used jQuery and MS Ajax together???

In the jQuery function I tried doing something like this:

var item = this;

jQuery(item).blah();

But, that didn't seem to change anything.  You'll notice that in the jQuery function that I'm finding the menu items by the class name, but I don't see in MS Ajax how I can do that...I only see how to find based on id. These items don't have an ID though. Hmmm.... What do you think??

Again . . Thanks!!!


Check out the open source DNN Testimonials project on CodePlex and help build it!
 
New Post
3/19/2009 3:06 PM
 

Ok...moving along....it is DEFINITELY the jQuery and the "this" that's the problem. I found this post...http://aspnetresources.com/blog/saving_this.aspx which is getting me moving in the right direction. I wasn't able to use the author's suggestion, but was able to use the suggestion left by the second comment.  I changed my jQuery script to this:


//bind functions to menu buttons
jQuery('.veListItems').click(Function.createDelegate(this, function(evt) {
und to :' + $.className + ' with itemid= ' + jQuery(this).attr('value'));
his item href is : ' + jQuery(this).attr('href'));
this._onLoadMyControl(jQuery(this).attr('value'));
evt.preventDefault();
}));
 

SO...while not complete success yet, i am able to call the onLoadMyControl function using 'this.' and get back the control method is not found error. However, because the value that I'm trying to pass in to the _onLoadMyControl function is undefined, I am beginning to think that's what the problem actually is now. So, I'm still working on how to make this all work...but, the MS Ajax Library " Function.createDelegate" and Function.createCallback are proving to appear to be how to integrate jQuery nicely....

Be back with better information soon...(Hopefully!!)

 

 

jQuery(

 

 

 

evt.preventDefault();

}));

 

 


Check out the open source DNN Testimonials project on CodePlex and help build it!
 
New Post
3/19/2009 5:31 PM
Accepted Answer 

YES ! SUCCESS!!!

 

ok, I finally figured it out with the help of a few good articles.... it was the jQuery - 'this' problem for sure. Here is the js I finally ended up using: 


//bind functions to menu buttons
jQuery('.veListItems a').click(Function.createDelegate(this, function(evt) {
//set the property
this.set_clickedMenuID(jQuery('.veListItems a').attr('value'));
//bind the function
clicked on item being passed = ' + this.get_clickedMenuID());
this._onLoadMyControl(this.get_clickedMenuID());
evt.preventDefault();
}));

.....
_onLoadMyControl: function(src, arg) {
this._displayWait(true);
dnn.xmlhttp.callControlMethod('Healthcomp.Modules.xEDI.ViewxEDI.' + this.get_id(),
'LoadMyControlById', { ClickedMenuItemID: this.get_clickedMenuID() }, this._delegates._ctlSuccessDelegate, this._delegates._ctlFailDelegate);
},

This is the post that got me moving in the right direction aspnetresources.com/blog/saving_this.aspx  and this one helped out as well dotnetslackers.com/Community/blogs/xun/archive/2008/07/17/asp-net-ajax-event-handlers-the-very-very-basic.aspx. I wasn't able to use the 'self' variable described in the first link, but I was able to work it out with the suggestion of  the second commenter. Apparantly, by using the MS Ajax 'Function.createDelegate' allows you to pass the original this to be used in the called function. 

Man, o man...I am one happy lady right now! I've learned so much since trying to work with these templates...actually  my whole DNN experience for the last 3 years or so has been like that. Makes me learn things on such a deeper level. Thanks so much Jon for the contributions....and much, much thanks to Oliver for helping me work this out! That's why I love this community!

Best !!!!

Briana

 

PS...the 'control not being found error apparantly is thrown in IE and I got it because the value I was trying to pass to the ControlMethod was null. Once I finally started passing values (I tried to pass a string to an Integer) . . I began to receive the error about incorrect input string. Just a little FYI for anyone who may be wondering why there method can't be found like I was. Also, I guess the namespaces on the Codebehind and on the javascript file CAN be different, but they just must be referring to each other correctly. But, I'm thinking I'll just keep them the same to make it easy.

YEA!!! Thanks Again!


Check out the open source DNN Testimonials project on CodePlex and help build it!
 
New Post
3/19/2009 7:00 PM
 

I'm glad you were able to work through the issue, Congratulations! I had to run out for the afternoon and couldn't get a response posted. I ran into the same issues in my HTML modules auto save as a draft feature. I'll see if I can dig up some of my notes and see if I've got anything beneficial to add. Feel free to contact me if you have any other questions, as I've been using these templates for all my new module development over the last 4 months and I'm happy to provide a fresh set of eyes.

I really have to recommend the Firebug plugin for Firefox again just incase you missed it - the javascript debugger alone has saved me countless hours and the CSS inspector really kicks it up a notch

 
New Post
3/19/2009 7:40 PM
 

Great news Oliver. I'd be happy to take any notes you've got...no matter how seemingly small or insignificant, believe me! I've downloaded Firebug already and I don't know why in the world I haven't done this already!  Unfortunately, now that I finally figured all of this out, I don't think I'm going to be able to do what I want. There's just got to be another way...i don't know. But, regardless...this was a fantastic practical excercise and I can't wait to start implementing this so much more. Thanks for the offer of help...I'm pretty sure I'll be taking you up on it in the future. Same goes for me...it's always nice to have a fresh set of eyes. Thanks a ton!


Check out the open source DNN Testimonials project on CodePlex and help build it!
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIHelp! dnnxmlhttp Control Method QuestionHelp! dnnxmlhttp Control Method Question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out