Hi,
our requirement was to get all the accounts and details for a client. We get this data using Stored procedure and fill custom oject and bind grid to custom object. After binding we hide the rows based on certain logic in Javascript. If the user wants to see the rest of the data, we provided them with checkbox. If checkbox is checked, then we show all rows. On server side, when we are looping thru rows, we check whether row is hidden or not and then do rest of the logic like this:
foreach (Ultragridrow row in UltraWebGrid1.Rows){
if (!row.Hidden)
this worked fine with ultrawebgrid. With WebDatagrid GridRecord, there is no 'hidden' property to check. So, how can I hide the rows and check whether each row is hidden or not.
Thanks,
Spunny
I'm meaning in my grid which has 4 columns, the first with a ddl provider, 2 & 3 with read only data and the 4th column with a button. When they click on the button, I want to hide the entire row, but this solution only seems to hide the button (template row).
Cliff
This solution only hides the button in the rightmost column, not the entire row, which is what I'm looking for (in javascript).
Hide is working fine but if i want to show the rows again on a button click how will i do. Tried by adding "showrow" css class but its not working.
Hi aschoi,
The objects are not the same on the client and the server. On the client you should do the following
$util.addCompoundClass(currentRow.get_element(), "hiderow");
instead of
currentRow.CssClass = "hiderow";
Your line of code just makes a property on the javascript object, but does not actually change the DOM element's className property.
regards,David Young
I saw your answer. I tried and it works. Then I tried to move the same logic to Javascript to do client side row hiding because I do not want to have postback to the server. However, it does not work. My code snippet is below. Could you be so kind to let me know why the following does not work? Thanks.
var templateGrid = $find(m_templateGridId);
var rowsLength = templateGrid.get_rows().get_length();
for (var i = 0; i < rowsLength; i++) { var currentRow = templateGrid.get_rows().get_row(i); currentRow.CssClass = "hiderow"; } The style looks like this. .hideRow { visibility: hidden; display: none; }
for (var i = 0; i < rowsLength; i++) { var currentRow = templateGrid.get_rows().get_row(i); currentRow.CssClass = "hiderow";
}
The style looks like this.
.hideRow { visibility: hidden; display: none; }