Perhaps the string is converted to a value that is out of the bounds of the Cell collection. Have you inspected Convert.ToInt32(str) in the watch window?
>I'm experieincing a weird situation on a custom control I've created from a DataGrid. What I was attempting to do is add a property in which I could specify a comma-delimted list of column indexes I want the control to automatically sum in the footer.
>
>To do this I've overriden the 'OnItemDataBound' event; for each row being bound, I get the value for each cell I've designated for summing. However, it seems that whenever I cast the cell value to a decimal (the type i need for summing) the control will not render in the designer. I get the following message:
>
>.. "There was an error rendering the control. Check to make sure all properties are valid".
>
>The only difference is how I'm referencing the index of the cell. If I use a variable, the rendering does not work:
>
>foreach(string str in summaryIndexes)
>{
> cellIndex = Convert.ToInt32(str);
> foreach(DataGridItem dgi in this.Items)
> {
> TableCell tc = dgi.Cells[cellIndex];
> }
>}
>
>... But it does work if I have a hard-coded interger instead:
>
>foreach(string str in summaryIndexes)
>{
> cellIndex = Convert.ToInt32(str);
> foreach(DataGridItem dgi in this.Items)
> {
> TableCell tc = dgi.Cells[0];
> }
>}
>
>Anyone know what the deal is?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only