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.

jquery - Pass HTML Table string through Json from controller to view -


i want achieve this:

public system.web.mvc.actionresult exposuregrid(guid? id, decimal stddev)         {             //return null;             try             {                 var str = "<table border=1>";                 str += "<tr><th>date</th><th>expected credit exposure</th><th>max credit exposure</th></tr>";                  str += "<tr><td>12/1/2010</td><td>100,000</td><td>50</td></tr>";                 str += "<tr><td>12/2/2010</td><td>101,000</td><td>100</td></tr>";                 str += "<tr><td>12/3/2010</td><td>102,000</td><td>150</td></tr>";                 str += "<tr><td>12/4/2010</td><td>103,000</td><td>200</td></tr>";                 str += "<tr><td>12/5/2010</td><td>104,000</td><td>250</td></tr>";                 str += "<tr><td>12/6/2010</td><td>105,000</td><td>300</td></tr>";                 str += "<tr><td>12/7/2010</td><td>106,000</td><td>350</td></tr>";              str += "</table>";             return json(str);             }             catch (exception e)             {                 return json(e.tostring());             }         } 

then take json , put on view this:

$.ajax({                 type: "post",                 url: "<%= url.action("exposuregrid", "indications") %> ",                 datatype: "jsondata",                 data: tablejson,                 success: function(data) {                       existingdiv = document.getelementbyid('table');                       existingdiv.innerhtml = data;                 }             }); 

but shows on view in html this:

"\u003ctable border=1\u003e\u003ctr\u003e\u003cth\u003edate\u003c/th\u003e\u003cth\u003eexpected credit exposure\u003c/th\u003e\u003cth\u003emax credit exposure\u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e12/1/2010\u003c/td\u003e\u003ctd\u003e100,000\u003c/td\u003e\u003ctd\u003e50\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e12/2/2010\u003c/td\u003e\u003ctd\u003e101,000\u003c/td\u003e\u003ctd\u003e100\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e12/3/2010\u003c/td\u003e\u003ctd\u003e102,000\u003c/td\u003e\u003ctd\u003e150\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e12/4/2010\u003c/td\u003e\u003ctd\u003e103,000\u003c/td\u003e\u003ctd\u003e200\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e12/5/2010\u003c/td\u003e\u003ctd\u003e104,000\u003c/td\u003e\u003ctd\u003e250\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e12/6/2010\u003c/td\u003e\u003ctd\u003e105,000\u003c/td\u003e\u003ctd\u003e300\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003e12/7/2010\u003c/td\u003e\u003ctd\u003e106,000\u003c/td\u003e\u003ctd\u003e350\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e"

how fix this?

change:

datatype: "jsondata", 

to

datatype: "json", 

hopefully, issue should resolved.


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 -