It appear values set in the InitializeRow event during postback are not reflected on the client.
We have grid bound to an object datasource and some of the boolean columns are show with images. We have implemented this by setting the CssClass in the initialize row event. like this:
{
it.CssClass = u.IsOnline ?
"tdImgOK" : "" ;
it.Text =
"";
it = e.Row.Items[4];
// IsApproved
it.CssClass = u.IsApproved ?
"tdImgOK" : "tdImgStop";
... etc.
We use a webdialog to edit a row, when the user click OK, the row is updated via
grid.get_behaviors().get_editingCore().commit();
The update works fine but our images are no longer displayed but instead the value of the cell, e.g. true/false.
If traced it down and although the InitializeRow event is fired, the updates are never reflected on the client. I can change any columns value but nothing happens. I have tried with and without viewstate/dataviewstate enabled but this makes no difference.
How can I solve this problem ?
Lex
Hello Lyuba,
I have to be a bit more precise, what happens is that that the image is not updated (its not reflecting the CssClass set in the row update). Instead the text true/false is shown. With the following client code I can have the correct image shown but then it still shows the true/false text over it.
).get_element();
elm.className=(newRow[4] ?
);
elm.innerText =
Infact nothing that I set in the initialize row is reflected back on the client.
You can repruduce it very easy. Just add a Initilizerow event to the WebDataGrid/Templates/Custom row edit template.
protected void WebDataGrid1_InitializeRow(object sender, RowEventArgs e) { GridRecordItem it = e.Row.Items[1]; // companyname it.Text += "x"; }
Now running this sample produces a extra 'x' at the end of the company name field. Now edit a row, you will see the x is not appende to the company name.
Hello Lex,
Does the image disappear only for the row that you are updating or for all the rows? Can you send me a sample that illustrates your issue?
Regards,
Lyuba
Developer Support Engineer
Infragistics
www.infragistics.com/support