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

[Solved] Date column in RadGrid within Web User Control not working

4 Answers 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gavin Russell
Top achievements
Rank 1
Gavin Russell asked on 09 Nov 2009, 03:29 PM
Hello,

I have placed a RadGrid within a "Web user control" (ascx) page.

But when placing an item into edit mode the page generates an error captured by IE (but not the server).

The error comes back as 

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30729; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729)
Timestamp: Mon, 9 Nov 2009 15:27:17 UTC

Message: Expected ':'
Line: 108699950
Char: 683
Code: 0
URI: http://localhost:60795/Extranet2009/DefaultVB.aspx

 

But I'm uncertain how to begin troubleshooting this - after all, line 108699950 doesn't exist. When I place the control on its own page then the calendar works fine. While on the "user control" page - clicking on the calendar icon has no affect.

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="infraVB.ascx.vb" Inherits="TabStrip_Examples_ApplicationScenarios_LoadOnDemand_CustomersVB" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<telerik:RadGrid runat="server" ID="RadGrid1" Skin="Office2007"   
    DataSourceID="ObjectDataSource1" AllowPaging="True" GridLines="None"   
    AllowSorting="True" AutoGenerateColumns="False" AutoGenerateEditColumn="True">  
<MasterTableView DataSourceID="ObjectDataSource1"   
        DataKeyNames="ID">  
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32"   
            HeaderText="ID" ReadOnly="True" SortExpression="ID"   
            UniqueName="ID">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="CompanyID" HeaderText="CompanyID"   
            SortExpression="CompanyID" UniqueName="CompanyID" DataType="System.Int32">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="InfrastructureTypeID" HeaderText="InfrastructureTypeID"   
            SortExpression="InfrastructureTypeID" UniqueName="InfrastructureTypeID"   
            DataType="System.Int32">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Details" HeaderText="Details"   
            SortExpression="Details" UniqueName="Details">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Expire" HeaderText="Expire"   
            SortExpression="Expire" UniqueName="Expire" DataType="System.DateTime">  
        </telerik:GridBoundColumn> 
        <telerik:GridDateTimeColumn DataField="Expire" HeaderText="Expire"   
            SortExpression="Expire" UniqueName="column">  
        </telerik:GridDateTimeColumn> 
    </Columns> 
</MasterTableView> 
</telerik:RadGrid> 
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"   
    OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"   
    TypeName="DataSet2TableAdapters.InfrastructureTableAdapter">  
    <SelectParameters> 
        <asp:SessionParameter Name="ID" SessionField="CompanyID" Type="Int32" /> 
    </SelectParameters> 
</asp:ObjectDataSource> 
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"   
    OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"   
    TypeName="DataSet2TableAdapters.InfrastructureTypeTableAdapter">  
</asp:ObjectDataSource> 

4 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 12 Nov 2009, 12:48 PM
Hello Gavin,

I think that the discussion from this public forum thread will help you address the error you receive.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gavin Russell
Top achievements
Rank 1
answered on 12 Nov 2009, 05:08 PM
Hi,

I've read the forum and it does look like something similar is occuring but I can't see how its solution can be applied?

The article suggests an invalid character is added into a reference by a control and the solution is to remove it using:-

dock.ID = Guid.NewGuid().ToString().Replace('-', 'a');

I tried replacing the lines that look similar, creating something like this

            Dim userControlName As String = e.PageView.ID  
            Dim userControl As Control = Page.LoadControl(userControlName)  
            userControl.ID = e.PageView.ID.ToString().Replace("-", "a") & "_userControl"  
            e.PageView.Controls.Add(userControl) 

I would benefit from some additional guidance?

Thanks,

Gavin.
0
Gavin Russell
Top achievements
Rank 1
answered on 12 Nov 2009, 06:15 PM
Hi,

I found the line it occurs within.

    $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",],"dd MMMM yyyy HH:mm:ss","dd MMMM yyyy","HH:mm:ss","dd MMMM","ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","dd/MM/yyyy","HH:mm","yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","MMMM yyyy","AM","PM","/",":",1],"_ViewRepeatableDays":{},"_ViewsHash":{infraVB.ascx_userControl_RadGrid2_gdtcSharedCalendar_Top : [[2009,11,1], 1]},"_calendarWeekRule":0,"_culture":"en-GB","_enableViewSelector":false,"_firstDayOfWeek":7,"_postBackCall":"__doPostBack(\u0027infraVB.ascx_userControl$RadGrid2$gdtcSharedCalendar\u0027,\u0027@@\u0027)","clientStateFieldID":"infraVB.ascx_userControl_RadGrid2_gdtcSharedCalendar_ClientState","enabled":true,"monthYearNavigationSettings":["Today","OK","Cancel","Date is out of range.","False","True","300","300"],"skin":"Office2007","specialDaysArray":[],"stylesHash":{DayStyle: ["", ""],CalendarTableStyle: ["", "rcMainTable"],OtherMonthDayStyle: ["", "rcOtherMonth"],TitleStyle: ["", ""],SelectedDayStyle: ["", "rcSelected"],SelectorStyle: ["", ""],DisabledDayStyle: ["", "rcDisabled"],OutOfRangeDayStyle: ["", "rcOutOfRange"],WeekendDayStyle: ["", "rcWeekend"],DayOverStyle: ["", "rcHover"],FastNavigationStyle: ["", "RadCalendarMonthView RadCalendarMonthView_Office2007"],ViewSelectorStyle: ["", "rcViewSel"]}}, null, null, $get("infraVB.ascx_userControl_RadGrid2_gdtcSharedCalendar"));

The above line seems to generate this error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30729; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729)
Timestamp: Thu, 12 Nov 2009 18:15:02 UTC

Message: Expected ':'
Line: 232
Char: 683
Code: 0
URI: http://localhost:57364/Extranet2009/DefaultVB.aspx

 

0
Gavin Russell
Top achievements
Rank 1
answered on 12 Nov 2009, 06:43 PM
At last! Three days later I've got to the bottom of it.

Basically, the PageViewID of the RadTabStrip does not handle (.)

It accepts a . within the gui (which it may be useful to prevent).

So - for anyone else using dynamic on-load, and placing the file to load within the PageViewID of the RadTabStrip - do not place the full path.

Then within the RadMultiPage1_PageViewCreated sub, add the additional extension as below.

 

Dim userControlName As String = e.PageView.ID + ".ascx"

Well - at least I've learn't a fair bit about debugging now :)

 

Tags
Grid
Asked by
Gavin Russell
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Gavin Russell
Top achievements
Rank 1
Share this question
or