I have an ultraWebGrid that has a column of checkboxes. I have a function that will update every column in a row if the user selects the checkbox for that row and then presses a button. The grid also has the update functionality enabled so users can edit individual cells.
The problem I'm having is that the checkboxes are initiating a postback and I don't want them to do that. All the checkboxes need to do is provide a flag so that the functionality to update multiple rows knows which rows to update. I've implemented the following BLOCKED SCRIPT
function setCheckBoxCancelPostback(gridName, cellId, button) { var last_char = cellId.charAt(cellId.length - 1);
if(last_char < 4){var rowObj = igtbl_getRowById(cellId);
igtbl_cancelPostBack(rowObj.gridId)if (last_char == 1) {rowObj.getCellFromKey('CheckBox').setValue(true);}
return true;
But it only works on every other row. Seems to me there should be a way to disable a specific column from posting back but I can't find anything like that anywhere.
Thanks,
N
I have a similar UltraWebGrid that I used with a column of checkboxes that only updates if that column in the row is checked. I used the UpdateRowBatch event procedure. Here is the code I used within that procedure. I use and arraylist to capture that row and in another procedure my save event I step through the arraylist and obtain the values for the parameters I am using to update my database.
If
(e.Row.Cells(ColumnIndex("Accept")).Value) = 1 Then
Dim aa As ArrayList = Me.Session.Item("ApprovalArray")
If (IsNothing(aa)) Then aa = New ArrayList
aa.Add(e.Row)
Session.Item("ApprovalArray") = aa
End If
Dylan, thank you for your reply.
I'm actually handling the update if the checkbox is checked part, what I'm trying to do is keep the update from firing when the user selects the checkbox. The grid is set up so that if a user changes a value, it's updated. What I'm trying to do is somehow prevent the update from being fired if they select the checkbox.
I see what you mean how the grid is continuously doing postbacks for every time something changes on the grid. I found that rather annoying to be honest and if I remember correctly I was looking somewhere myself to prevent this. I think I just used a work around. Wish I could help more my work around was what I posted but it seems you are doing something different.
Okay, I think I found a way to do this with JavaScript but I need some help.
Added a client side event handler:
<
ClientSideEvents CellChangeHandler="uwgResourceProjectForecast_CellClickHandler" />
Which calls the following script:
function
uwgResourceProjectForecast_CellClickHandler(gridName, cellId, button)
{
var rowObj = igtbl_getRowById(cellId);
if (rowObj != null)
if (rowObj.getDataKey() == null)
igtbl_cancelPostBack(rowObj.gridId)
}
What I want to do is find out if the cell that called the script contains a checkbox and if so, cancel the postback. Shouldn't take much of a modification, hope someone can help me with this