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

[Solved] Can't set column value dynamically

4 Answers 117 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yogesh
Top achievements
Rank 1
Yogesh asked on 11 Jan 2011, 03:07 PM
Hi,

I have a gridview in my silverlight application. In which I am adding columns and data to it dynamically, now the problem is that, columns which are not visible in UI ( i.e. columns are added but it is out of UI, so user has to scroll horizontally to view that columns value ).

So the values which are set to that columns are lost. Even I am not getting those columns reference in gridview_rowloaded event

e.g. suppose the gridview has 9 (0-8) columns and only 8 are currently visible in UI and the 9th one is out of UI, so scroll bar appears automatically to view that column, now if we set value to 9th column it gives error : Index

private void gridview1_RowLoaded(object sender, RowLoadedEventArgs e)
{
    e.Row.Cells[8].Content = "test"; // Error : Not a valid Index //
      
    // If we insert a break point here the value of cell count property is 8 (0-7) //
}

 

 

 


One solution which I found is that if I resize the gridview so that it displays all the columns then this problem will not happen. But in my situation I am not able to resize it.

So please help me with my problem ASAP.

Thanks,
Yogesh

 

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Adrian
Top achievements
Rank 1
answered on 13 Jan 2011, 10:08 AM
Hello Yogesh,

did you find any solution for your problem? I'm using a GridView and hove the very same problem.

Greets
Adrain

0
Accepted
Vlad
Telerik team
answered on 13 Jan 2011, 10:54 AM
Hello,

 When the grid column virtualization is on (by default) only visible columns cells are created. If you do not want this you should set EnableColumnVirtualization to false. 

Greetings,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Adrian
Top achievements
Rank 1
answered on 13 Jan 2011, 12:03 PM
Works fine, thanks Vlad.
0
Yogesh
Top achievements
Rank 1
answered on 13 Jan 2011, 12:16 PM
Hello Vlad,

The problem has been solved by your answer.

Thanks for your reply.


Regards,
Yogesh
Tags
GridView
Asked by
Yogesh
Top achievements
Rank 1
Answers by
Adrian
Top achievements
Rank 1
Vlad
Telerik team
Yogesh
Top achievements
Rank 1
Share this question
or