Thursday, 5 December 2013

All process for client side processor in Json File filename.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ajaxform.aspx.cs" Inherits="ajaxform" %> :: Ajax Form ::
Name :
filename.aspx.cs file using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; using System.Configuration; using System.Data.SqlClient; using System.Data; public partial class ajaxform : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } [WebMethod] public static string GetName(string Username) { string xml; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ToString()); DataTable dt = new DataTable(); conn.Open(); SqlCommand cmd = new SqlCommand("json_process", conn); cmd.Parameters.AddWithValue("@name", Username); cmd.CommandType = CommandType.StoredProcedure; //cmd.ExecuteNonQuery(); //conn.Close(); //return code; //} SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); if (dt.Rows.Count > 0) { xml = ""; // xml += ""; foreach (DataRow row in dt.Rows) { xml += ""; } //xml += ""; xml += "
Name :
" + row["Names"] + "" + row["Mobile"] + "
"; } else { xml = "No records"; } conn.Close(); return xml; } }

No comments:

Post a Comment