Changing DataGrid cells and child controls based on other cells values... having trouble

I am trying to examine the value of one cell, then disable other controls in the same row (in other cells) based on this. Basically if this cell = Yes or No, then disable a dropdown in another cell.

I have tried the ItemCreated and ItemDataBound and am intercepting the event.itemtype by
(ListItemType.Item and ListItemType.AlternatingItem) but it is telling me that value of this cell when i examine it is empty.
Should i wrap the value in a label or something? I have tried that as well but it doesnt work, the value is always empty when checking during these events but at render time the value is there of course.
Can anyone point me in the right direction? Thanks.
- rem


MCP + Senior .NET Developer
Vista: Worth every penny.
3/19/2005 11:34:09 AM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 46

I figured it out, i will have to get at the underlying dataItem and it's item array to compare the values at that time.... I got it working now. I am just curious about the event stages, at what point you can evaluate items prior to them rendering so you can change values or display on other items...

- rem


MCP + Senior .NET Developer
Vista: Worth every penny.
3/19/2005 5:57:42 PM
in the ItemDataBind event, you can check the DataItem property of the Item and check the value that corresponds to the column that you wanted to check.
Wessam Zeidan
3/19/2005 6:00:56 PM

Similar Artilces:

Change Datagrid cell color based on cell value
I was wondering if there is a way to change the background color of an individual cell in a datagrid based on it's value. (I code in VB) Example: I have a Due Date field and the cells need to be highlighted yellow for all dates that are over 30 days old. Then for all of the dates that are over 60 days old, their cell backgrounds would need to be red. Thanks for the help in advance Dan Take a look @ Change Color of a Column Based on Column Values In your case you can use <Table> tag and change the <td> background color using helper function HTH Sushila ...

Changing the value of one cell when the user changes the value of another cell
I am using a standard GridView with multiple columns and a SQLDataSource. One column is called Qty and another column is called Date. When the user clicks the Edit button and enters a quantity into the Qty column, I would like to automatically fill in today's date into the Date column...before the user clicks Save. Any ideas on how to do that? Thanks in advance, Rick     You would have to make an asych call, check out ASP.NET AJAX: add a javascript event on the quantity textbox the onchange On the gridviews rowdatabound add this  Protected Sub Gr...

Edit the cell text by clicking in the cell in datagrid control
Sir,In 2.0 application, I want to edit the cell text by clicking in the cell in datagrid control. By EditItemTemplate it is possible to edit the cell text but for that we need to click on Edit button and after edit we need to click on Update button. But this way is not accepted. Is it possible in datagrid (possibly without activex control) to click in cell and edit the value and click out of the cell to update just like windows application grid?I did not find any article on web related to this.Please help me.Thanks in advance.    &nbs...

Changing a Cells color based on another cells value
We want to change the color of a previous cell based on the value in the current cell. For example, say we are ranking items as they are read into the datagrid. We have several columns of data we want to rank for first and second place. Once we encounter a value that is greater than the previous high value we would like to change the previous high values cell color to yellow and the new high cells color to green. For example column 1 in the following table would have 12 highlighted in green and 10 highlighted in yellow. See the following table. Column 2 would have 11 highlighted green and th...

change format of one control based on value of another control
Hi, I am very new to and need some help with an odd requirement.  We use Visual Web Developer for all our work and have built our corporate intranet around it.  On our home page we have a hyperlink to our IT departments status page (traffic light system), we want to change the colour of the hyperlink text to be the same as the most serious traffic light on the other page (may be even flash the text for "red" issues)? Our IT department directly edit the traffic light network status page themselves, via a text editor, so the hyperlink on the home page needs to pic...

Changing cell colors in a datagrid based on the information contained in the cell
Any help I can get would be greatly appreciated. I have a datagrid with information in several columns that show the status of certain aspects of a given project. Red for an area in trouble in trouble, yellow for those having problems that could become serious and green for those running as planned. What I would like to do is have the cell color change to correspond to the status of the project. Since the project managers update the status of projects as needed the color would need to change based on the text entered into the cell turning either red, yellow or green to correspond. H...

Move a control from cell to cell
I have a custom control, but for this question let's keep it simple and use a "button".  Without deleting the old button and creating a new button, I would like to "move" it's location from a cell in one table, to a cell in a completely different table. Any ideas? Doing "getElementById" to find the id of the control, and then "appendChild" to the cell gives me an "invalid pointer" error.  So obviously it doesnt want the same control pointed to twice on the page.   You can try the following. This might no...

How to change the name value of attributes of textbox control that added DataGrid control?
I created a DataGrid and added a textbox control as a template column and binded a DataSet as for DataSource in my webform1.aspx. when you looked at the HTML format souce code of dataGrid after that have generated . i found all the textbox named with datagrid,textbox and a random number. The question is how can i rename it in running time? i have tried some times in different event of datagrid  but i fail! thanks. Of course the ID of the textbox will not be the same as you named it, because datagrid contains lots of rows and each row will have a textbox, so to...

What is the difference between e.Item.Cells[1].Controls[0] and e.Item.Cells[1].Controls[1] ?
I usually work with Datagrid but I do not understand the difference between ...Controls[0] & Controls[1] in DataGrid. Please give some suggestion ! Thanks a lot ! briefly a DataGrid is rendered as an HTML Table containing TR ( item ) and TD ( cells ) elements at runtime e.Item.Cells refer to the TableCellCollection in the current row this cells collection, like any collection in .NET, is zero-based, meaning the first cell in the Cells collection is Cells [ 0 ], and the next is Cells [ 1 ], etc. e.Item.Cells [ x ].Controls refer to the control collection within the cell. Thi...

change one gridview cell text format based on another gridview cell value??
I have the following (I code in VB) in a datagrid nested inside a DataList: The hiddencolumn style prevents the CAB column/data field from showing in the browser. How do I make the "Consumer" datafield cell text be purple and italic if CAB is True or -1 in Access?? I code in VB, and I know the code has to be in the one of the row or data events of the gridview. Thank you, Tom Convert your Consumer to a template field with label, id = "Label1" then try using the RowDataBound event of the gridview and code something like: If e.Row.RowType = DataControlRowType.Data...

Could anybody help me about How to Get the Cell value from Gridview Control while I use Mouse Click on one Cell?
Hi Sir,    Here goes my question,I'v drag a Gridview control and binded data to it ,I'm thinking ,Can I get the value from the Cell which I used the mouse  to click on it ? Thanks for your kindly help.Here.I.Am Edit Columns in the Smart Tagthen on the column use want to use click the "Convert to a Templated Field"Now Click OKGo back to smart tag, and Edit Templated field, On the Field you want to change, Item Template, you delete the Label Field and add a HyperLinkWhen you add the hyperlink, a smart tag will appear asking you to "Edit DataBindings", click it.Now ch...

How can I get a particular cell value from the selectedRow of Datagrid custom control?
  I have generated one custom control as like datagrid web server control. In that I have a problem in getting particular cell value from selected row. How can I get selectedRow as a array of column values using javascript code?  ...

Trouble controlling .net controlls with CSS
 I am trying to control the :hover css property on <asp: Button> controls. Basically the css is working correctly to set the initial look of the button, but nothing is happening when I hover over the button. Here is my code:CSS:.sidebarButton{    width: 168px;     height: 45px;     background-color: #666666;     text-align: left;    font-weight: bold;    font-family: Century Gothic;    font-size: 13pt;    color: White;    border-style: none;  ...

DataGrid Edit
I have a DataGrid that lists items from a hardware catalog. Having edited the price of an item and selected update, the InventoryGrid_UpdateCommand()  method reads the price into a textbox: TextBox Price = (TextBox)e.Item.Cells[3].Controls[0];. The problem is that it seems to be reading the original value not the value I have entered. Any ideas?         <code> <asp:datagrid id="InventoryGrid" runat="server" width="536px" bordercolor="Silver" borderwidth="1px"          &nbs...

Web resources about - Changing DataGrid cells and child controls based on other cells values... having trouble -

The Changing Light at Sandover - Wikipedia, the free encyclopedia
"The Changing Light at Sandover" is a 560-page epic poem by James Merrill (1926–1995). Sometimes described as a postmodern apocalyptic epic, ...

Is Facebook Changing How We Travel?
When one of your Facebook friends posts a photo album of their trip to Maui, they’re not just showing off — they might also be acting as a travel ...

Missed this week's Changing Track?... - 774 ABC Melbourne - Facebook
Missed this week's Changing Track? We've got you covered. Like to submit your own? Email it to

Facebook changing PMD program to Facebook Marketing Partners
Facebook’s Preferred Marketing Developer program may be getting a new look. Earlier today, Facebook announced on the Facebook for Business page ...

Changing Lanes (@chginglanes) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Changing the way business decisions are made
We believe that social data has unlimited value, and near limitless application. Today, we’re taking an important step toward unleashing this ...

12 Minutes To Create a Mind-Changing Presentation
... draft great presentations and to become a more effective and convincing presenter. Twelve minutes which can 12 Minutes To Create a Mind-Changing ...

We're Changing Our Name (Back) to Stack Overflow
We are Stack Overflow. You may know us from such popular websites as Stack Overflow Q&A, Stack Overflow Careers, The Stack Exchange Q&A Network, ...

The Tao of Twitter: Changing your life and business 140 characters at a time - Amazon
It's time to take the mystery out of Twitter. Twitter may be the most powerful business and personal networking platform ever created but it ...

App Store - Voices 2 ~ fun voice changing!
Read reviews, get customer ratings, see screenshots, and learn more about Voices 2 ~ fun voice changing! on the App Store. Download Voices 2 ...

Resources last updated: 1/17/2016 8:39:11 PM