I want to add clientName column value in a comma delimited string to a hiddenfield on my page.
How do I do that using javascript, as I do not want to use postback and looping through each row on the grid to get the checkbox status. When a checkbox is checked, it should append the hiddenfield value.
I am a newb on javascript. Please review my javascript code and suggest corrections. I am getting the hiddenfield value as blank, no matter what checkboxes are checked. I also know that my code is not targeting the correct row to get ClientName (row where checkbox is checked).
Any help is highly appreciated.
Thanks.
function RowClick(CheckBox)
{
var BaseControl = document.getElementById('<%= this.myGrid.ClientID %>');
var TargetControl = document.getElementById('MyHiddenField');
for (var i = 0; i < BaseControl.rows.count; i++)
{
var rowElem = BaseControl.rows[i];
for (var x = 0; x < rowElem.cells.count; x++)
{
var ClientName = rowElem.cells[1];
if (CheckBox.checked) TargetControl.Text += "," + Case_Id;
}
}
}

New Topic/Question
Reply



MultiQuote



|