如何在同一行的不同列中插入两个文本框? [英] How can I insert two text boxes in separate columns on the same row?

查看:178
本文介绍了如何在同一行的不同列中插入两个文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我在数据库中显示了一个列,其中包含表格中的项目描述。我现在一直试图在显示的每个项目描述的不同列中插入两个文本框,我可以输入值。在提交时,将值插入到我的数据库中的两个不同的列中,对应于该行的项目描述ID。



我是c#和ASP的完全初学者.NET所以尝试了很多不同的方法。



我尝试过的方法:



我尝试在我的c#代码中加入一个循环,因为当显示项目描述打印每一行时,我试图在表格中再添加两行并在每个行中打印一个文本框。但它不起作用

In my project, i have displayed a column from my database which contains item descriptions into a table. I now have been trying to insert two text boxes in separate columns for every item description displayed, that i can input values into. Which when submitted the values are inserted into two different columns in my database corresponding with the item description id of that row.

I'm a complete beginner with c# and ASP.NET so have been trying lots of different methods of doing so.

What I have tried:

I tried incorporating a loop in my c# code for that when each row was printed from displaying the item description, I tried to append two more rows to the table and print a text box in each. but it didn't work

推荐答案

你的问题有点不清楚。如果你只想在这里连续显示两列的html解决方案,那就是:

your question is bit unclear. if you want just html solution for displaying two columns in a row here it is:
<pre><div class="row" style="padding:2%">
  <div class="col-md-6">
    <input type="text" name="txtOne" class="form-control" />
  </div>
  <div class="col-md-6">
    <input type="text" name="txtTwo" class="form-control" />
  </div>
</div>







如果你想要的话具有内联可编辑文本框的网格,请查看DataTable-js。以下是链接: DataTables示例 - 简单内联编辑 [ ^ ]



如果您需要有关使用表单元素和模型类以及表单提交的基本帮助,请查看以下内容:

https://www.aspsnippets.com/Articles/ASPNet-MVC-Form-Submit-Post-example.aspx


这篇关于如何在同一行的不同列中插入两个文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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