I had created dynamic created Webdatagrid and inside that I had created unbounded checkbox.
502When I click on checkbox, it gives error 'Async request fails. [FormatException]: String was not recognized as a valid Boolean.
Hello,
Thank you for contacting Infragistics!
I have some follow up questions concerning this matter: How are you setting up the WebDataGrid?What version are you using?Is the column in question bound or unbound?
Thanks for replying. Below are the required answers to your queries:
a) How are you setting up the WebDataGrid?
WebDataGrid is set dynamically using DataTable as datasource. Initially, WebDataGrid's Columns are created dynamically and then DataTable is assigned as DataSource.
b) What version are you using?
Assembly: Infragistics4.Web.v16.1; Version: 16.1.20161.2044
c) Is the column in question bound or unbound?
Only first 2 columns are bounded(which contains ParticipantId & Participant Name), rest contains Unbounded checkboxes.
The UnboundCheckbox columns of the WebDataGrid do not support this behavior of trying to split two different values into the value and text. You would have to do the other which you describe of having a separate hidden unbound column. As for saving the value any column that is Unbound you are responsible for saving the data. You can use the RowUpdating event to save any data. It will fire for each row that is updated, and it has properties off the event args called UnboundValues and Values which will contain the unbound and bound values respectively:
http://help.infragistics.com/doc/ASPNET/2016.1/CLR4.0/?page=Infragistics4.Web.v16.1~Infragistics.Web.UI.GridControls.WebDataGrid~RowUpdating_EV.html
Please let me know if you have any further questions concerning this matter.
Thanks for the sample. I had figured out the issue in my case. What I was trying to do was to store Text & Value for UnboundedCheckBox field(eg. Text-12;Value-true). So, in DataTable, I had defined column as string with both Text & Value data separated by piping symbol(eg 12 | true). And in grid's InitializeRow event, I was trying to separate both like below and assign Unbounded checkbox with Text & Value. Now, I had specified Datatable's column as boolean & used hidden field for UnboundedCheckbox field's Text.
Please do note that in my case everything is created dynamicaly, so there can be 3, 4 or any no. of checkboxes in a row.
Now, my query is,
(a) Can't we specify UnboundedCheckBox with different Text & Value?
(b) How to Save the checkboxes when user clicks on Save button after ticking or unticking checkbox?
Below is the Initialize event where I was trying to separate Text and value separated by piping:
protected void ugPS_InitializeRow()
{
if(tbresults.Rows.Count>0 && e.Row.Items.Count>0)
DataRow[] res=tbResults.Select("ParticipantId=" + e.Row.Items[0].Value);
if(res!=null)
for(int colind=2;colind<ugPS.Columns.Count-1;colind++)
var col=res[0][colind];
if(col.ToString().Contains("|"))
String colVal= col.ToString().Substring(0,col.ToString().IndexOf('|'));
String colTxt = col.ToString().Substring(col.ToString().IndexOf('|') + 1,col.ToString().Length -col.ToString().IndexOf('|') -1);
e.Row.Items[colInd].Value = Convert.ToBoolean(colVal);
e.Row.Items[colInd].Text = colTxt;
}
else
e.Row.Items[colInd].Value = Convert.ToBoolean(col);
e.Row.Items[colInd].Text = null;
Thank you for the update. I created a sample to test this and I have been unable to reproduce the behavior you described. Please test my sample let me know what you see. If you are unable to reproduce the behavior in my sample please modify it so it does reproduce or attach your own sample that reproduces the behavior you are having.