Hi,
I want to display text and value different in the grid cell.
If column data type is decimal or datetime then when server is returning with null then it should display null instead of empty, I have applied the solution to assign the null text in cell. But that property assign null whether it is empty string or null value from server.
I'm not sure I understand what you mean. What do you mean by empty? I am not aware of any empty value for a numeric field... unless you mean zero.
First of all thanks for reply.
My question is that, Whether can we apply different values to text property and value property of wingrid cell.
When ever we are running a query if null was entered in that row date then it should display null. That means no date was entered in this row.
If I m providing a criteria select data in particular that rang then if data does not exists in provided data range the it should display empty value instead of null.
I am reading data from file. File contains empty data and null value I want to display accordingly. Because if I am displaying data null in empty cell then customer will consider that now values was enter in this. While this empty values means no values is present in that range. For datatype datatime and decimal.
Further can we provide formatting like excel, Different formatting for different cell. Like for .rows[0].cell[0]= 5.25
.rows[1].cell[0]= null and .rows[1].cell[0]= is it possible to apply different data type to same column for different cell.
If you need code I can provide you.
Well, I'm still not sure I understand exactly what you mean. But it sounds like there are certain values in the data that you want to display something other than the actual value to the user.
If that's the case, then the answer is yes, you can do that. There are 2 basic approaches you can take.
1) You can use a DataFilter. This allows you to trap the value of a cell as it is transitioned from the editor to the display and vice versa. Check out the Infragistics Knowledge Base for sample DataFilters.
2) The other option is slighlty less elegant, but more intuitive to implement. What you could do is hide the actual bound column in the grid and add an Unbound column. Then you could use the InitializeRow event to examine the value in the "real" cell and copy it to the unbound cell. You could translate the value to anything you want to display.
Hi Mike again thanks for reply,
Now I'll explain little bit more clearly. I am reading data from files, I am not sure how many columns are in file that I am deciding at run time.
I am using ultradatasource to load data on demand becuase I can have more than 1000000 rows in the grid. If I am going to add one extra column it will reduce my performace. By question is that when laoding the file following data present in the file.
Date(datetime) ID(string) ClosingBalance(decimal) MoveAve(decimal)
28/01/2001 IBM 40.500 42.360
29/01/2001 IBM null
31/01/2001 IBM 39.560 40.810
IBM null
null IBM null null
This kind of data may exists in the file. While reading the file I want to display exactly same behaviour because if I am going to assing nulltext="null" then it will dispaly null every where whether it is null or empty value.
Please take look on it carefully.
I will be very thankfull to you.
If you just want to display some text for null values, then you can use the NullText property of the column.
If it's more complicated than that and you don't want to add extra columns, then you will need to use a DataFilter as I suggested.
If the cells are not editable, then you might also consider using a CreationFilter or DrawFilter. These would allow you to change the display without having to handle converting the display text back into the real value. But this won't work if the fields are editable by the user.
Hi Mike,
Thanks for Reply
These columns are editable by user. I am not aware of how to use CreationFilter or DrawFilter.
If you can explain with a small example then it would be much help full for me.
If the user can edit the cells, then a DrawFilter or CreationFilter won't work. Your only option would be to either use an unbound column (and hide the real column) or use a DataFilter.
The DataFilter is probably the best approach. For samples of using DataFilters, check out the Infragistics Knowledge Base. Do a search for the word "DataFilter".
What are you doing and why isn't it working?
Thanks for reply and sorry for late responce.
What ever you suggest that is not working in my case:
This is my sample data you tell me solution.
Column1(decilma) Column2(string) Column3(Date)
1.222 Hello 12/3/2008
null Hello null
3.25 IBM
IMB 13/3/2008
5.65 null
Syed Sadaqat Hussain said:Thanks for suggestion but I am not able to find DataFilter in knowledge Base. I tried to search.
I just did a search in the Infragistics Knowledge Base for the word DataFilter and found three articles:
http://devcenter.infragistics.com/Support/KnowledgeBaseResults.aspx?type=Full&query=DataFilter&articletypes=0&age=0&sort=LastModifiedDate&samplesonly=0
Syed Sadaqat Hussain said:One thing the information which I have provided you early in the form of table is it possible to read like that in the grid.Plaese explain me with short example. So that I have an idea how to go about it.
One thing the information which I have provided you early in the form of table is it possible to read like that in the grid.
Plaese explain me with short example. So that I have an idea how to go about it.
I do not understand what you are asking.
Thanks for suggestion but I am not able to find DataFilter in knowledge Base. I tried to search.