| Naveed's profile.NET Demon's SpaceBlogLists | Help |
.NET Demon's SpaceNaveed Akhtar's [MCPD] Coding Blog |
||||||
|
July 09 Converting Data Table / Dataset Into JSON StringJSON (Java Script Object Notation), is a light weight, easily understandable to read and write string. It is also easily parse-able by machine. JSON is introduced on two structues A collection (key/value pair) And ordered list of values. I have not covered this topic in detail. Detailed analysis is stated on http://www.json.org/. I am presenting a helper function (in C#) for developers for fast parsing on datatable / dataset into JSON String, and access it on client-side. public static string GetJSONString(DataTable Dt) { string[] StrDc = new string[Dt.Columns.Count];
string TempStr = HeadStr; TempStr = TempStr.Replace(Dt.Columns[j] + j.ToString() + "¾", Dt.Rows[i][j].ToString());
} Here, Dt is the datatable, and it returns JSON formatted string. For detailed porcedure on how to access this string on client side, please refer to this link Exposing Webservices to Client-Side because I don't like to do task repetition. Please donot forget to convert to JSON string to JSON Object using var JObject = eval('(' + JSONString + ')'); in Javascript JObject have all characteristics of JSON object, through which you can Use JObject by iterrating or what so ever. e.g., you can use your JObject as for(var i = 0; i < JObject .Employees.length; i++) Please note that I am querieng data from AdventurWorksDB SQL Sample Database (Table: Employee). I hope this article will be helpful for you. Any Questions / Queries ?? Regards, Naveed Akhtar July 03 ASP.Net Compilation and Merge Tool (Part 2 of 2)ASP NET Merge tool allows user to manage and combine assemblies that are created using ASP NET Compilation tool. It works only on assemblies that have been created by using ASP.NET 2.0 or higher.This tool creates one assembly for each folder in target application or it creates each assembly for each file.This tool gives you additional functionality for management and deployment. It allows user to do the following operations.Create single assembly for just single web application UI elements such as controls and pagesCreate assembly for whole web applicationCreate assembly for each web application and affix to assembly name Syntax aspnet_merge [-?] // -? displays command syntaxExample Why to Use Aspnet_merge tool
ASP.Net Compilation and Merge Tool (Part 1 of 2)ASP.NET Compilation tool is used to compile an ASP.NET Web application either in same machine or to deploy on a target machine such as a production server. It helps application performance because end users do not encounter a delay on the first request to the application while the application is compiled on back-end. Compilation for deployment can be in one or two ways
Example Why to use ASP.Net Compilation Tool
Performance Stability
June 09 How to use Javascript using Server-side scriptingHi.
This article is interesting for those who loves to use javascript, but with little server postbacks. I had some times issues related to validation or client redirection or other sorts. So i got this solution and i would like to share it with you. Here I am presenting a scenario. I have a button, and OnClick of this button, i want to call java script function. On Server Side (.aspx.cs)
-------------------------- Write this code under Button_Click event or in any server event. ClientScript.RegisterStartupScript(this.GetType(), "key", "SubmitConfirm();",true); You can also pass server control, properties to the "SubmitConfirm();" function. On Client Side (.aspx)
-------------------------- write within javascript tag function SubmitConfirm() {
alert('Form Submitted'); window.location='TestPage.aspx';
}
------------------------------------- I hope this will be helpful for you. Any Comments / Suggestion... |
|||||
|
|