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

control with id could not be located

2 Answers 478 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 2
George asked on 07 Dec 2017, 02:44 AM

I am getting a post error from a calendar object.

An error has occurred because a control with id 'ctl00$MainContent$tsupcontrol_4' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.

 

I adding a few lines of code that generates all this HTML.

<div class="form-group">
                    <label for="ctl00_MainContent_tsupcontrol_4" class="control-label col-md-3">Birth Date</label><div class="col-md-9">
                        <div id="ctl00_MainContent_tsupcontrol_4_wrapper" class="RadPicker RadPicker_MetroTouch" style="display:inline-block;width:300px;">
                            <input style="visibility:hidden;display:block;float:right;margin:0 0 -1px -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;" id="ctl00_MainContent_tsupcontrol_4" name="ctl00$MainContent$tsupcontrol_4" type="text" class="rdfd_ radPreventDecorate" value="1980-12-12" title="Visually hidden input created for functionality purposes." /><table cellspacing="0" class="rcTable rcSingle" summary="Table holding date picker control for selection of dates." style="width:100%;">
                                <caption style="display:none;">
                                    RadDatePicker
                                </caption><thead style="display:none;">
                                    <tr>
                                        <th scope="col">RadDatePicker</th>
                                    </tr>
                                </thead><tbody>
                                    <tr>
                                        <td class="rcInputCell" style="width:100%;"><span id="ctl00_MainContent_tsupcontrol_4_dateInput_wrapper" class="riSingle RadInput RadInput_MetroTouch" style="display:block;width:100%;"><input id="ctl00_MainContent_tsupcontrol_4_dateInput" name="ctl00$MainContent$tsupcontrol_4$dateInput" class="riTextBox riEnabled" value="Friday December 12, 1980" type="text" /><input id="ctl00_MainContent_tsupcontrol_4_dateInput_ClientState" name="ctl00_MainContent_tsupcontrol_4_dateInput_ClientState" type="hidden" /></span></td><td><a title="Open the calendar popup." href="#" id="ctl00_MainContent_tsupcontrol_4_popupButton" class="rcCalPopup">Open the calendar popup.</a><div id="ctl00_MainContent_tsupcontrol_4_calendar_wrapper" style="display:none;">
                                            <table id="ctl00_MainContent_tsupcontrol_4_calendar" cellspacing="0" class="RadCalendar RadCalendar_MetroTouch">
                                                <caption>
                                                    <span style='display:none;'>Calendar</span>
                                                </caption><thead>
                                                    <tr>
                                                        <td class="rcTitlebar"><table cellspacing="0">
                                                            <caption>
                                                                <span style='display:none;'>Title and navigation</span>
                                                            </caption><thead>
                                                                <tr style="display:none;">
                                                                    <th scope="col">Title and navigation</th>
                                                                </tr>
                                                            </thead><tbody>
    <tr>
        <td><a id="ctl00_MainContent_tsupcontrol_4_calendar_FNP" class="t-button rcFastPrev" title="<<" href="#"><<</a></td><td><a id="ctl00_MainContent_tsupcontrol_4_calendar_NP" class="t-button rcPrev" title="<" href="#"><</a></td><td id="ctl00_MainContent_tsupcontrol_4_calendar_Title" class="rcTitle">December, 2017</td><td><a id="ctl00_MainContent_tsupcontrol_4_calendar_NN" class="t-button rcNext" title=">" href="#">></a></td><td><a id="ctl00_MainContent_tsupcontrol_4_calendar_FNN" class="t-button rcFastNext" title=">>" href="#"><<</a></td>
    </tr>
</tbody>
                                                        </table></td>
                                                    </tr>
                                                </thead><tbody>
    <tr>
        <td class="rcMain"><table id="ctl00_MainContent_tsupcontrol_4_calendar_Top" class="rcMainTable" cellspacing="0">
    <caption>
        <span style='display:none;'>December, 2017</span>
    </caption><thead>
        <tr class="rcWeek">
            <th class="rcViewSel" scope="col"> </th><th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_cs_1" title="Sunday" scope="col">S</th><th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_cs_2" title="Monday" scope="col">M</th><th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_cs_3" title="Tuesday" scope="col">T</th><th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_cs_4" title="Wednesday" scope="col">W</th><th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_cs_5" title="Thursday" scope="col">T</th><th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_cs_6" title="Friday" scope="col">F</th><th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_cs_7" title="Saturday" scope="col">S</th>
        </tr>
    </thead><tbody>
        <tr class="rcRow">
            <th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_rs_1" scope="row">48</th><td class="rcOtherMonth" title="Sunday, November 26, 2017"><a href="#">26</a></td><td class="rcOtherMonth" title="Monday, November 27, 2017"><a href="#">27</a></td><td class="rcOtherMonth" title="Tuesday, November 28, 2017"><a href="#">28</a></td><td class="rcOtherMonth" title="Wednesday, November 29, 2017"><a href="#">29</a></td><td class="rcOtherMonth" title="Thursday, November 30, 2017"><a href="#">30</a></td><td title="Friday, December 01, 2017"><a href="#">1</a></td><td class="rcWeekend" title="Saturday, December 02, 2017"><a href="#">2</a></td>
        </tr><tr class="rcRow">
            <th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_rs_2" scope="row">49</th><td class="rcWeekend" title="Sunday, December 03, 2017"><a href="#">3</a></td><td title="Monday, December 04, 2017"><a href="#">4</a></td><td title="Tuesday, December 05, 2017"><a href="#">5</a></td><td title="Wednesday, December 06, 2017"><a href="#">6</a></td><td title="Thursday, December 07, 2017"><a href="#">7</a></td><td title="Friday, December 08, 2017"><a href="#">8</a></td><td class="rcWeekend" title="Saturday, December 09, 2017"><a href="#">9</a></td>
        </tr><tr class="rcRow">
            <th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_rs_3" scope="row">50</th><td class="rcWeekend" title="Sunday, December 10, 2017"><a href="#">10</a></td><td title="Monday, December 11, 2017"><a href="#">11</a></td><td title="Tuesday, December 12, 2017"><a href="#">12</a></td><td title="Wednesday, December 13, 2017"><a href="#">13</a></td><td title="Thursday, December 14, 2017"><a href="#">14</a></td><td title="Friday, December 15, 2017"><a href="#">15</a></td><td class="rcWeekend" title="Saturday, December 16, 2017"><a href="#">16</a></td>
        </tr><tr class="rcRow">
            <th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_rs_4" scope="row">51</th><td class="rcWeekend" title="Sunday, December 17, 2017"><a href="#">17</a></td><td title="Monday, December 18, 2017"><a href="#">18</a></td><td title="Tuesday, December 19, 2017"><a href="#">19</a></td><td title="Wednesday, December 20, 2017"><a href="#">20</a></td><td title="Thursday, December 21, 2017"><a href="#">21</a></td><td title="Friday, December 22, 2017"><a href="#">22</a></td><td class="rcWeekend" title="Saturday, December 23, 2017"><a href="#">23</a></td>
        </tr><tr class="rcRow">
            <th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_rs_5" scope="row">52</th><td class="rcWeekend" title="Sunday, December 24, 2017"><a href="#">24</a></td><td title="Monday, December 25, 2017"><a href="#">25</a></td><td title="Tuesday, December 26, 2017"><a href="#">26</a></td><td title="Wednesday, December 27, 2017"><a href="#">27</a></td><td title="Thursday, December 28, 2017"><a href="#">28</a></td><td title="Friday, December 29, 2017"><a href="#">29</a></td><td class="rcWeekend" title="Saturday, December 30, 2017"><a href="#">30</a></td>
        </tr><tr class="rcRow">
            <th id="ctl00_MainContent_tsupcontrol_4_calendar_Top_rs_6" scope="row">53</th><td class="rcWeekend" title="Sunday, December 31, 2017"><a href="#">31</a></td><td class="rcOtherMonth" title="Monday, January 01, 2018"><a href="#">1</a></td><td class="rcOtherMonth" title="Tuesday, January 02, 2018"><a href="#">2</a></td><td class="rcOtherMonth" title="Wednesday, January 03, 2018"><a href="#">3</a></td><td class="rcOtherMonth" title="Thursday, January 04, 2018"><a href="#">4</a></td><td class="rcOtherMonth" title="Friday, January 05, 2018"><a href="#">5</a></td><td class="rcOtherMonth" title="Saturday, January 06, 2018"><a href="#">6</a></td>
        </tr>
    </tbody>
</table></td>
    </tr>
</tbody>
                                            </table><input type="hidden" name="ctl00_MainContent_tsupcontrol_4_calendar_SD" id="ctl00_MainContent_tsupcontrol_4_calendar_SD" value="[]" /><input type="hidden" name="ctl00_MainContent_tsupcontrol_4_calendar_AD" id="ctl00_MainContent_tsupcontrol_4_calendar_AD" value="[[1800,1,1],[2023,1,1],[2017,12,6]]" />
                                        </div></td>
                                    </tr>
                                </tbody>
                            </table><input id="ctl00_MainContent_tsupcontrol_4_ClientState" name="ctl00_MainContent_tsupcontrol_4_ClientState" type="hidden" />
                        </div>
                    </div>
                </div><div class="form-group">
                    <span class="control-label col-md-3"><span></span></span><div class="col-md-9">
                        <span id="MainContent_tsupcontrol_5"><table class="SignupChecks">
                            <tr>
                                <td><span class="checkbox"><input id="MainContent_SignUpCheck_4_1" type="checkbox" name="ctl00$MainContent$SignUpCheck_4_1" /><label for="MainContent_SignUpCheck_4_1"><strong>Period One</strong></label></span></td>
                            </tr><tr>
                                <td><span class="checkbox"><input id="MainContent_SignUpCheck_4_2" type="checkbox" name="ctl00$MainContent$SignUpCheck_4_2" checked="checked" /><label for="MainContent_SignUpCheck_4_2"><span style="color: #ff0000;">Second Period</span></label></span></td>
                            </tr><tr>
                                <td><span class="checkbox"><input id="MainContent_SignUpCheck_4_6" type="checkbox" name="ctl00$MainContent$SignUpCheck_4_6" checked="checked" /><label for="MainContent_SignUpCheck_4_6"><span style="color: #7030a0;">Third Period</span></label></span></td>
                            </tr>
                        </table></span>
                    </div>
                </div><div class="form-group">
                    <span class="control-label col-md-3"><span></span></span><div class="col-md-3">
                    </div><div class="col-md-9">
                        <span id="MainContent_tsup_JoinButton"><table id="MainContent_CommandButtonTable" class="FormButtonTable">
                            <tr>
                                <td><span id="ctl00_MainContent_CommandButtonSubmit" class="RadButton RadButton_MetroTouch rbSkinnedButton"><input class="rbDecorated" type="submit" name="ctl00$MainContent$CommandButtonSubmit_input" id="ctl00_MainContent_CommandButtonSubmit_input" value="Update" /><input id="ctl00_MainContent_CommandButtonSubmit_ClientState" name="ctl00_MainContent_CommandButtonSubmit_ClientState" type="hidden" /></span></td><td><span id="ctl00_MainContent_CommandButtonClose" class="RadButton RadButton_MetroTouch rbSkinnedButton"><input class="rbDecorated" type="submit" name="ctl00$MainContent$CommandButtonClose_input" id="ctl00_MainContent_CommandButtonClose_input" value="Close" /><input id="ctl00_MainContent_CommandButtonClose_ClientState" name="ctl00_MainContent_CommandButtonClose_ClientState" type="hidden" /></span></td>
                            </tr>
                        </table></span>
                    </div>
                </div>
            </div></div>
                           
        </div>
    </div>

 

And it also produces this code in the HTML.

Sys.Application.add_init(function() {
    $create(Telerik.Web.UI.RadDateInput, {"_displayText":"Friday December 12, 1980","_focused":false,"_initialValueAsText":"1980-12-12-00-00-00","_postBackEventReferenceScript":"__doPostBack(\u0027ctl00$MainContent$tsupcontrol_4\u0027,\u0027\u0027)","_skin":"MetroTouch","_validationText":"1980-12-12-00-00-00","clientStateFieldID":"ctl00_MainContent_tsupcontrol_4_dateInput_ClientState","dateFormat":"yyyy-MM-dd","dateFormatInfo":{"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"AMDesignator":"AM","PMDesignator":"PM","DateSeparator":"-","TimeSeparator":":","FirstDayOfWeek":0,"DateSlots":{"Month":1,"Day":2,"Year":0},"ShortYearCenturyEnd":2029,"TimeInputOnly":false,"MonthYearOnly":false},"displayDateFormat":"dddd MMMM d, yyyy","enabled":true,"incrementSettings":{InterceptArrowKeys:true,InterceptMouseWheel:true,Step:1},"maxDate":"2023-01-01-00-00-00","minDate":"1800-01-01-00-00-00","styles":{HoveredStyle: ["width:100%;", "riTextBox riHover"],InvalidStyle: ["width:100%;", "riTextBox riError"],DisabledStyle: ["width:100%;", "riTextBox riDisabled"],FocusedStyle: ["width:100%;", "riTextBox riFocused"],EmptyMessageStyle: ["width:100%;", "riTextBox riEmpty"],ReadOnlyStyle: ["width:100%;", "riTextBox riRead"],EnabledStyle: ["width:100%;", "riTextBox riEnabled"]}}, null, null, $get("ctl00_MainContent_tsupcontrol_4_dateInput"));
});
Sys.Application.add_init(function() {
    $create(Telerik.Web.UI.RadCalendar, {"_DayRenderChangedDays":{},"_FormatInfoArray":[["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["January","February","March","April","May","June","July","August","September","October","November","December",""],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MMMM d, yyyy h:mm:ss tt","MMMM d, yyyy","h:mm:ss tt","d MMMM","ddd, dd MMM yyyy HH\u0027:\u0027mm\u0027:\u0027ss \u0027GMT\u0027","yyyy-MM-dd","h:mm tt","yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss","yyyy\u0027-\u0027MM\u0027-\u0027dd HH\u0027:\u0027mm\u0027:\u0027ss\u0027Z\u0027","MMMM, yyyy","AM","PM","-",":",0],"_ViewRepeatableDays":{},"_ViewsHash":{"ctl00_MainContent_tsupcontrol_4_calendar_Top" : [[2017,12,1], 1]},"_calendarWeekRule":0,"_culture":"en-CA","_enableKeyboardNavigation":false,"_enableViewSelector":false,"_firstDayOfWeek":7,"_postBackCall":"__doPostBack(\u0027ctl00$MainContent$tsupcontrol_4$calendar\u0027,\u0027@@\u0027)","_rangeSelectionMode":0,"clientStateFieldID":"ctl00_MainContent_tsupcontrol_4_calendar_ClientState","enableMultiSelect":false,"enabled":true,"monthYearNavigationSettings":["Today","OK","Cancel","Date is out of range.","False","True","300","1","300","1","False"],"skin":"MetroTouch","specialDaysArray":[],"stylesHash":{"DayStyle": ["", ""],"CalendarTableStyle": ["", "rcMainTable"],"OtherMonthDayStyle": ["", "rcOtherMonth"],"TitleStyle": ["", ""],"SelectedDayStyle": ["", "rcSelected"],"SelectorStyle": ["", ""],"DisabledDayStyle": ["", "rcDisabled"],"OutOfRangeDayStyle": ["", "rcOutOfRange"],"WeekendDayStyle": ["", "rcWeekend"],"DayOverStyle": ["", "rcHover"],"FastNavigationStyle": ["", "RadCalendarMonthView RadCalendarMonthView_MetroTouch"],"ViewSelectorStyle": ["", "rcViewSel"]},"titleFormat":"MMMM, yyyy","useColumnHeadersAsSelectors":false,"useRowHeadersAsSelectors":false}, null, null, $get("ctl00_MainContent_tsupcontrol_4_calendar"));
});

 

I have no idea why the error happens. All the HTML is generated by the RadCalendar Telerik control.

Any help is greatly appreciated, I have no idea how to proceed.

George

 

 

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 07 Dec 2017, 08:25 AM
Hello,

This is an ASP.NET generic error, which says about problems with the controls ID.

You haven't provided any code or example of how to replicate it and the only suggestion that I can provide is to assign a random ID: 

RadCalendar1.ID = Guid.NewGuid().ToString();

If this does not fix the problem, please provide a simple runnable project where we can replicate and debug the error.

Best regards,
Rumen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
George
Top achievements
Rank 2
answered on 08 Dec 2017, 09:23 PM

I goofed, the HTML error was misleading, I discovered a server-side error that better said the controls did not match.  I had error were occasionally the server built form was being changed on the post which caused the error.

Sorry for the trouble.

Tags
Calendar
Asked by
George
Top achievements
Rank 2
Answers by
Rumen
Telerik team
George
Top achievements
Rank 2
Share this question
or