Hi,
I am having below JavaScript Method, please help me to write it in code behind of VB.Net or C#.
function DeleteRow () {
var grid = $find("<%= dgrdMeasure.ClientID%>");
var gridRows = grid.get_rows();
var selectedRows = grid.get_behaviors().get_selection().get_selectedRows();
var selectedCells = grid.get_behaviors().get_selection().get_selectedCells();
var rows = new Array();
var i1 = 0;
for (var i = selectedRows.get_length() - 1; i >= 0; i--) {
var row = selectedRows.getItem(i);
gridRows.remove(row);
}
}
I think I am doing something wrong in below VB.net, please help me to correct it. Thanks.
Private Sub WriteDelete()
Dim sb As New StringBuilder()
sb.Append("function Delete" + dgrdMeasure.ClientID + "() {alert('You pressed Me!" + dgrdMeasure.ClientID + "');")
sb.Append("var grid = $find('<%= dgrdMeasure.ClientID%>');")
sb.Append("var gridRows = grid.get_rows();")
sb.Append("var selectedRows = grid.get_behaviors().get_selection().get_selectedRows();")
sb.Append("var selectedCells = grid.get_behaviors().get_selection().get_selectedCells();")
sb.Append("var rows = new Array();")
sb.Append("var i1 = 0;")
sb.Append("for (var i = selectedRows.get_length() - 1; i >= 0; i--) {var row = selectedRows.getItem(i); gridRows.remove(row);}")
sb.Append("}")
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "myScriptName" + dgrdMeasure.ClientID, sb.ToString(), True)
End Sub