Hello,
I have a grid with a nested view template. I removed the expand/collapse column to create a customized one.
In the ItemDataBound method I do the following:
TableCell tcExpand = item["Expand"];Image img = new Image();img.ImageUrl = "/images/expand_collapse_plus.gif";img.AlternateText = "+";img.Attributes.Add("OnClick","ExpandThisMasterTableViewItem(this);");tcExpand.Controls.Clear();tcExpand.Controls.Add(img);On the front end I have:
function ExpandThisMasterTableViewItem(sender) { var rowIndex = $(sender).closest("tr").attr("id"); rowIndex = rowIndex.substr(rowIndex.lastIndexOf('_') + 1); var firstMasterTableViewRow = $find("<%= myGrid.MasterTableView.ClientID %>").get_dataItems()[rowIndex]; if (firstMasterTableViewRow.get_expanded()) { $(sender).closest("tr").find("td").css("background-color", "none"); $(sender).closest("img[src*='expand']").src = "/images/expand_collapse_plus.gif"; firstMasterTableViewRow.set_expanded(true); } else { $(sender).closest("tr").find("td").css("background-color", "#DBFEDB"); $(sender).closest("img[src*='expand']").attr('src', '/images/expand_collapse_minus.gif'); firstMasterTableViewRow.set_expanded(true); }}
The line firstMasterTableViewRow.set_expanded always seems to call an image for my custom expand button and I end up with an error :
GET http://localserver/mypage/undefined 404 (Not Found)
If I comment the line, I do not have that 404 not found error. But i need to expand / collapse my rows.
Any idea why this error is thrown with that line?
Thank you