有一张数据库表,里面是控件TextBox的Id名称,行号和列号tableATextBoxName Row columns
TextBox1
TextBox2
TextBox3
TextBox4
TextBox5
TextBox6
TextBox7
TextBox8
TextBox9
TextBox10
TextBox11
TextBox12
TextBox13
TextBox14
TextBox15我想要这样一个效果:在一个页面上可以设置这些TextBox控件的行号和列号,比如一个页面,左半边以radiobuttonlist的方式显示这些TextBox控件,右半边以20乘以20的方格的形式显示400个按钮,接下来,比如要设置TextBox1的行号和列号,只要先在页面的左半边选中这个控件然后在页面的右半边的方格中选择一个按钮(坐标),然后点击页面上的设置按钮要实现这个方法可能会比较复杂和麻烦,像这样的方法叫什么名称?有现成的源代码吗?我要搜索的话,应该以什么样的关键字搜索才能搜索到这样的源代码?
TextBox1
TextBox2
TextBox3
TextBox4
TextBox5
TextBox6
TextBox7
TextBox8
TextBox9
TextBox10
TextBox11
TextBox12
TextBox13
TextBox14
TextBox15我想要这样一个效果:在一个页面上可以设置这些TextBox控件的行号和列号,比如一个页面,左半边以radiobuttonlist的方式显示这些TextBox控件,右半边以20乘以20的方格的形式显示400个按钮,接下来,比如要设置TextBox1的行号和列号,只要先在页面的左半边选中这个控件然后在页面的右半边的方格中选择一个按钮(坐标),然后点击页面上的设置按钮要实现这个方法可能会比较复杂和麻烦,像这样的方法叫什么名称?有现成的源代码吗?我要搜索的话,应该以什么样的关键字搜索才能搜索到这样的源代码?
解决方案 »
- asp.net自定义控件与事件
- Lucene.net 要实现文本数字和范围的搜索要怎么写代码?
- 遇到问题,散分了.
- 关于用HttpWebRequest读取页面内容的问题
- 谁帮我看看这个程序错在哪?
- aspnet帐户与asp_net,asp.net帐户是一回事吗?
- 关于分页大虾们帮看看~!!!
- 我是新手,C#BUILDER造的分页问题,请指点,在线等
- 如何取一个字符串的前几位,和中间几位?
- 用ASP.NET+C# 连SQL SERVER, 为什么总System.Data.SqlClient.SqlException: SQL Server 不存在或访问被拒绝
- 简单工厂
- 请问JAVASCRIPT中 两个时间怎样相减?我想得到两个时间之间相差多少秒?
{
Table tb = new Table();
for (int i = 0; i < 20; i++)
{
TableRow row = new TableRow();
for (int j = 0; j < 20; j++)
{
TableCell cell = new TableCell();
Button bt = new Button();
bt.ID = string.Format("bt{0}_{1}", i, j);
bt.Text = string.Format("{0}行{1}列", i, j);
bt.Click += new EventHandler(bt_Click);
cell.Controls.Add(bt);
row.Cells.Add(cell);
}
tb.Rows.Add(row);
} this.Controls.Add(tb);
} void bt_Click(object sender, EventArgs e)
{
Button bt = sender as Button;
string[] tmp = bt.ID.Replace("bt", string.Empty).Split('_');
int row = int.Parse(tmp[0]);//行
int col = int.Parse(tmp[1]);//列 //后面该怎么数据库操作就怎么操作
}
你都知道行列了,也知道数据库对应的行列
判断当
if(行相等&&列相等)
{
//text就显示为已设置的bttext
}用linq的话
假设你的数据库读出来的数据对应的实体集合为 List<BtEntity> list
BtEntity entity = list.Where(e=>e.Row == i && e.Column = j).FirstOrDefault();
if(entity!=null)
{
//text = entity.Text
}