AjaxPanel

(一) . 简要 AjaxPanel, 一个自定义控件, 只要在页面中将AjaxPanel作为父控件, 则它内部的控件在运行时无刷新. 做了个程序试了一下果然比较Cool ! 下面介绍一下具体配置, 配置也比较简单. (二). 运行示例图 (三). 配置 1. 把 AjaxPanel 添加到工具箱中. 步骤如下: 2. 在Web.Config文件的: 节,添加如下配置: 1 2 3 4 5 6 7 1 2 3 4 5 (四). 做了上面几步配置后, 下面就可以使用了, 示例代码也非常简单, 具体如下: 1.前台页面文件 Magicajax.aspx 代码如下: 1 2

3
4 5 6 AjaxPanel example 7
8 10   11
13
14 16 17 18 19 20 21 22 23 24 25
26

27 2.后台页面文件 Magicajax.aspx.cs 代码如下: 1 public partial class _Default : System.Web.UI.Page 2 { 3 protected void Page_Load(object sender, EventArgs e) 4 { 5 6 } 7 private DataTable CreateStructure() 8 { 9 DataTable dt = new DataTable(); 10 dt.Columns.Add(new DataColumn("CategoryID", typeof(int))); 11 dt.Columns.Add(new DataColumn("CategoryName", typeof(string))); 12 dt.Columns.Add(new DataColumn("Price", typeof(int))); 13 return dt; 14 } 15 public DataSet CreateData() 16 { 17 DataSet ds = new DataSet(); 18 DataTable dt = this.CreateStructure(); 19 20 DataRow drNew = dt.NewRow(); 21 drNew = dt.NewRow(); 22 drNew["CategoryID"] = 1; 23 drNew["CategoryName"] = "Apple"; 24 drNew["Price"] = 2; 25 dt.Rows.Add(drNew); 26 27 drNew = dt.NewRow(); 28 drNew["CategoryID"] = 2; 29 drNew["CategoryName"] = "Banana"; 30 drNew["Price"] = 3; 31 dt.Rows.Add(drNew); 32 33 drNew = dt.NewRow(); 34 drNew["CategoryID"] = 3; 35 drNew["CategoryName"] = "Orange"; 36 drNew["Price"] = 1; 37 dt.Rows.Add(drNew); 38 39 drNew = dt.NewRow(); 40 drNew["CategoryID"] = 4; 41 drNew["CategoryName"] = "Radish"; 42 drNew["Price"] = 2; 43 dt.Rows.Add(drNew); 44 45 drNew = dt.NewRow(); 46 drNew["CategoryID"] = 5; 47 drNew["CategoryName"] = "Pen"; 48 drNew["Price"] = 3; 49 dt.Rows.Add(drNew); 50 51 drNew = dt.NewRow(); 52 drNew["CategoryID"] = 6; 53 drNew["CategoryName"] = "Pencil"; 54 drNew["Price"] = 7; 55 dt.Rows.Add(drNew); 56 57 drNew = dt.NewRow(); 58 drNew["CategoryID"] = 7; 59 drNew["CategoryName"] = "Ruler"; 60 drNew["Price"] = 3; 61 dt.Rows.Add(drNew); 62 63 drNew = dt.NewRow(); 64 drNew["CategoryID"] = 8; 65 drNew["CategoryName"] = "Eraser"; 66 drNew["Price"] = 5; 67 dt.Rows.Add(drNew); 68 69 ds.Tables.Add( dt ); 70 return ds; 71 } 72 protected void Button1_Click(object sender, EventArgs e) 73 { 74 this.GridView1.DataSource = this.CreateData(); 75 this.DataBind(); 76 } 77 }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值