I have a simple two columns grid above.. I would like to change it to one column grid where the text from the left column goes to the just text next to the check box which is the bound check box field.. How to access Cell text for every row during initialization.. please provide sample. Thnx.
Hi Michael,
I am glad that you find my suggestion helpful.
Thank you for using Infragistics components.
Hi Martin, thanks for your help.. CSS approach worked for me.. although I end up adding CSS into cell on the row intit event..
Hello Michael,
I have modified the sample to work with batch updating. First an event handler is attached on the checkbox input during initialization of the rows:
protected void grid_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e) { CheckBox checkBox = e.Row.Items[2].FindControl("CheckBox") as CheckBox; checkBox.Checked = bool.Parse(e.Row.Items[1].Value.ToString()); checkBox.InputAttributes.Add("onchange", "setValue(this)"); }
Then on the client side when a checkbox is clicked the data field has to be manually set and committed:
function setValue(event) { var grid = $find("grid"); var index = grid.get_behaviors().get_selection().get_selectedCells().getItem(0).get_row().get_index(); grid.get_rows().get_row(index).get_cellByColumnKey("Checked").set_value(event.checked.toString()) grid.get_behaviors().get_editingCore().commit(); }
Another way to meet your requirement is to keep the two columns but remove the border in the header of the bounded check box column using CSS:
.... <ig:BoundCheckBoxField DataFieldName="Checked" Key="Checked" Width="10px" Header-CssClass="hide-border" /> .... .... .hide-border { border-right: none !important; } ....
1651.Sample.zip
Hello Martin.. workaround works very well.. thank you.. I also need another piece of functionality that I am trying to set up.. I am setting batch processing to True, and would like to catch updates in the EditingCore.RowUpdating on the server... it works for bound check boxes, but somehow does not work for this template field, although I try ti set column setting but probably something is missing.. Can you adjust project so when I change checked state it will be caught on the server RowUpdating event along with the changed value. Thnx.
At this point, we do not provide a bound check box field with a bound text field in the same column out of the box.
However, I managed to create and attach a workaround using TemplateDataField column. Please test it on your side and let me know whether it helps you achieve your requirement.
If the workaround does not meet your requirements, in order to see this functionality implemented is logging a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at https://es.infragistics.com/community/ideas.
Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. You can also link back to this thread for additional details.
8865.Sample.zip