After I installed the 8.1 for asp.net(infragistics) ,I found ultrawebgrid's client-side function "getActiveRow()" doesn't work,and I use the function correctly in 7.2.Can u help me?Please!
Hello,
How are you calling this fucntion? And when is it being called?
Duc Nguyen: ths for ur attention:)
I use ultrawebgrid in a Contentpage (with masterpage) and use javascript to Delete record from database(MS sqlserver). In the grid ,I add a column which doesn't bind with data ,and i define the Its type --Button. The clientScript-"clickcellbuttonHandler":
function DeleteRecord() { if (confirm("Delete current row?")==true) { var oGrid = igtbl_getGridById("UltraWebGrid1"); if (oGrid.getActiveRow()!=null) { var oRow = oGrid.getActiveRow(); oRow.deleteRow(); document.getElementById("aspnetForm").submit(); } } }
The message tell me :object not defined. and now the function was changed to :
function UltraWebGrid1_ClickCellButtonHandler(gridName, cellId){ var oCell = igtbl_getCellById(cellId); var oRow = oCell.getRow(); if (oCell.Column.Key=="Edit") { document.location = "Mgr_InformationEdit.aspx?id="+oRow.getCellFromKey("ID").getValue(); } else if (confirm("Delete current row?")==true) { oRow.deleteRow(); document.getElementById("aspnetForm").submit(); }}.
for the test ,I add an html button in a blankpage just with ultrawebgrid,and onclick:
function button1-click(){
var oGrid = igtbl_getGridById("UltraWebGrid1"); if (oGrid.getActiveRow()!=null)
alert("good");
}
The same message appear again.
can u help me?
ths a lot!
Since your grid is within a content pane, its html id changes. Therefore, you cannot get reference to the grid with the original id assigned. To get around this, handle the InitiailizeLayout client-side event of WebGrid. In this event handler, set a global variable to hold the gridName parameter passed in. In place of your hard-coded grid id, use the global variable.
Duc Nguyen: Thanks a lot:)
You means in the .cs file I difine a public string grdID="mygrid1" then in the aspx file set "id=<%grdID%>"? I will try it immediatly.
Define in your javascript section, wherever you define the delete method.
var gridId;
In the handler,
gridId = gridName;
gridName is a parameter passed into the handler for InitializeLayout. Remember this is the client-side event.
Use gridId wherever you need the id for WebGrid.
Thank u very much! I follow ur instructions,and it worked...........thanks again:)