protected string GetProjectData(){IProjectService _service = StructureMap.ObjectFactory.GetInstance<IProjectService>();JavaScriptSerializer js = new JavaScriptSerializer();return js.Serialize(_service.Get());}[{"Id":1,"Client":"dfsf","Name":"dfsf","LeadDeveloper":"dfsf","ProjectManager":"dfsf",
"PercentComplete":23,"KickOffDate":"\/Date(1262325600000)\/",
"LaunchDate":"\/Date(1285909200000)\/","ModifiedDate":"\/Date(1265832196070)\/",
"ModifiedBy":"dfsf"}]
Search
just show me the code
Wednesday, August 4, 2010
JSON Serializer
dyanmic data partial class meta data
namespace DynamicData.Code.DataAccess.Sql.Dbml{[MetadataType(typeof(GameMetadata))]public partial class Game{}public class GameMetadata{public object HomeTeamId {get; set;}public object AwayTeamId { get; set; }[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}")]//[Range(0,100, ErrorMessage="enter a quanity between ")]public object Date { get; set; }public object Line { get; set; }public object HomeScore { get; set; }public object AwayScore { get; set; }public object WeekId { get; set; }}}
Tuesday, February 16, 2010
Javascript RegEx
this will format the 2nd column to nowrap
will also replace 'xxxx' with <b>xxx</b> in the 5th column
42
43 <script type="text/javascript">
44 $(function() {
45 $('tr>td:nth-child(2)').css('white-space', 'nowrap');
46 $('tr>td:nth-child(5)').each(function() {
47 var regex = new RegExp("\'(.[^ ]*)\'", "g"); // look for 'name' g=globaly
48 var replace = '<b>$1</b>'; // turns 'name' => <b>name</b>
49 var t = $(this).text().replace(regex, replace);
50 $(this).html(t);
51 });
52 });
53 </script>
Subscribe to:
Posts (Atom)