3
Answers

Problem In Gridview

Deepak Pandey

Deepak Pandey

14y
2.3k
1
i hv problem in gridview. In gridview i have two template field.
in one template field there is label which showing questions stored in databse. and other template field contains Textbox. i want to store the value entered in the textbox but there is problem when i tried to stored the question and the value entered in the textbox in another table...it only storing the question displayed on the label not the value stored in the textbox.
try to solve my problem...............
                                  Thanks
Answers (3)
0
ali tuncer

ali tuncer

NA 2.9k 108 8y

Vincent is right, I thought you were using DataGrid control in Winforms..

You could add rows to Datatable..set Datatable as your Datasource for datagrid...


 

0
Vincent Maverick Durano

Vincent Maverick Durano

NA 19.1k 2.2m 8y
DataGrid uses Items instead of Rows. 
 
If you want to add data to DataGrid then you need to add data to your DataSource instead of your DataGrid since the grid render the data based on your data source.
 
Check this link for example: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.items(v=vs.110).aspx 
0
Carlos kambui

Carlos kambui

NA 392 56.4k 8y
asp.net
 
0
ali tuncer

ali tuncer

NA 2.9k 108 8y
Is this Winform?, can you see Rows in intellisense after dgv1? 
0
Carlos kambui

Carlos kambui

NA 392 56.4k 8y
i have done and encountered this error
'System.Array' does not contain a definition for 'Rows' and no extension method 'Rows' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?) 
 
0
ali tuncer

ali tuncer

NA 2.9k 108 8y

parameters are wrong, try this way:

string[] testrow = new string[] { txtname.text,txtAge.Text,txtGender.text };
dgv1.Rows.Add(testrow);