[英]How insert data to Table * cell * from textbox
I have 3 textboxes, a button "Add", and a table without any data. 我有3个文本框,一个“添加”按钮和一个没有任何数据的表。
I ask the user to enter data on the 3 textbox's and press button "Add". 我要求用户在3个文本框中输入数据,然后按“添加”按钮。 On clicking "Add" I want to insert this data from the textboxes to cell 1 in the table. 单击“添加”后,我想将此数据从文本框中插入表中的单元格1中。
How can I do this? 我怎样才能做到这一点? I need to fill 3 textbox in one cell not a row. 我需要在一个单元格而不是一行中填充3个文本框。
<h2>Please Enter Car details</h2>
<asp:Label CssClass="details_label" ID="lebal1" runat="server" >Owner name</asp:Label>
<asp:TextBox CssClass="details_input" ID="ownerTxt" runat="server" placeholder="Enter Owner name"></asp:TextBox>
<asp:Label CssClass="details_label" ID="label2" runat="server" >Car Brand</asp:Label>
<asp:TextBox CssClass="details_input" ID="brandTxt" runat="server" placeholder="Enter Car Brand"></asp:TextBox>
<asp:Label CssClass="details_label" ID="label3" runat="server" >Car Number</asp:Label>
<asp:TextBox CssClass="details_input" ID="numberTxt" runat="server" placeholder="Enter Car Number"></asp:TextBox>
<asp:Button CssClass="details_button" ID="addbtn" Text="Add" runat="server" Height="16px" Width="65px"/>
<table class="table">
<tr>
<th>Zone 1</th>
<th>Zone 2</th>
<th>Zone 3</th>
</tr>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
</tr>
</table>
</form>
</body>
</html>
将单元格1转换为服务器控件(将<td>Cell 1</td>
替换为<td id="cell1" runat="server">Cell 1</td>
,依此类推),向addbtn
添加OnClick处理程序,从此处理程序中的文本框中读取值,并将其值分配给cell1
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.