如何将TableData绑定到Asp.Net + C#中的TextBox控件中 [英] How to Bind a TableData in to TextBox Control in Asp.Net + C # is it Possible

查看:73
本文介绍了如何将TableData绑定到Asp.Net + C#中的TextBox控件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将表数据绑定到textBox控件

应该是这样的

< img src ="http://www.maxupload.net/images/05950700839676014758_thumb.jpg" border = "0" alt ="05950700839676014758.jpg"/>




谢谢&问候

:rose:rpkaran:rose:

how to bind a table data to textBox control

it should be like this

<img src="http://www.maxupload.net/images/05950700839676014758_thumb.jpg" border="0" alt="05950700839676014758.jpg" />




Thanks & Regards

:rose: rpkaran :rose:

推荐答案

使用数据控件.将文本框放置在itemtemplate中并绑定控件.这样的东西(根据图片)

Use a data control. Place the textboxes in the itemtemplate and bind the control. Something like this(according to image)

<asp:Repeater ID="rptDocuments" runat="server" >      
      <ItemTemplate>
                  <tr>
                    <td >
                       
                     <asp:TextBox ID="TextBox1" runat="server" Width="10" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem,"ColumnName") %>'></asp:TextBox>
                    </td>
                  </tr>
      </ItemTemplate>    
      </asp:Repeater>


像这样尝试
try like this
DataSet ds = new DataSet();
da.Fill(ds, "employee");
// Bind to FirstName column of the Employees table 
textBox1.DataBindings.Add("text", ds, "employee.firstname");


这篇关于如何将TableData绑定到Asp.Net + C#中的TextBox控件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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