csharp C#_Ajax_Responsing_In_WebForms.cs

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp C#_Ajax_Responsing_In_WebForms.cs相关的知识,希望对你有一定的参考价值。


using System;
using System.Net;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;

namespace NameSpace
{
    public partial class Ajax : System.Web.UI.Page
    {

        private object wrap;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            string json = new JavaScriptSerializer().Serialize(this.wrap);
            Response.Write(json);
        }

        #region @Binding user rquest to method and inject common return Object
        private void ajaxRequestTriger(string _request) {
            switch (_request) {
                case "req": reqT(); break;
            }
        }
        #endregion

        public void reqT() {
       
        }

        #region @Parameter binding in user Request
        private void setRequestParams()
        {
           
        }
        #endregion


        #region @Convert DataSet Object to List<Dictionary<string, object>>
        private List<Dictionary<string, object>> getJsonForDataSet(DataSet ds)
        {

            List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
            Dictionary<string, object> row;
            string Excep = string.Empty;

            try
            {
                if (ds.Tables.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        row = new Dictionary<string, object>();

                        foreach (DataColumn col in dr.Table.Columns)
                        {
                            row.Add(col.ColumnName, dr[col].ToString());
                        }

                        rows.Add(row);
                    }

                }
            }
            catch (Exception ex)
            {
               
            }

            return rows;
        }
        #endregion
    }
}

以上是关于csharp C#_Ajax_Responsing_In_WebForms.cs的主要内容,如果未能解决你的问题,请参考以下文章

csharp C#_local_db_Create.cs

csharp C#_Make_Random_ListOrder.cs

csharp C#_mongo_datetime_attributing.cs

csharp C#_Read_Json_and_Convert.cs

csharp C#_Ajax_Responsing_In_WebForms.cs

csharp 以C#方式读取DDS图像。转换自“[il_dds.c](https://github.com/DentonW/DevIL/blob/master/DevIL/src-IL/src/il_