怎么实现由事件触发在Table中添加TextBox的问题...急等着呀!!谢谢 我想用一个N(可变的行数)二列的表格,第一行第一列里面放了一个TextBox1,第二列有一个Button,我想点击Button后触发事件 就是在表格的第二行第一列就会出现一个TextBox2,同时上一个Button就跳到第二行第二列,再点击Button后在表格的第三行第一列就会出现一个TextBox3,同时上一个Button就跳到第三行第二列,依次类推.... 请问大虾们怎么实现,小弟想了几天了,请附上代码:万分感谢!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 HtmlTable htb = Table名字;htb.Controls.Remove(Button控件名字);HtmlRow htr = new HtmlRow();HtmlCell htc1 = new HtmlCell();//Cell属性设置HtmlTextBox txtTextBox = new HtmlTextBox();//设置属性htc1.Controls.Add(txtTextBox);htr.Cells.Add(htc1);HtmlCell htc2 = new HtmlCell();//Cell属性设置HtmlButton btnButton = new HtmlButton();//设置属性htc2.Controls.Add(btnButton);htr.Cells.Add(htc2);htb.Rows.Add(htr) 就是呀,难就难在写触发事件上呀,同时我的触发事件的Button 也是动态跳转的呀,我很感谢一楼的兄弟,但是和我想的不完全一样!那位高手帮帮撒!! private Button_OnClick(object sender, EventArgs e){ HtmlTable htb = Table名字; htb.Controls.Remove(Button控件名字); HtmlRow htr = new HtmlRow(); HtmlCell htc1 = new HtmlCell(); //Cell属性设置 HtmlTextBox txtTextBox = new HtmlTextBox(); //设置属性 htc1.Controls.Add(txtTextBox); htr.Cells.Add(htc1); HtmlCell htc2 = new HtmlCell(); //Cell属性设置 HtmlButton btnButton = new HtmlButton(); //设置属性 btnButton.OnClick += new EventHandler(this.Button_OnClick); htc2.Controls.Add(btnButton); htr.Cells.Add(htc2); htb.Rows.Add(htr)} 其实你可以在上面加一行比在下面加要容易。点击button时在第一上面加一行只有TextBox,赋值为原来那个TextBox的值,再清空原来那个,那么你所有问题都解决了,因为从头到尾都只有一个button,不用动态对button加Click+=,而写代码的地方也没的你考虑了,只有一个地方。还有问题么? 而且,“看起来”跟你说的那种没有有区别。同样是button到了第2行,同样是第2行多了TextBox 想实现两个webbrowser 同步显示 关于modify,还是把自己搞晕了,望各位指导!!多谢!! 急求有关SNMP协议的应用的例子。 關於對數據庫操作的問題 求救!怎样才能将上传的Word文件不保存在服务器本地磁盘,而是直接转换成HMTL格式文件然后用二进制入库? 求教!数据库方面 有无办法忽略文件编码按字节读取文件然后再还原 为什么按钮click事件结束后,才能点击别的按钮? SeverSQL实现日记记录中使用触发器的问题 这段代码是什么意思? C#中动态加载用户控件问题并和用户控件交互问题 请教winform下水晶报表的使用
htb.Controls.Remove(Button控件名字);HtmlRow htr = new HtmlRow();
HtmlCell htc1 = new HtmlCell();
//Cell属性设置
HtmlTextBox txtTextBox = new HtmlTextBox();
//设置属性
htc1.Controls.Add(txtTextBox);
htr.Cells.Add(htc1);HtmlCell htc2 = new HtmlCell();
//Cell属性设置
HtmlButton btnButton = new HtmlButton();
//设置属性
htc2.Controls.Add(btnButton);
htr.Cells.Add(htc2);htb.Rows.Add(htr)
{
HtmlTable htb = Table名字;
htb.Controls.Remove(Button控件名字); HtmlRow htr = new HtmlRow();
HtmlCell htc1 = new HtmlCell();
//Cell属性设置
HtmlTextBox txtTextBox = new HtmlTextBox();
//设置属性
htc1.Controls.Add(txtTextBox);
htr.Cells.Add(htc1); HtmlCell htc2 = new HtmlCell();
//Cell属性设置
HtmlButton btnButton = new HtmlButton();
//设置属性
btnButton.OnClick += new EventHandler(this.Button_OnClick);
htc2.Controls.Add(btnButton);
htr.Cells.Add(htc2); htb.Rows.Add(htr)
}