Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have an asp.net web page, in which i am selecting the specific class and division in school. based on these values the gridview will be loaded with the student names(stored in students table in sql server db) in that class. If i want to assign the marks of a test to every student using this gridview all at a time (bulk entries), then how to do it. ( my idea is like, having first column as boundfield for student names, second column as textbox for marks and lastly i have an add button for each row).

Thanks in advance.
Posted

1 solution

Yes you can do it.

First Column will be BoundField and other one will be a TemplateField.
Inside EditItemTemplate of TemplateField, you will place your TextBox and inside ItemTemplate one Label.

Label inside ItemTemplate will show when GridView is not in Edit mode and TextBox inside EditItemTemplate will show when GridView is in Edit mode.

You can easily find examples in Google for that.
 
Share this answer
 
Comments
TrushB 9-Oct-13 12:32pm    
Thanks Tadit for your help.
This is really helpful, but i don't want the user to click on edit button for each n every row as b'coz a class has minimum 30 students. instead i want the gridview to be loaded as first column as boundfield and the second column as a textbox itself and after that there should be an add button which will insert these records in database. is it possible?
Yes possible. Don't use EditItemTemplate. Place TextBox inside the ItemTemplate directly.

Refer - Dynamically adding and deleting rows from ASP.NET GridView

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