I have 3 textboxes, a button "Add", and a table without any data.
I ask the user to enter data on the 3 textbox's and press button "Add". On clicking "Add" I want to insert this data from the textboxes to cell 1 in the table.
How can I do this? I need to fill 3 textbox in one cell not a row.
<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
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.