Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
147 views
I've run into this issue before, but I can't remember how I resolved (or avoided) it.

I've nested a RadGrid inside the NestedViewTemplate of another RadGrid. I've attached a picture of the issue. In this case I expanded the first row (at which point things look normal) and then the second row. In Firebug I've selected the nested RadGrid of the first row which appears to be a solid line. It seems the MasterTableView has disappeared. The outer grid is ajaxified, but the behavior is identical when I set EnableAjax="false". I'll paste the code for the RadGrids. The outer grid is rgAgencies; the inner grid is rgSpecifications; rg refers to both grids (and so rgMaster refers to both grids' MasterTableView).

protected void rgMaster_Init(object sender, EventArgs e)
{
    GridTableView gtv = sender as GridTableView;
    gtv.CommandItemDisplay = UserInfo.IsInRole(PortalSettings.AdministratorRoleName) ? GridCommandItemDisplay.Top : GridCommandItemDisplay.None;
}
 
protected void rgAgencies_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    using (EXSCInternshipsDataContext dbContext = new EXSCInternshipsDataContext())
    {
        rgAgencies.DataSource = dbContext.Agencies.Where(a => !a.AgencyDeleted).ToList();
    }
}
 
protected void rgSpecifications_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    RadGrid rg = sender as RadGrid;
    GridDataItem item = ((GridNestedViewItem)rg.NamingContainer).ParentItem as GridDataItem;
    using (EXSCInternshipsDataContext dbContext = new EXSCInternshipsDataContext())
    {
        Agency agency = dbContext.Agencies.Single(a => a.AgencyID == Convert.ToInt32(item.GetDataKeyValue("AgencyID")));
        IEnumerable<InternshipSpecification> list = agency.InternshipSpecifications.ToList();
        if (list.Count() == 0) rg.Visible = UserInfo.IsInRole(PortalSettings.AdministratorRoleName);
        else rg.DataSource = agency.InternshipSpecifications.ToList();
    }
}
 
protected void rgAgencies_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = e.Item as GridDataItem;
        using (EXSCInternshipsDataContext dbContext = new EXSCInternshipsDataContext())
        {
            Agency agency = dbContext.Agencies.Single(a => a.AgencyID == Convert.ToInt32(item.GetDataKeyValue("AgencyID")));
            RadRating rr = item["Rating"].Controls.OfType<RadRating>().Single();
            IEnumerable<Score> ratings = agency.AForms.Select(a => a.Internship).
                                                        Where(i => i.InternshipGFormID.HasValue && i.GForm.OverallScore.ScoreValue != Score.NA).
                                                        Select(i => i.GForm.OverallScore).ToList();
            if (ratings.Count() == 0) rr.Enabled = false;
            else rr.Value = ratings.Select(s => s.ScoreValue - 1).Average(i => (decimal)i);
        }
    }
}
 
protected void rgAgencies_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "InitInsert")
    {
        e.Canceled = true;
        rwEditAgency.VisibleOnPageLoad = true;
        loadAgencyData(null);
    }
    else if (e.CommandName == "Edit")
    {
        e.Canceled = true;
        rwEditAgency.VisibleOnPageLoad = true;
        using (EXSCInternshipsDataContext dbContext = new EXSCInternshipsDataContext())
        {
            Agency agency = dbContext.Agencies.Single(a => a.AgencyID == Convert.ToInt32((e.Item as GridEditableItem).GetDataKeyValue("AgencyID")));
            loadAgencyData(agency);
        }
    }
    else if (e.CommandName == "Delete")
    {
        using (EXSCInternshipsDataContext dbContext = new EXSCInternshipsDataContext())
        {
            Agency agency = dbContext.Agencies.Single(a => a.AgencyID == Convert.ToInt32((e.Item as GridEditableItem).GetDataKeyValue("AgencyID")));
            agency.AgencyDeleted = true;
            dbContext.SubmitChanges();
        }
    }
}
 
protected void rgPreRender(object sender, EventArgs e)
{
    RadGrid rg = sender as RadGrid;
    rg.Columns.FindByUniqueName("Buttons").Visible = UserInfo.IsInRole(PortalSettings.AdministratorRoleName);
}
Matthew
Top achievements
Rank 1
 answered on 25 Jul 2013
2 answers
189 views
How do I format the legend of a doughnut and pie chart when one of the axis is a date field represented as a string? Sample data:

DataPoint Group By
100.00 1/1/2013
200.00 2/1/2013
350.00 3/1/2013

"Group By" is of type string in my class. Please see attached image for a visual explanation.
George
Top achievements
Rank 1
 answered on 25 Jul 2013
2 answers
154 views
I'm allowing the user to create charts and change the chart type (line, area, bar, pie, etc) on the fly. With the new Date axis I'm experiencing a problem with the line chart. It doesn't connect the lines when there is a gap in the data like the area chart does. When XAxis.Type is set to AxisType.Category it works fine. Is this by design, or a bug. Is there a workaround besides filling the data source with dummy data for the months that don't have any metrics. Screenshot of the problem is attached.
George
Top achievements
Rank 1
 answered on 25 Jul 2013
1 answer
440 views
I am using Q1 2013 (before the addition of the CategorySeriesItem class, etc.) and am wondering if there is a method equivelant to http://www.telerik.com/help/aspnet-ajax/htmlchart-application-using-multiple-custom-colors.html for my situation.
Danail Vasilev
Telerik team
 answered on 25 Jul 2013
1 answer
99 views
I have an LOB application that about 10-20 people use and contains say 30 total grids on a site that has 20 different pages.  GridSettingsPersister works great, but am I going to have to much session memory used by this?  I know it depends on the server and app pool and all, but in general do people do this? Or is this good practice.  
Some of my users don't like it when the switch back and forth between pages, they lose their sort settings.  I can save it to the  GridSettingsPersister on every OnSortCommand, but I'm afraid to do it to every grid because of memory.
I use a shared server on and it has a decent amount of server memory for a shared server.  I'm guessing it's not a big deal to store 30 settings for 10 sessions.
Pavlina
Telerik team
 answered on 25 Jul 2013
11 answers
364 views
It seems that persisting the states on other media and not in the default hiddenfield breaks RadGrid funcionalities (for example paging with "next page" stops at page "2").
The code for changing persistance medium of the viewstate/controlstatef is straightforward and it's derived from Microsoft suggestions on this procedeure.        
We also debugged it and both the viewstate and controlstate are correctly saved and restored from both DB or disk.
A simple test on the viewstate was 

If Not Page.IsPostBack Then
            ViewState("testme") = "test view state"
        Else
            TestLabel.Text = "--" & ViewState("testme")
        End If

And about controlstate we readi it on the debugger and this is a screenshot (both in the first page load and after postback same identical controlstate)

http://www.hakkar.it/controlstate-nopostback.jpg

Implementation is in a base page class derived from all pages:
Private pPageStatePersister As PageStatePersister
 
' DB/Disk persisted viewstate
Protected Overrides ReadOnly Property PageStatePersister As PageStatePersister
    Get
        If pPageStatePersister Is Nothing Then
            If Not String.IsNullOrEmpty(GlobalAppSettings.ViewStatePersister) Then
                pPageStatePersister = New ViewStatePersister(Me)
            Else
                pPageStatePersister = New HiddenFieldPageStatePersister(Me)
            End If
        End If
 
        Return pPageStatePersister
    End Get
End Property

Any hint on why this implementation could break grid functionality while removing it everything works as expected?
Does RadGrid check the "__Viewstate" hidden field directly instead of accessing controlstate/viewstate?


Massimiliano
Top achievements
Rank 1
 answered on 25 Jul 2013
22 answers
561 views
Hi..
Can you please tell me what I'm doing wrong - I can't get the header to line up with the column data.. thanks again!

<telerik:RadGrid ID="RadGridPendingCorrespondence" runat="server"

AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"

Font-Size="Larger" ShowStatusBar="True" Skin="Outlook" GridLines="None"

onitemcommand="RadGridPendingCorrespondence_ItemCommand" Width="970px">

<AlternatingItemStyle BackColor="#80FFFF" />

<

MasterTableView TableLayout="Fixed">

<

RowIndicatorColumn>

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn>

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<Columns>

<telerik:GridBoundColumn DataField="CORRESPONDENCEID" Display="False"

HeaderText="Corr ID" UniqueName="column">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="FIRSTNAME" HeaderText="Name"

UniqueName="NAME">

<HeaderStyle Width="100px" />

<ItemStyle />

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="LASTNAME" UniqueName="column6">

<ItemStyle Width="100px"/>

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="ConstituentTypeID"

HeaderText="Constituent Type" UniqueName="column2">

<ItemStyle />

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Subject" HeaderText="Subject"

UniqueName="Subject">

<HeaderStyle Width="125px" />

<ItemStyle Width="125px" />

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Description"

HeaderText="Correspondence Type" UniqueName="column4">

<HeaderStyle Width="100px" />

<ItemStyle />

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Due Date" HeaderText="Due Date"

UniqueName="column5">

<HeaderStyle Width="75px" />

<ItemStyle />

</telerik:GridBoundColumn>

<telerik:GridButtonColumn FooterText="" DataTextFormatString="Reply E-mail"

UniqueName="EMAIL" HeaderText="Action to Take " CommandName="EMAIL"

DataTextField="ID">

<ItemStyle Width="75px" />

</telerik:GridButtonColumn>

<telerik:GridButtonColumn FooterText="" DataTextFormatString="Reply Letter"

UniqueName="LETTER" HeaderText="" CommandName="LETTER"

DataTextField="ID">

<ItemStyle Width="75px" />

</telerik:GridButtonColumn>

</Columns>

David M
Top achievements
Rank 1
 answered on 25 Jul 2013
2 answers
70 views
After upgrading to 2013 SP1 I noticed the menu hover styles don't display correct for Sunset skin and Hay skin. I also tested this for demo's on the Telerik site. See attached picture.
I know you want to get rid of these skins but they are the most used skins among the users of my web applications. So I really hope you can solve this. And also have really good alternatives once you no longer support these skins.
Boyan Dimitrov
Telerik team
 answered on 25 Jul 2013
3 answers
132 views
Works fine when scrolling is not enabled, but throwing the below exception when enabled.
 
 telchart.ClientSettings.ScrollMode = ChartClientScrollMode.XOnly
 telchart.ClientSettings.EnableZoom = True


Have seen this error reported before in the forum, but there is no proper answer on why ? except attaching sample projects that work. Tried adding a series at the end with Line Type but no luck.

 telchart.DataBind()
 telchart.Series.Add(New ChartSeries("Lines", ChartSeriesType.Line))


Exception Detail - 

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.ScriptObjectBuilder.RegisterCssReferences(Control control) +254
   Telerik.Web.UI.RadChart.OnPreRender(EventArgs e) +64
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


Version Information: Microsoft .NET Framework Version:2.0.50727.3643; ASP.NET Version:2.0.50727.3634 

Petar Kirov
Telerik team
 answered on 25 Jul 2013
3 answers
453 views
Hi, I have used an example from the demos to created a 'Scores' type ticker...

My markup is...

<telerik:RadRotator ID="RadRotator1" runat="server" DataSource="LinqDataSource1"
    FrameDuration="2000" Height="20px" ItemHeight="20" Width="570px" ItemWidth="570"
    ScrollDuration="2000" ScrollDirection="Up">
    <ItemTemplate>
        <div class="results">
            <table class="rTable">
                <tr>
                    <td class="leftCell">
                        <asp:Literal ID="lit_Title" runat="server" Text='<%= Bind("Title")%>'></asp:Literal>
                    </td>
                    <td class="figure">
                        <asp:Literal ID="lit_Total" runat="server" Text='<%= Bind("Total") %>'></asp:Literal>
                    </td>
                    <td class="figure">
                        <asp:Literal ID="lit_TypeA" runat="server" Text='<%= Bind("TypeA") %>'></asp:Literal>
                    </td>
                    <td class="figure">
                        <asp:Literal ID="lit_TypeB" runat="server" Text='<%= Bind("TypeB") %>'></asp:Literal>
                    </td>
                    <td class="figure">
                        <asp:Literal ID="lit_TypeC" runat="server" Text='<%= Bind("TypeC")%>'></asp:Literal>
                    </td>
                    <td class="figure">
                        <asp:Literal ID="lit_TypeD" runat="server" Text='<%= Bind("TypeD") %>'></asp:Literal>
                    </td>
                    <td class="figure">
                        <asp:Literal ID="lit_TypeE" runat="server" Text='<%= Bind("TypeE") %>'></asp:Literal>
                    </td>
                </tr>
            </table>
        </div>
    </ItemTemplate>
</telerik:RadRotator>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" OnSelecting="LinqDataSource1_Selecting">
</asp:LinqDataSource>

And my codebehind has...

Protected Sub LinqDataSource1_Selecting(sender As Object, e As LinqDataSourceSelectEventArgs) Handles LinqDataSource1.Selecting
  
    Dim db As New TestDataContext
  
    Dim tickerquery As New StringBuilder
  
    tickerquery.Append("DECLARE @ALL_Total int ")
    tickerquery.Append("DECLARE @ABC_Total int ")
    tickerquery.Append("DECLARE @XYZ_Total int ")
    tickerquery.Append("DECLARE @ALL_TypeA int ")
    tickerquery.Append("DECLARE @ABC_TypeA int ")
    tickerquery.Append("DECLARE @XYZ_TypeA int ")
    tickerquery.Append("DECLARE @ALL_TypeB int ")
    tickerquery.Append("DECLARE @ABC_TypeB int ")
    tickerquery.Append("DECLARE @XYZ_TypeB int ")
    tickerquery.Append("DECLARE @ALL_TypeC int ")
    tickerquery.Append("DECLARE @ABC_TypeC int ")
    tickerquery.Append("DECLARE @XYZ_TypeC int ")
    tickerquery.Append("DECLARE @ALL_TypeD int ")
    tickerquery.Append("DECLARE @ABC_TypeD int ")
    tickerquery.Append("DECLARE @XYZ_TypeD int ")
    tickerquery.Append("DECLARE @ALL_TypeE int ")
    tickerquery.Append("DECLARE @ABC_TypeE int ")
    tickerquery.Append("DECLARE @XYZ_TypeE int ")
  
    tickerquery.Append("DECLARE @ALL_Title nvarchar(3) ")
    tickerquery.Append("DECLARE @ABC_Title nvarchar(3) ")
    tickerquery.Append("DECLARE @XYZ_Title nvarchar(3) ")
    tickerquery.Append("SET @ALL_Title = 'ALL' ")
    tickerquery.Append("SET @ABC_Title = 'ABC' ")
    tickerquery.Append("SET @XYZ_Title = 'XYZ' ")
    tickerquery.Append("DECLARE @Count_Tbl table (Title nvarchar(3), Total int, TypeA int, TypeB int, TypeC int, TypeD int, TypeE int) ")
  
    tickerquery.Append("SELECT @ALL_Total = (SELECT Count(ProdID) FROM Products) ")
    tickerquery.Append("SELECT @ABC_Total = (SELECT Count(ProdID) FROM Products WHERE Category = 'ABC') ")
    tickerquery.Append("SELECT @XYZ_Total = (SELECT Count(ProdID) FROM Products WHERE Category = 'XYZ') ")
    tickerquery.Append("SELECT @ALL_TypeA = (SELECT Count(ProdID) FROM Products WHERE Productstatus = 'TypeA') ")
    tickerquery.Append("SELECT @ABC_TypeA = (SELECT Count(ProdID) FROM Products WHERE Category = 'ABC' AND Productstatus = 'TypeA') ")
    tickerquery.Append("SELECT @XYZ_TypeA = (SELECT Count(ProdID) FROM Products WHERE Category = 'XYZ' AND Productstatus = 'TypeA') ")
    tickerquery.Append("SELECT @ALL_TypeB = (SELECT Count(ProdID) FROM Products WHERE Productstatus = 'TypeB') ")
    tickerquery.Append("SELECT @ABC_TypeB = (SELECT Count(ProdID) FROM Products WHERE Category = 'ABC' AND Productstatus = 'TypeB') ")
    tickerquery.Append("SELECT @XYZ_TypeB = (SELECT Count(ProdID) FROM Products WHERE Category = 'XYZ' AND Productstatus = 'TypeB') ")
    tickerquery.Append("SELECT @ALL_TypeC = (SELECT Count(ProdID) FROM Products WHERE Productstatus = 'TypeC') ")
    tickerquery.Append("SELECT @ABC_TypeC = (SELECT Count(ProdID) FROM Products WHERE Category = 'ABC' AND Productstatus = 'TypeC') ")
    tickerquery.Append("SELECT @XYZ_TypeC = (SELECT Count(ProdID) FROM Products WHERE Category = 'XYZ' AND Productstatus = 'TypeC') ")
    tickerquery.Append("SELECT @ALL_TypeD = (SELECT Count(ProdID) FROM Products WHERE Productstatus = 'TypeD') ")
    tickerquery.Append("SELECT @ABC_TypeD = (SELECT Count(ProdID) FROM Products WHERE Category = 'ABC' AND Productstatus = 'TypeD') ")
    tickerquery.Append("SELECT @XYZ_TypeD = (SELECT Count(ProdID) FROM Products WHERE Category = 'XYZ' AND Productstatus = 'TypeD') ")
    tickerquery.Append("SELECT @ALL_TypeE = (SELECT Count(ProdID) FROM Products WHERE Productstatus <> 'TypeD') ")
    tickerquery.Append("SELECT @ABC_TypeE = (SELECT Count(ProdID) FROM Products WHERE Category = 'ABC' AND Productstatus = 'TypeE') ")
    tickerquery.Append("SELECT @XYZ_TypeE = (SELECT Count(ProdID) FROM Products WHERE Category = 'XYZ' AND Productstatus = 'TypeE') ")
  
    tickerquery.Append("INSERT INTO @Count_Tbl (Title, Total, TypeA, TypeB, TypeC, TypeD, TypeE SELECT @ALL_Title, @ALL_Total, @ALL_TypeA, @ALL_TypeB, @ALL_TypeC, @ALL_TypeD, @ALL_TypeE ")
  
    tickerquery.Append("INSERT INTO @Count_Tbl (Title, Total, TypeA, TypeB, TypeC, TypeD, TypeE SELECT @ABC_Title, @ABC_Total, @ABC_TypeA, @ABC_TypeB, @ABC_TypeC, @ABC_TypeD, @ABC_TypeE ")
  
    tickerquery.Append("INSERT INTO @Count_Tbl (Title, Total, TypeA, TypeB, TypeC, TypeD, TypeE SELECT @XYZ_Title, @XYZ_Total, @XYZ_TypeA, @XYZ_TypeB, @XYZ_TypeC, @XYZ_TypeD, @XYZ_TypeE ")
  
    tickerquery.Append("SELECT Title, Total, TypeA, TypeB, TypeC, TypeD, TypeE FROM @Count_Tbl")
  
    Dim results As IEnumerable(Of ProductCount) = _
        db.ExecuteQuery(Of ProductCount) _
        (tickerquery.ToString)
  
    e.Result = results
End Sub

Why do I get the error message -

The 'DataSource' property cannot be set declaratively ..... any help appreciated.

Mych
Top achievements
Rank 1
 answered on 25 Jul 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?