Hi,
My grid has a column on which if the the column cell has null value i want to show some text depending on flag e.g. My grid has column1, column2, column3. Grid has 4 records of which two has null value for column1.
I want to show if column1 cell has null value and flag = true (this flag value is getting from the data source which i bound to the ultragrid ) then show cell value = 'Completed (Some status)' or
if column1 cell has null value and flag = false then show cell value = "N/A"
How can I achieve this, I unable to decide on which event I have to write the code. May be cell related event will be helpful so that I can set the value.
Thanks & Regards,
Pramod Pawar
No issues Mike.. Unbound column solves my problems... Only concern was with our existing framework. Either way, I need to modify the logic, so better to go with Unbound column :)
Thanks anyways for your great Direction.
Hi Pramod,
You cannot set the Text because the text is generated from the Value and accounts for things like Format and Masking on the column. It also accounts for a ValueList which converts a DataValue into matching DisplayText.
If you don't want to use an unbound column, then you have some other options. You could use a DataFilter and an editor. But this is more complicated than using an unbound column and it requires you to handle the conversion in both directions.: DisplayText to DataValue and vice versa.
Allright....thanks a lot..will try with unbound column then.. but why do we have text as a read only..
Can't I submit to have feature to assgin a text. Cause, binidng with unbound column will be disturbing the existing layout or existing framework issues.
Thanks,
You cannot set the Text of a cell, only the Value can be set. And the Value will always write to the DataSource.
That's why I suggested using an unbound column, but you said you were okay with updating the actual data.
If you cannot actually change the value in the data source to the text you want, then you will have to use the unbound column approach I described above.
e.Row.Cells["column key"].Value (or Text)
Yeah..I tried this. But, it only allows e.Row.Cells["column key"].Value and not able to set
e.Row.Cells["column key"].Text - (Getting error read only property cant assigned). And value is getting bound from DataColumn. And Datatype of this bound column is DateTime, hence its not allowing me to set string value to this column. So, unable to set e.Row.Cells["column key"].Value.
Is there any way to set e.Row.Cells["column key"].Text . If so, I can set the string value to that. It will solve my issue.
thanks