This is a migrated thread and some comments may be shown as answers.

How to check for new added row and values?

5 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Diego
Top achievements
Rank 1
Diego asked on 30 Nov 2015, 11:11 AM

Hi!

 

Which action can I check after the users clicked on: " * Click here to add new row " and filled the collums, please?

 

The first collum is readonly because its a ID, but the others must be filled to execute the action.

 

I can't find the solution.

 

Thank you!

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Nov 2015, 11:28 AM
Hello Diego,

Thank you for writing.

It is suitable to use the UserAddingRow event which allows you to validate the entered data and cancel the new row if data is not valid. Please refer to the following help article which is quite useful on this topic: http://www.telerik.com/help/winforms/gridview-rows-new-row.html

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Diego
Top achievements
Rank 1
answered on 30 Nov 2015, 11:59 AM

Hello Dess.

 Thank you for your help.

 I tryied the code on the example, but it doesn't worked:

 private void lvClientes_UserAddingRow(object sender, GridViewRowCancelEventArgs e)
        {
            if (e.Rows[0].Cells["Nome"].Value != null && e.Rows[0].Cells["Idade"].Value != null &&
                e.Rows[0].Cells["Email"].Value != null)
            {
                MessageBox.Show("ok!");
            }
            else
            {
                e.Cancel = true;
            }
        }

 

For unknow reason the paramer GridViewRowCancelEventArgs isn't working, its red.

 

What i did worng, please?

 

Thank you!

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Nov 2015, 12:29 PM
Hello Diego,

Thank you for writing back.

Could you please specify which is the exact version of the Telerik UI for WinForms suite that you are currently using?

I am looking forward to your reply.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Diego
Top achievements
Rank 1
answered on 30 Nov 2015, 12:55 PM

Hi Dess,

 

Thank you!

 

I'm using VS 2013 and Telerik version: 2010.1.10.308

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Nov 2015, 04:08 PM
Hello Diego,

Thank you for writing.

The UserAddingRow event is not available for the version that you are using. I would recommend you to upgrade to at least Q2 2010 (version 2010.2.10.713) in order to benefit from the introduced functionality.

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Diego
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Diego
Top achievements
Rank 1
Share this question
or