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
60
Add a new row with external textbox values in ultrawebgrid
posted

Hi,

I have a requirement, where if user clicks on the add row button (inside the ultrawebgrid), a new empty row is created , then they enter values in some textboxes, after that when they click on another row, the values from textboxes are entered into the new empty row that was created.

I am already using the activerowchange event on serverside for doing some other actions that should happen when user clicks on different rows.

My issue is: When I click on Add button in the grid, it displays an empty row, and then automatically does a postback and goes to the activerowchange event and when it comes back, the empty row added is gone. So basically user cannot enter in textboxes.

To prevent it from posting back, I handled the BeforeRowInsertHandler,BeforeRowActivateHandler and AfterRowInsertHandler events on client side. With some hidden values settings, I am able to achieve that, if its a active row change becoz of row insert, then it will not postback, otherwise if its a normal active row change, then its posts back.

Now comes the next part: Adding the values of textboxes into the empty row.

I tried using igtbl_addNew in the BeforeRowActivateHandler and assigned the textbox values. This works and adds in a new row with the textbox values, but the catch is that the previous empty row remains there.

Is there any way to add values into the same empty row that was created by Add row, instead of a new row by igtbl_addNew ?

I tried to set the newrow as the ActiveRow (var myrow = igtbl_getActiveRow("<%=G1.ClientID%>");) but for a new row, the index is 0, so it is actually replacing the values in the original first row in my grid.

//var myrow = igtbl_getActiveRow("<%=G1..ClientID%>");

var myrow = igtbl_addNew("<%=G1..ClientID%>", 0,true,true)

myrow.getCellFromKey("Name").setValue("test");

Parents
No Data
Reply Children
No Data