In Webdatagrid, how can one find hidden field in cellValueChange event for current row?
Hello Birendra,
Thank you for contacting Infragistics Developer Support!
If by hidden field you mean a cell in a hidden column of the grid accessing it client side is pretty straightforward.
function handler(sender, args) {
var row = args.get_cell().get_row();
// Get cell by index
var targetCell = row.get_cell(index);
// or get by column key
var targetCell = row.get_cellByColumnKey(key);
....
}
Feel free to contact me for further information.
Thanks for replying. By Hidden field, I mean to say that in template I had defined asp:hiddenfield like below. And I want to search it in current row.
<ig:WebDataGrid ID="dataGridBrands" runat="server" Height="350px" Width="100%" AutoGenerateColumns="False">
........................
<ig:TemplateDataField Key="ChangeTo" Hidden="true">
<ItemTemplate>
<asp:HiddenField ID="hfChangeTo" runat="server" />
</ItemTemplate>
</ig:TemplateDataField>
......
</ig:WebDataGrid>
Hello Birenda,
The provided snippet by Radoslav can be used to access the hidden field, by getting the input from the cell element.
This can be done by extending the code:
function handler(sender, eventArgs) { var row = eventArgs.get_cell().get_row(); var targetCell = row.get_cellByColumnKey("ChangeTo"); var cellElement = targetCell.get_element(); // It's assumed that there is only one element in the item template by the given markup var hiddenField = cellElement.children[0];}
// It's assumed that there is only one element in the item template by the given markup var hiddenField = cellElement.children[0];}
Let me know if you need further assistance.
How can I specify hidden value equal to same row's cell value?
Got the solution. Done it like below:
function cellValueChanged(sender, eventArgs)
{
var currentrow = eventArgs.get_cell().get_row();
if(eventArgs.get_cell(1).get_column().get_key()=="Date")
var hfDateCell=currentrow.get_cellByColumnKey("Dat"); //hidden Field
hfDateCell.get_element().firstChild.value =eventArgs.get_cell(1).get_value(); //Set Hidden Field value equal to cell value