您的位置:首页 > 理论基础 > 数据结构算法

项目中使用的ajax异步读取数据结构设计

2014-07-31 16:50 197 查看
设计稍微复杂了一点,完成ajax读取功能涉及到了很多页面。虽然如此,但感觉比较灵活。

ViewManager<Web.controls.PageControl> viewManager = new ViewManager<Web.controls.PageControl>();
Web.controls.PageControl control = viewManager.LoadViewControl("~/upload/controls/" + name);
foreach (System.Reflection.PropertyInfo p in control.GetType().GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance))
{
if (string.IsNullOrEmpty(context.Request[p.Name])) continue;
try
{
Convert.ChangeType(context.Request[p.Name], p.PropertyType);
p.SetValue(control, Convert.ChangeType(context.Request[p.Name], p.PropertyType), null);
}
catch (System.InvalidCastException e)
{
}
}
context.Response.Write(viewManager.RenderView(control));


View Code
数据控件

使用asp:Repeater显示数据。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: