Click here to Skip to main content
15,887,898 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to add row wise control in Grid view .
In My requirement Every Column has 6 rows in that 6 rows 3 are text boxes and 3 are dropdown list but in grid view we cannot add row wise control so please help to me for this ...

for example in Columns first row for user name, second is for Last Name, third row for address, fourth row is for State , fifth row for District and last row for Tahasil .
this types of multiple columns with same structure as above.

so for first three row i need text box for input and for another three row has need dropdown list selection . This is my requirement so please help me for sort out this.

Thanks in Advance ..

What I have tried:

I have tried multiple ways but i didn't get solution.
Posted
Updated 18-Jun-19 2:08am
Comments
Maciej Los 18-Jun-19 2:19am    
This sounds very strange...
I'd suggest to change rows with columns or create 2 grids: first for textboxes, second for dropdowns, as they describe personal data and place of living.
F-ES Sitecore 18-Jun-19 3:53am    
The GridView isn't suitable for this, you need to use a Repeater instead which gives you complete control over what is in each "row". Google for examples of how to use one.

1 solution

You can achieve it from c#, check this link https://www.aspsnippets.com/Articles/Adding-Dynamic-Rows-in-GridView-with-DropDownLists-in-ASP.Net.aspx[^]

additionally for Dynamic Text box you have to use the below code

TextBox txt1 = (TextBox)Gridview1.Rows[rowIndex].Cells[1].FindControl("TextBox1");


this link will give you exact solution what you have expecting,

Dynamically Adding and Deleting Rows in GridView and Saving All Rows at Once[^]
 
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