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

If I add every Bound Column's Unique Name To DataKeysName, Will it ever caused any exception?

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LamKhoa
Top achievements
Rank 1
LamKhoa asked on 28 Aug 2012, 08:54 PM
Hi,

For convenient, I always add every Bound Column's UniqueName to List of DataKeysNames. I wonder if,  under this scenario, will it ever cause any exception in anyway?
For example, my grid bind to a DataTable with Columns: FirstName, LastName, Age. Then I'll set the DataKeyNames property as FirstName, LastName, Age.

The reason I ask this is because somehow I got some strange exception and I'm not sure if it is related to the fact that I add every Bound Columns to DataKeyNames.

I heard that it may cause exception in the table has two or more identical rows, but I've tested and it didn't cause exception at all.

Thanks

Lamk.

1 Answer, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 29 Aug 2012, 07:50 AM
Hello,

It will never throw any exception.

  <MasterTableView DataKeyNames="FirstName,LastName,Age">
                <Columns>
                <telerik:GridBoundColumn HeaderText="FirstName" DataField="FirstName" UniqueName="FirstName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="LastName" DataField="LastName" UniqueName="LastName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Age" DataField="Age" UniqueName="Age">
                    </telerik:GridBoundColumn>
.............
.............

I have used same logic in so many times but still i am not able get/generate any exception.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
LamKhoa
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or