ASPxGridView Screencast: Initializing New Rows

ASP.NET Team Blog
10 January 2008

Many of you have asked how to initialize rows with custom data in the ASPxGridView. So I've created a short screencast which shows how easy it's to implement. In the screencast I demonstrate how to set the default data values for two columns when the user clicks Edit. These defaults allows you a level of control by suggesting the (required) data and still allows the user the freedom to change the values.

image

Check it out and let me know what you think.

Thanks.

4 comment(s)
RAUL TORTIMA
RAUL TORTIMA

Hi Mehul,

I am very interested to watch this video, but I am having some kind of problem...after the first 15 seconds it starts echoing a strange noise, and sometimes it gets almost impossible to understand what the voice says...

Could you take a look to see if you have the same issue there?

21 January, 2008
Mike Engel
Mike Engel

Mehul:

The more I dive into the components, the more I love them. You and the team are doing a great job. I've found the screen casts and tutorials to be especially helpful.

After watching the "Initializing New Rows" screencast, I'm having difficulty setting default values for fields in an ASPXGridView that is inside an ASPxCallbackPanel. The edit form mode is PopupEditForm and uses an EditForm template.  I'm unable to set the field values by setting either of following:

e.NewValues("field_name") = value

OR

e.NewValues("control_name") = value

I know that the event handler is firing when debugging it. Any thoughts or examples?

Thanks,

Mike

24 January, 2008
denis pyr
denis pyr

I am using an ObjectDataSource and I wonder why I should declare in yet another place my set of default values. I did it when I declared my class, I did it at the database level - now I have to do it at the grid level. More than this, I have to do it every time I build a grid using that object.

An obvious way is to initialize the new row based on an object created using the default constructor, isn't it?

22 September, 2008
Mehul Harry (DevExpress)
Mehul Harry (DevExpress)

Hi Denis,

Not everyone uses the ObjectDataSource Smile. And since you're deciding to initialize the grid rows with 'custom data' then you'll have to call it from the InitNewRow function. However, if you'd like, you can create suggestion in the support center to offer a different approach then please feel free.

22 September, 2008

Please login or register to post comments.