could you do this with a gridview

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi I need to build a grid and when the webform loads the grid is displayed
with 2 columns containing populated dropdown lists (I think use template
columns for these) plus 2 columns as check boxes and 2 columns as text boxes
for data input. I need the user to be able to add rows (save to database) as
well as change the order of the rows, move a row up or down in the grid.
Anyhow just wondering if a datagrid might work for this, thanks.
 
Hi I need to build a grid and  when the webform loads the grid is displayed
with 2 columns containing populated dropdown lists (I think use template
columns for these) plus 2 columns as check boxes and 2 columns as text boxes
for data input.  I need the user to be able to add rows (save to database) as
well as change the order of the rows, move a row up or down in the grid.  
Anyhow just wondering if a datagrid might work for this, thanks.

A Gridview can only be used to edit one row at a time. The row being
edited will be in edit mode while the rest will be in read mode so no
point in drop-down lists or checkboxes except for display purposes
only. The EditItem template can have active controls of the foregoing
type but will need a data-source declared inside the template to
populate them. The selected values though need to be bound to the
GridView datasource to have any effect.

HTH
 
check out this code sample at ASPNet101.com:http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=gvfull...

Quite fascinating!

However the GridView in the sample has to be supplemented with so much
code (in an effort to override its normal behaviour) that it becomes
questionable as to whether the use of such control is worth it. You
might as well construct an ordinary table adding rows and cells whilst
iterating through a database table. That way you can do exactly what
you like and have complete control over all events with behaviours,
binding expressions and procedures of unlimited complexity.
 
Thanks for the responses, so sounds like using a table webcontrol would be
easier to impliment! I have used the simple html tables to organize control
placement on a web form but have not used the table web control, guessing
there are plenty of code samples available.
 
Back
Top