中继器控制中的数据表 [英] data table from repeater control

查看:69
本文介绍了中继器控制中的数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过从asp.net中的中继器控件获取值来创建新的数据表?

Is that is possible to create a new data table by getting values from a repeater control in asp.net?

推荐答案

是,为什么不呢?

Yes Why Not ?

 DataTable dt = new DataTable();

        dt.Columns.Add("Name"); // Add Column Name Here 
      

//Iterate Repeater

 foreach (var eachItem in Repeater1.Items)
        {

//Find Desired Control 
Label lblName=  (each as RepeaterItem ).FindControls("MyLabel");


        dt.Rows.Add(lblName.Text); // Add Data 

        }


这篇关于中继器控制中的数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆