could you do this with a gridview

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.
 
S

Stan

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
 
S

Stan

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.
 
P

Paul

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top