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.

google chrome - Object passing in chromium extension -


my extension creates object in background page , stores all
configuration variables in object. object common for
content scripts , hence background page sends the
content scripts after connection request received:

// in background.html
timobject = {
property1 : "hello",
property2 : "mmmmmm",
property3 : ["mmm", 2, 3, 6, "kkk"],
method1 : function(){alert("method had been called" +
this.property1)}
};

chrome.extension.onconnect.addlistener(function(port) {
console.assert(port.name == "fortimobject");
port.postmessage({object:timobject});
});

// in content script:
var extensionobject = null;
var port = chrome.extension.connect({name: "fortimobject"});
port.onmessage.addlistener( function(msg) {
if (msg.object != null)
extensionobject = msg.object;
else
alert("object null");
} );

alert(extensionobject.property1); // ok, alert box displayed right contents
alert(extensionobject.method1) //uncaught typeerror: object # has no method 'method1'

what doing wrong here?
in advance!

google chrome message passing mechanism works serializing data json:

communication between extensions , content scripts works using message passing [...] message can contain valid json object (null, boolean, number, string, array, or object).

if object sent using message passing, convert json. so, @ time of "stringify]2ing method "method1" lost cannot transformed valid json expression. unfortunately, fails silently , confusing rest of properties of object correctly serialized.


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 -