column.width and data update

L

L.Peter

Hi Group,
I have a gridview bound to a sqldatasource, this datasource pulls data out
from select and update procedures with 10 update parameters
the gridview has 15 columns, in edit mode, I want to hide some columns by
setting gridvew1.columns[7-15].visible = false. so users can focus on 2
editable columns only.
The problem is before editing, fields 7-15 have data, after users update
column 5-6, data in fields 7-15 is gone.
The update statement is very straight forward : update table1 set fld1 =
@fld1,....fld15=@fld15 where primarykey =@pk
If I display all 15 columns when in editing mode, update works fine, no data
lost, so I know that problem is on columns.visible = false.
Question: is it by design? how to get around it
TIA
Peter
 
J

Jester98x

Hi Group,
I have a gridview bound to a sqldatasource, this datasource pulls data out
from select and update procedures with 10 update parameters
the gridview has 15 columns, in edit mode, I want to hide some columns by
setting gridvew1.columns[7-15].visible = false. so users can focus on 2
editable columns only.
The problem is before editing, fields 7-15 have data, after users update
column 5-6, data in fields 7-15 is gone.
The update statement is very straight forward : update table1 set fld1 =
@fld1,....fld15=@fld15 where primarykey =@pk
If I display all 15 columns when in editing mode, update works fine, no data
lost, so I know that problem is on columns.visible = false.
Question: is it by design? how to get around it
TIA
Peter


Peter,

You can achieve this in one of three ways:
1 - Edit the Edit template (of the gridview) to remove the items you
don't want users to view while editing
2 - Set the visible properties of the bound items you don't want users
to view to false
3 - Update the update procedure to only update the fields you are
actually allowing the users to edit

Steve
 
L

L.Peter

Hi Steve,
Thank you for response.
I can't remove columns as user 1 wants to edit column 5, user 1 wants to
edit column 6 ...
when you said "2 - Set the visible properties of the bound items you don't
want users
to view to false", you mean column or item ? I tried column and it causes
data lost for non-update columns i.e: say before editing:
fld5=2, fld6=3, fld7=4, user chooses to have fld5 visible, so I set visible
of column fld6 and 7 to false, user change fld5 from 2 to 0 and click
update, now fld5=0, fld6=null and fld7=null , if you meant item then what's
the name of the property please
Thanks

Peter

Jester98x said:
Hi Group,
I have a gridview bound to a sqldatasource, this datasource pulls data out
from select and update procedures with 10 update parameters
the gridview has 15 columns, in edit mode, I want to hide some columns by
setting gridvew1.columns[7-15].visible = false. so users can focus on 2
editable columns only.
The problem is before editing, fields 7-15 have data, after users update
column 5-6, data in fields 7-15 is gone.
The update statement is very straight forward : update table1 set fld1 =
@fld1,....fld15=@fld15 where primarykey =@pk
If I display all 15 columns when in editing mode, update works fine, no data
lost, so I know that problem is on columns.visible = false.
Question: is it by design? how to get around it
TIA
Peter


Peter,

You can achieve this in one of three ways:
1 - Edit the Edit template (of the gridview) to remove the items you
don't want users to view while editing
2 - Set the visible properties of the bound items you don't want users
to view to false
3 - Update the update procedure to only update the fields you are
actually allowing the users to edit

Steve
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top