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

[Solved] Grid Edit button returns error.

2 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Harsh Mehta
Top achievements
Rank 1
Harsh Mehta asked on 01 Dec 2009, 09:42 PM
Hi, I am using Telerik RadGrid control on my page and when I click on edit link to generate form edit content, it gives me following error.

Microsoft JScript runtime error: Sys.InvalidOperationException: Two components with the same id 'ctl00_ContentPlaceHolder1_UserMain1_PhysicianProfessionalPageControl_grdEducation' can't be added to the application.

<telerik:RadGrid ID="grdworkhistory" AllowMultiRowSelection="True" AllowMultiRowEdit="True" 
                Skin="WebBlue" runat="server" AllowAutomaticInserts="True" EnableViewState = "false" 
                Width="97%" PageSize="10" AllowAutomaticUpdates="True"   
                AllowPaging="True" AutoGenerateColumns="False" OnItemCreated="grdworkhistory_ItemCreated" 
                ShowStatusBar="True"   
                GridLines="Both" ShowFooter="True">  
            <ClientSettings> 
                <Selecting AllowRowSelect="true" /> 
            </ClientSettings> 
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="EmploymentEpisodeId" ClientDataKeyNames="EmploymentEpisodeId" 
                EditMode="EditForms"  AutoGenerateColumns="False" Width="100%">  
                  
                <Columns> 
                    <telerik:GridEditCommandColumn> </telerik:GridEditCommandColumn> 
                    <telerik:GridBoundColumn DataField="JobEmployer.Name" EditFormColumnIndex="0" HeaderText="Name" SortExpression="Name" 
                        UniqueName="WHname" Visible="true">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="JobTitle" EditFormColumnIndex="1" HeaderText="Title" SortExpression="Title" 
                        UniqueName="WHtitle" Visible="true">  
                    </telerik:GridBoundColumn> 
                      <telerik:GridBoundColumn DataField="JobEmployer.EmployerAddress.Address1" EditFormColumnIndex="0" HeaderText="Address" SortExpression="created_date" 
                        UniqueName="WHaddress" Visible="false">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridDropDownColumn DataField="JobEmployer.EmployerAddress.AddressCountry.CountryId" EditFormColumnIndex="1" HeaderText="Country" 
                        SortExpression="WHcountry" UniqueName="Country" Visible="false" ListTextField="name" ListValueField="countryId">  
                    </telerik:GridDropDownColumn> 
                    <telerik:GridBoundColumn DataField="JobEmployer.EmployerAddress.City" EditFormColumnIndex="0" HeaderText="City"   
                        SortExpression="WHcity" UniqueName="city" visible="false">  
                    </telerik:GridBoundColumn> 
                      
                    <telerik:GridDropDownColumn DataField="JobEmployer.EmployerAddress.AddressState.StateId" EditFormColumnIndex="0" HeaderText="State" 
                        SortExpression="WHstate" UniqueName="state" Visible="false" ListTextField="name" ListValueField="stateId">  
                    </telerik:GridDropDownColumn> 
                      
                    <telerik:GridBoundColumn DataField="JobEmployer.EmployerAddress.PostalCode" EditFormColumnIndex="1" HeaderText="Postal"   
                        SortExpression="WHpostal" UniqueName="postal">  
                    </telerik:GridBoundColumn> 
                      
                    <telerik:GridDateTimeColumn EditFormColumnIndex="0" DataField="BeginDate" HeaderText="From" 
                        SortExpression="WHfrom" UniqueName="beginDate" Visible="true" > 
                    </telerik:GridDateTimeColumn> 
                      
                    <telerik:GridDateTimeColumn EditFormColumnIndex="1" DataField="EndDate" HeaderText="To" 
                        SortExpression="WHto" UniqueName="endDate" Visible="true">  
                    </telerik:GridDateTimeColumn> 
                      
                    <telerik:GridBoundColumn ItemStyle-Wrap="true" EditFormColumnIndex="0" DataField="Description" 
                        SortExpression="WHDescription" UniqueName="description" Visible="false">  
                    </telerik:GridBoundColumn>   
                      
                    <telerik:GridBoundColumn ItemStyle-Wrap="true" EditFormColumnIndex="0" DataField="EmploymentEpisodeId" 
                        SortExpression="WHID" UniqueName="EmploymentEpisodeId" Visible="false">  
                     </telerik:GridBoundColumn> 
                      
            </Columns> 
              <EditFormSettings ColumnNumber="2" CaptionDataField="Work History" CaptionFormatString="Edit properties for work history">  
                    <FormTableItemStyle Wrap="true"></FormTableItemStyle> 
                    <FormCaptionStyle > </FormCaptionStyle> 
                    <FormMainTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="3" BackColor="White" 
                        Width="100%" /> 
                    <FormTableStyle CellSpacing="0" CellPadding="2"  Height="110px" 
                        BackColor="White" /> 
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> 
                    <EditColumn ButtonType="LinkButton"   
                        InsertText="Insert " UpdateText="Update record" UniqueName="EditCommandworkhistory" CancelText="Cancel edit">  
                    </EditColumn> 
                    <FormTableButtonRowStyle HorizontalAlign="Left" ></FormTableButtonRowStyle>  
                </EditFormSettings> 
             </MasterTableView>     
        </telerik:RadGrid> 

2 Answers, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 03 Dec 2009, 09:02 AM
Hi Harsh,

Have you tried whether setting EnableViewState = "true" of the grid still causes the problem?




I hope this helps,
Johny
0
Mugdha Aditya
Top achievements
Rank 1
answered on 19 Mar 2010, 07:22 AM
Got the answer :)

Set ScriptMode="Release" property of the ScriptManager / RadScriptManager.
Tags
Grid
Asked by
Harsh Mehta
Top achievements
Rank 1
Answers by
Johny
Top achievements
Rank 1
Mugdha Aditya
Top achievements
Rank 1
Share this question
or