不能将具有相同ID"calender1"的两个组件添加到应用程序中 [英] Two components with the same id 'calender1' can't be added to the application

查看:69
本文介绍了不能将具有相同ID"calender1"的两个组件添加到应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net项目中,在我的页面中,我具有gridview,其中有一个文本框和日历控件,如下所示:

In my asp.net project, In my page I have gridview in that I have a text box and calender control like the following

<asp:TemplateField HeaderText="Year">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtCourseYear" runat="server" Width="80px" MaxLength="10" Text='<%# Eval("YearPassed") %>'></asp:TextBox>
                                            <asp:Image ID="Image3" runat="server" ImageUrl="~/images/Calender.JPG" Style="width: 16px" />
                                            <asp:CalendarExtender ID="CalendarExtender_txtYear" runat="server" Enabled="True"

                                                TargetControlID="txtCourseYear" Format="yyyy" OnClientShown="onCalendarShown"

                                                BehaviorID="calendar1" OnClientHidden="onCalendarHidden" PopupButtonID="Image3">
                                            </asp:CalendarExtender>
                                        </ItemTemplate>
                                    </asp:TemplateField>




执行项目时出现以下错误..

Calendar Extender生成消息"Sys.InvalidOperationException:不能将具有相同ID"calender1"的两个组件添加到应用程序中.

我认为BehaviorID将动态更改,我该怎么做.>
我试图将BehaviouId calender1更改为calender2,但是发生了相同的错误..


我如何解决此问题.....




while executing the project I am getting the following error..

Calendar Extender generates message "Sys.InvalidOperationException: Two components with the same id ''calender1'' can''t be added to the application

I think the BehaviorID will change dynamically How i can do this.>
I tried to Change BehaviouId calender1 to calender2 but same error occured..


How I can solve this Issue.....

推荐答案

您的页面有两个具有相同ID的CalendarExtender控件.

根据您的示例代码,其他控件的BehaviorID可能也相同.对其进行更改(例如calendar2),它应该可以正常工作.
You page has two CalendarExtender control used with the same id.

As per your sample code, probably the BehaviorID of other control is same as well. Change it (to say calendar2) and it should work.


这篇关于不能将具有相同ID"calender1"的两个组件添加到应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆