This is a migrated thread and some comments may be shown as answers.

[Solved] Grid Not working properly after upgrade..!

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bexm
Top achievements
Rank 1
Bexm asked on 24 Apr 2008, 04:08 PM
Hello!

I have upgraded to the new ajax controls in our project and an existing grid has stopped working properly...

On the ItemDataBound it grabs the value out of column 3 and then runs it through a function to display a new value in column 4 which is a template column.. this is the existing code..


 
            if( e.Item is GridDataItem ) {                  
                GridDataItem item = (GridDataItem)e.Item;  
                if (item.OwnerTableView.Name == "ControlFields")  
                {  
                    CultureInfo ci = new CultureInfo(selectedEditCulture);  
 
                    string controlName = item.OwnerTableView.ParentItem["Name"].Text;  
 
                    string culture = ci.Name;  
                    string parentCulture = ci.TwoLetterISOLanguageName;  
 
                    string key = item.Cells[4].Text;  //<THIS LINE
                    string value = string.Empty;  
 
                    value = doFunction(key);  
                    if (item.IsInEditMode)  
                    {  
                        
                        TextBox tb = (TextBox)item.FindControl("txtValue");  
 
                        if (tb != null)  
                            tb.Text = value;  
                    } else {  
                        Label lb = (Label)item.FindControl("lblValue");  
                        if (lb != null)  
                            lb.Text = value;  
                    }                  
                }  
            } 

This was working fine before we upgraded (altho possibly not the best way of doing it), but now the line
string key = item.Cells[4].Text;  

brings back a value of "&nbsp;" when in editmode.

Why would this have stopped working?

Thanks

Bex

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Apr 2008, 04:47 AM
Hi Bex,

Try accessing the cell value using the columnUniqueName property. Go through the following link for more details.
Accessing cells and rows

Thanks
Shinu.
Tags
Grid
Asked by
Bexm
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or