473,770 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

column.width and data update

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.column s[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[i].visible = false.
Question: is it by design? how to get around it
TIA
Peter
May 4 '07 #1
2 2033
On May 4, 3:45 pm, "L.Peter" <p...@local.loc alwrote:
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.column s[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[i].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

May 4 '07 #2
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" <st**********@w dr.co.ukwrote in message
news:11******** *************@n 59g2000hsh.goog legroups.com...
On May 4, 3:45 pm, "L.Peter" <p...@local.loc alwrote:
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.column s[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[i].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

May 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1939
by: carmen | last post by:
I'm using the code below to display the results in rows with the column header as hyperlinks that will sort the rows by colum heading. Is there a way to have the results sorted (as default) in reverse order so that the most recent are at the top of the page also when the user selects the Open Date or Status column headings, sort the data in reverse order . Code is below. Thanks <% ppl_ctr=0
24
10766
by: Mike L | last post by:
This is for a Win form, in C# 2005. I want to load a datagrid, make some columns width 0, and then clean out the record I added. I get the error message, ""Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"" I have tried, -1,0,1,2 for the index, and I get the same error message on each try.
5
3637
by: VB Programmer | last post by:
I have a simple datagrid on a webform. (I'm using VB.NET.) In the page load I get some data, set the .DataSource property of the dg, then do a .DataBind. The columns are automatically created. Question: How can I dynamically change the width's of these columns? Thanks in advance.
1
1677
by: headbig003 | last post by:
Hello I put template column in datagrid. Below is the html code I used. <asp:datagrid id="dgAnswer" runat="server" Width="360px" AutoGenerateColumns="False" DataKeyField="ansID"> <Columns> <asp:TemplateColumn HeaderText="Answer Text"> <ItemTemplate> <asp:TextBox id="txtItem" runat="server" Width="201px" Text='<%#
17
7438
by: Mike Fellows | last post by:
im trying (unsucessfully) to add a checkbox column to my datagrid i basically have a datagrid that im populating from a dataset Me.DataGrid1.DataSource = ds.Tables(0) the datagrid then has 5 columns in it but i need to add a sixth column which will be my checkbox column - any help or pointers with this would be great
1
2433
by: Jorge | last post by:
Hello All I am trying to preserve the width of column in a datagrid made by the user. On form load i use this <code> Me.DataGrid2.TableStyles("artenc").GridColumnStyles (0).Width = 30 Me.DataGrid2.TableStyles("artenc").GridColumnStyles (1).Width = 30
22
6431
by: Mal Ball | last post by:
I hope I have the right forum for this question. I have an existing Windows application which uses a SQL Server database and stored procedures. I am now developing a web application to use the same database. The original Update and Delete SP's all use a timestamp for concurreny checking. I am trying to use the same Update SP from my sqlDataSource but I keep getting the following error:
0
2186
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check or clear the boxes next to the potential members they want to add or remove.) The Object Data Source is as follows... <asp:ObjectDataSource ID="odsMembers" runat="server" SelectMethod="GetGroupMembersSelectList"...
0
2249
by: JRough | last post by:
Hi, I have a page with a form that is included into a php page. It has some php variables which are headers based on the user choices. In the form I will send some mysql data columns but right now I'm just formatting the form inside the tables. I added the table with the form yesterday and a button. After the data comes from php server I want the user to be able to click the Excel button at the bottom and the form output will go to...
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10057
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9869
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.