Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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
Posted
Updated 24-May-18 0:35am
v4
Comments
Sunasara Imdadhusen 10-Apr-18 6:01am    
First you must try yourself. We are hear only if you really tried then!
Member 13771716 10-Apr-18 6:35am    
Apologies, i didn't word my question correctly.
[no name] 10-Apr-18 8:23am    
You can edit template of your grid control and add text box control in TemplateField section. This will repeat the text box for each row of record you display in Gridview Control.

1 solution

your question is bit unclear. if you want just html solution for displaying two columns in a row here it is:
HTML
<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>



if you want a grid with inline editable textboxes, check out DataTable-js. Here is the link: DataTables example - Simple inline editing[^]

if you need basic help on working with form elements and model classes and form submission, check this out:
https://www.aspsnippets.com/Articles/ASPNet-MVC-Form-Submit-Post-example.aspx
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900