Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Visual Studio 2010 Javascript Intellisense not working properly -


there's little problem visual studio 2010 , javascript intellisense.

i've implemented class "properties" , want implement "static" function, returns new instance of class after ajax-request returns json-object.

like so:

/// <reference path="jquery/jquery-1.4.1-vsdoc.js" /> myclass = function (options) {     /// <summary>myclass description</summary>     /// <param name="options" type="array">foo1 (string), foo2(string)</param>     /// <field name="foo1" type="string">foo1 description</field>     /// <field name="foo2" type="string">foo2 description</field>      // [...] code      // properties     this.foo1 = options.foo1;     this.foo2 = options.foo2; } 

and function:

intellisense not working:

myclass.myfunction = function () {      /// <summary>myfunction description</summary>     /// <returns type="myclass">myclass</returns>      $.ajax({         type: 'get',         url: '/foo/bar',         datatype: 'json',         success: function (result) {             return new myclass(result);         }     }); } 

intellisense working:

myclass.myfunction = function () {      /// <summary>myfunction description</summary>     /// <returns type="myclass">myclass</returns>      var foo = new myclass({'foo1': 'a', 'foo2': 'b'});     $.ajax({         type: 'get',         url: '/foo/bar',         datatype: 'json',         success: function (result) {             foo = new myclass(result);             return foo;         }     });      return foo; } 

when call function function, like:

$(document).ready(function() {     var foobar = myclass.myfunction(); // returns object of type "myclass"     alert(foobar.foo1); // @ point, intellisense doesn't work correct }); 

my intellisense isn't working anymore (or works double-return), because return of myfunction within ajax-request. if place return @ end of function, intellisense working again. in case have 2 returns. first function , second ajax-success.

it seems <returns...></returns> works when return @ end of function. that's bad, because need 1 return when ajax-request completed.

i don't know how deal problem. hope can me fix :)

the return inside "success" callback not going work anyway. it'll return that function, nothing going pay attention return value, , in particular return value "success" function not return value "myfunction".

if want "myfunction" fetch value , allow code work on it, code have passed in "myfunction" , called in "success" function. thus, instead of:

var thing = myclass.myfunction(); /*   stuff "thing" */ 

you'd change "myfunction" around this:

myclass.myfunction(function(thing) {   /*     stuff "thing"   */ }); 

the function this:

myclass.myfunction = function (dostuff) {    /// <summary>myfunction description</summary>    $.ajax({     type: 'get',     url: '/foo/bar',     datatype: 'json',     success: function (result) {         dostuff(new myclass(result));     }   }); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -