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
516
Webgrid: Add a new row to Webgrid with default Data
posted

Hi,

I've recently made a Webgrid that allows users to Add new records to the grid,
but they've also asked that, when they push the button to add a new line to the Grid,
this new line already have certain standard data filled in.

I've been looking to intercept the addnewrow event to add the data programmatically
so it already shows when the new line is added to the grid, but no succes.

Can someone help me with this? When the new row is added to the grid, it has to be filled
with the standard settings.

Thanks for any help you can give me

  • 342
    Offline posted

    Did you ever figure out how to do this?  I need to do the same thing in my app.

     

    Thanks

    klpo.

  • 45049
    Verified Answer
    posted

    The column object has a DefaultValue property.  With this property set, any new rows you add to the grid on the client will have these values set in the cell that corresponds to this column.

    If you still want to do this programmatically, such as if your "default value" may vary from row to row, I suggest using the InitializeRow client-side event.