473,769 Members | 4,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding and Showing Columns in Editable GridView

I have a gridview that is being used for managing inventory. The default
view shows the stock currently available. When editing I don't want the
stock to be directly edited, rather the user will enter the amount of items
being added/removed.

When the user clicks the 'Edit' link I want to hide the stock column and
display a field for the TransactionAmt. I'm using the RowUpdating event to
execute some functions used by that field. I've added the column and am
showing/hiding using the visible property, which works fine for that, but
when I hide the stock column I can no longer access the value that was in
that field.

Any suggestions?
Mar 21 '07 #1
2 1655
In yoru gridview, editTemplate, simply just make the textbox disabled,
then you shall be able to get teh value later on.

Hope that helps.

Liming Xu
Jumptree Project Management
www.jumptree.com

On Mar 21, 4:15 pm, Josh Schmidt
<JoshSchm...@di scussions.micro soft.comwrote:
I have a gridview that is being used for managing inventory. The default
view shows the stock currently available. When editing I don't want the
stock to be directly edited, rather the user will enter the amount of items
being added/removed.

When the user clicks the 'Edit' link I want to hide the stock column and
display a field for the TransactionAmt. I'm using the RowUpdating event to
execute some functions used by that field. I've added the column and am
showing/hiding using the visible property, which works fine for that, but
when I hide the stock column I can no longer access the value that was in
that field.

Any suggestions?

Mar 22 '07 #2
Any web control with Visible=false doesn't get rendered to the client and,
naturally, doesn't come back in postbacks. If you are interested in the
hidden value either on client side or in postbacks, hide with a css rule
display:none.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Josh Schmidt" <Jo*********@di scussions.micro soft.comwrote in message
news:2C******** *************** ***********@mic rosoft.com...
>I have a gridview that is being used for managing inventory. The default
view shows the stock currently available. When editing I don't want the
stock to be directly edited, rather the user will enter the amount of
items
being added/removed.

When the user clicks the 'Edit' link I want to hide the stock column and
display a field for the TransactionAmt. I'm using the RowUpdating event
to
execute some functions used by that field. I've added the column and am
showing/hiding using the visible property, which works fine for that, but
when I hide the stock column I can no longer access the value that was in
that field.

Any suggestions?

Mar 22 '07 #3

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

Similar topics

2
2224
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups of searchable fields in the fields 3. Each group can be expanded/collapsed by clicking on a link "(Fewer|More) Options" which sits right next to the group title.
1
840
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems controlling the visibility of columns in the DataGrid control. The problem usually comes down to one fact. The DataGrid has a property called AutoGenerateColumns. The default value is "True". This means that when AutoGenerateColumns is set to True,...
5
1638
by: srinivas | last post by:
Hi, I have binded a dataset to a gridview control at run time. I'm fetching 5 columns from the database. But while displaying it on the screen i want to show only 3 columns. I tried with gridview.columns(i).visible property,but it did't work. Thanks in advance Srinivas
1
1821
by: Dica | last post by:
i need to allow the user to select a row from my dataGrid for editing. as such, i include the record ID in the first column and then extract like so when retrieving the record details: protected void gvLocations_edit(object sender, GridViewEditEventArgs e) { // load the record details into the edit fields // GridView gvRecord = (GridView)sender; string sThisRecord = gvRecord.Rows.Cells.Text; ...
2
2910
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
Based on wether a row is selected in a GridView I need to HIDE the last two columns of a gridview. I do NOT need to make the cells invisible I want to hide the entire column. When I set the Visible property on the columns it causes the underlying ObjectDataSource to re-issue the Select statement. How can I hide these columns without double clutching the ODS Select?
4
9790
by: mohaaron | last post by:
This seems like it should be simple to do but for some reason I have been unable to make it work. I would like to databind a SqlDataSource to a GridView during the click event of a button. This sounds easy but the next requirement is that the GridView is editable. So I have included the SelectCommand and the UpdateCommand on the SqlDataSource to allow the GridView to be editable. I have now been able to get the GridView to display data...
0
1259
by: hedgracer | last post by:
I have a gridview that has six columns. I need to hide the last column (i.e. not download it) in the download from gridview to excel. My current code (which downloads the entire gridview) is as follows: public static void ExportExcelFile(Control htmlData, string filename) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename="
1
1007
by: taa | last post by:
protected void LoadExercises(object sender, EventArgs e) { // Navn, (Beskrivelse), Type, Exid, Target var exercises = from ex in context.Exercises select new {exerciseId = ex.ExerciseId, exerciseName = ex.Name, exerciseType = ex.ExerciseType.Name, exerciseTarget = ex.Targets.First<Target>().Muscle.Name }; ExercisesGridView.DataSource = exercises; ExercisesGridView.DataBind();
9
12096
by: ally | last post by:
Hi, I am programmatically binding gridview to a datatable. I want to hide 2 columns. I can be done by adding code in RowCreated event of gridview like e.Row.Cells.Visible = false; e.Row.Cells.Visible = false; but after that paging is not working. I tried another way by using gridview's column.Visible property but its giving error
0
9586
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
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
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
5298
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...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.