Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Add new row using roweditingtemplage
posted

I have this JavaScript code to add a new row using the rowEditingTemplate:

function addRow() {
var grid = $find("<%=grdMain.ClientID%>");
var row = grid.get_behaviors().get_editingCore().get_behaviors().get_rowAdding().get_row();
var ret = grid.get_behaviors().get_editingCore().get_behaviors().get_rowEditingTemplate();           
ret.enterEditMode(row);
}

When I use this for the button the edit window stays open <input type="button" name="AddRow" value="Add Row  " onclick="addRow()" />

When I use this for the button the edit window opens and closes immediately <asp:LinkButton ID="lnkAdd" runat="server" OnClientClick="addRow()">Add</asp:LinkButton>

I would prefer to use the link button because that is what our users are used too.

Is there a way to get the link button working?

Thanks, Pat