D'Arcy from Winnipeg
Solution Architecture, Business & Entrepreneurship, Microsoft, and Adoption

Ultra Web Grid: Show Row_Edit_Template When Adding New Row

Tuesday, September 18, 2007 8:49 AM

So you have an Infragistics Ultra Web Grid on your web page, and you're utilizing the Row Edit Template for editing the row. What you may be experiencing is that you can add a row, but then need to double click the row to bring up the edit template. Wouldn't it be nice if you could just see the template when you add the row. Of COURSE it would be nice! Here's what you do:

function AddNewRow(gridId)
{
     var grid=igtbl_getGridById(gridId);

     igtbl_addNew(gridId,0);
     grid.beginEditTemplate();
}

- Creates a variable to hold a reference to the grid.
- Adds a new row based on the gridId, and also sets it to active by default
- Finally, we use that grid variable to call the beginEditTemplate function which will display the row edit template.

Now in my case, I'm using a user control to dynamically output the javascript, so my gridId is coming from that...but if that's not your scenario, or if you have a simpler one (like one grid only in your app or something), there's obviously other ways to get the gridId in there.

D

So you have a button that you're going to use for adding a row. Set its client-side click event to this little function here. Here's what it does:


Feedback

# re: Ultra Web Grid: Show Row_Edit_Template When Adding New Row

any idea how then to set the values of cells inside the added row ? 4/16/2008 3:07 AM | Ala

# re: Ultra Web Grid: Show Row_Edit_Template When Adding New Row

Thank you. Exactly what I was looking for. Infragistics documentation is pretty sorry (at least for a FNG like me).

I am calling your code on the OnClientClick of an asp:button control. I have set the UseSubmitBehavior to false and have added igtbl_cancelPostBack("WebGrid1") to your code but it still posts back (and WebGrid has two of each row). Any ideas? 4/25/2008 2:16 PM | Grant Baughman

Post a comment