Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
110 views
Hi, how can I bind a RadGrid when I need to include details from more than one entity?

I have the following code that runs, definitely brings back data but does not show anything in my grid (with AutoGenerateColumns set to "true"):

protected void MyGrid_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    using (var context = new MyContainer())
    {
        var d = from data in context.ParentEntity.Include("ChildEntities"
                select new
                {
                    data.ParentProperty, 
                    data.ChildEntity.FirstOrDefault().ChildProperty
                };
  
        this.MyGrid.DataSource = d.ToList();
    }
}

I don't mind admitting my LINQ to Entities knowledge is "ongoing" but you can see what I am trying to do: for every ParentEntity, get me their properties and for every ChildEntity under that, get me their properties as well. I want the grid to display those.

Because the ChildEntity may not necessarilly immediately have a ParentEntity, I can't do a master / detail view with two grids.

Richard
Pavlina
Telerik team
 answered on 04 Mar 2011
2 answers
253 views
Hi is it possible using RadComboBox?

When the user clicks on the RadComboBox
it has to show  5 Labels and one Text box below the 5 labels and button below the textbox?


Regards
Bhuvan
Bhuvan
Top achievements
Rank 1
 answered on 04 Mar 2011
1 answer
335 views

Hi

we have page on which i have radio button list with Autopost = true when page load for the first time it works fine
but when i move from Page 1 to Page 2 And come back to page 1 with some query string when click on radio button list it does not post back

Plz See Code below

 <div id="divshippmethod" class="PageSection full ShippingInformation" runat="server">
        <h1>
            Shipping Method</h1>
        <div class="content">
            <asp:RadioButtonList CellSpacing="0" CellPadding="0" ID="rbtnShippingMethod" RepeatDirection="Horizontal"
                AutoPostBack="true" runat="server">
                <asp:ListItem Text="&nbsp;&nbsp;Shipping Information" Value="0" Selected="True"></asp:ListItem>
                <asp:ListItem Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail List Upload"
                    Value="1"></asp:ListItem>
            </asp:RadioButtonList>
        </div>

Rajax setting are below
 <telerik:AjaxSetting AjaxControlID="rbtnShippingMethod">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rbtnShippingMethod" LoadingPanelID="RadAjaxLoadingPanel" />
                        <telerik:AjaxUpdatedControl ControlID="pnlShipping" />
                        <telerik:AjaxUpdatedControl ControlID="pnlMailListUpload" />
                    </UpdatedControls>
                </telerik:AjaxSetting>

Protected Sub rbtnShippingMethod_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbtnShippingMethod.SelectedIndexChanged
        If rbtnShippingMethod.SelectedValue = 1 Then
            pnlShipping.Visible = False
            pnlMailListUpload.Visible = True
        Else
            pnlShipping.Visible = True
            pnlMailListUpload.Visible = False
        End If
    End Sub
first time when pnlMailListUpload. is true, it has a button which Response.Redirects to another page on which i do some activity and come back to this page again.

now if i select any item from the radiobuttonlist then rbtnShippingMethod_SelectedIndexChanged is not firing , on doing inspectElement from FF we found that the required postback JS (__dopostbakc) is not attached with the onclick event of the radio button.

plz help.

Kiara
Top achievements
Rank 1
 answered on 04 Mar 2011
1 answer
102 views
Hi

Please see the images of the database table and the mockup of graph I want. Is this possible? If so any idea how to do this?

Thanks
Ves
Telerik team
 answered on 04 Mar 2011
1 answer
477 views

I am using GridImageColumn for displaying an icon if the value in a table column (HasRead) which is bound to the RadGrid Control is false.

Here is the aspx code..

<Telerik:RadGrid ID="TelerikThread" Width="97%" AllowSorting="True" PageSize="15" 
    OnItemDataBound="TelerikThread_ItemDataBound" AllowPaging="True" 
    AllowMultiRowSelection="True" runat="server" Gridlines="None"
<MasterTableView Width="100%" Summary="RadGrid table"   AutoGenerateColumns="false"
<PagerStyle Mode="NextPrevAndNumeric" /> 
<Columns
<Telerik:GridImageColumn UniqueName="GridImageColumn" SortExpression="HasRead" 
    HeaderText="Unread" DataImageUrlFields="HasRead"
</Telerik:GridImageColumn>

Below is the code behind

      protected void TelerikThread_ItemDataBound(object sender, GridItemEventArgs e)
      {
          if (e.Item is GridDataItem)
          {
              GridDataItem item = (GridDataItem)e.Item;
              TableCell flag = (TableCell)item["HasRead"];
              if (flag.Text == "false")
              {
                  System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)item["GridImageColumn"].Controls[0];
                  img.ImageUrl = "./web/Themes/default/images/post_status_new_ln.gif";//set image url
              }
              else
              {
                  TableCell cell = (TableCell)item["GridImageColumn"];
                  cell.Text = " ";//clears image column
              }
          }
}

I'm getting exception in the line GridDataItem item = (GridDataItem)e.Item;
"Cannot cast e.item to GridDataItem"

Please help me resolving this..

Thanks in advance.
Princy
Top achievements
Rank 2
 answered on 04 Mar 2011
1 answer
152 views
Hello Team,

I have stored file/folder structure on Network Server(on another server than where application Deployed). If i used local machine's folder for storing file/folder structure, its working fine. If i used network PC for storing files it gives File Permission Error while deleting and rename.
Can you please suggest what to do?

Thanks,
Josh

Dobromir
Telerik team
 answered on 04 Mar 2011
1 answer
61 views

Hi,

I have a Self Referencing Hierarchy grid in which i have made rows editable on double click client event. Required grid properties for disabling multiple rows edit at the same time have been set as follows-

 

 

 

AllowMultiRowSelection="false" AllowMultiRowEdit="false"

 

 

 

 

Still I am able to select and Edit multiple rows at a time.
Client Settings are as follows-

<ClientSettings  AllowExpandCollapse="true">
                <ClientEvents OnRowDblClick="RowdblClick"/>
                <Selecting AllowRowSelect="True"/>
                </ClientSettings>



Javascript used-

<script language="javascript" type="text/javascript">
        function RowdblClick(sender, eventArgs)
        {
          RowEdit(sender, eventArgs);
        }
        function RowEdit(sender, eventArgs)
        {
            //debugger;
            var editedRow = eventArgs.get_item();
            editedRow.id= eventArgs.get_id();
            $find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow);
        }   
      
        </script>
Vasil
Telerik team
 answered on 04 Mar 2011
1 answer
272 views
How to find the detail table in ItemCommand Event in radgrid?
Princy
Top achievements
Rank 2
 answered on 04 Mar 2011
5 answers
107 views
Hi,
we are using RadControls for ASP.NET AJAX Q3 2010 in SharePoint 2010 custom user controls.
In general, if I have a scheduler in a user control and after adding the scripts programmatically as posted here (asp-updatepanel-and-radscheduler-issues) it works fine with update panel and the default ajax script manager of sharepoint.
The problem starts when using a RadTabStrip that loads to the RadMultiPage user controls programmatically. When the user selects the tab that loads a user control that contains a scheduler control then a javascript error occurs ('b.TouchScrollExtender' is null or not an object).
If I don't include the RadTabStrip into an update panel then I can select another tab and navigate away from the tab with the scheduler control, but if I use update panel or even RadAjaxManager and AddAjaxSetting programmataically then I cannot navigate away and do any other action.

Thank you in advance,
Ilias
Kalina
Telerik team
 answered on 04 Mar 2011
3 answers
159 views
I have a horizontal Gantt chart with a single series date data loaded for the two YAxis'. I'd like to be able to turn on the XAxis MajorGridLines so that a line appears from left side of the chart to right in order to make the XAxis item labels line up with the bars.

Is this possible?

My chart is below:
<telerik:RadChart ID="radchartPCSUserItems" Width="910" EnableViewState="False" runat="server" Skin="Web20" 
        SeriesOrientation="Horizontal" Legend-Visible="false" AutoLayout="false">
    <Series>
        <telerik:ChartSeries Type="Gantt" Name="Series 1">
        </telerik:ChartSeries>                
    </Series>
    <PlotArea Appearance-Dimensions-Width="700">
        <YAxis IsZeroBased="False" AutoScale="False">
            <Appearance MinorGridLines-Visible="false">                        
                <LabelAppearance RotationAngle="60" Position-AlignedPosition="top"></LabelAppearance>
            </Appearance>
        </YAxis>
        <YAxis2 IsZeroBased="False" AutoScale="False" >
              
        </YAxis2>
              
        <XAxis AutoScale="False" Step="10">
            <AxisLabel TextBlock-Text="Item"></AxisLabel>
            <Appearance MajorGridLines-Visible="true">
                <LabelAppearance Position-AlignedPosition="left"></LabelAppearance>
            </Appearance>
        </XAxis>
        <Appearance Dimensions-Margins="2px, 3px, 5px, 25%" Dimensions-Paddings="0%, 0%, 5px, 0%" ></Appearance>
    </PlotArea>
    <Legend Visible="False"></Legend>
    <Appearance Border-Visible="False"></Appearance>
    <ChartTitle Visible="False"></ChartTitle>
</telerik:RadChart>

My chart

private void BindGanttChart(PCSUserItemCollection pcsUserItemCol)
 
    DateTime dtMaxDate = pcsUserItemCol[0].DueDate;
    DateTime dtMinDate = pcsUserItemCol[0].StartDate;
  
    foreach(PCSUserItem useritem in pcsUserItemCol)
      
        if (useritem.DueDate > dtMaxDate) // get the max date
        {    
            dtMaxDate = useritem.DueDate;
        }
  
        if (dtMinDate > useritem.StartDate) // get the min date
        {
            dtMinDate = useritem.StartDate;
        }
  
        // Create the Chart Data Points
        Telerik.Charting.ChartSeriesItem chartItem = new Telerik.Charting.ChartSeriesItem();
  
        chartItem.YValue = useritem.StartDate.ToOADate();
        chartItem.YValue2 = useritem.DueDate.ToOADate();
  
        chartItem.Label.TextBlock.Text = useritem.DueDate.ToShortDateString();
        chartItem.Label.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font("Arial", 7, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);        
  
        chartItem.Name = useritem.ID.ToString();
  
        radchartPCSUserItems.Series[0].Items.Add(chartItem);
  
        // Set the X-Axis label's text
        Telerik.Charting.ChartAxisItem chartAxisItem = new Telerik.Charting.ChartAxisItem();
        chartAxisItem.TextBlock.Text = useritem.Title;
          
        radchartPCSUserItems.PlotArea.XAxis.Items.Add(chartAxisItem);
    }
  
    // Define the Chart MinVal, MaxVal & Step (Scale)
    if (dtMaxDate != DateTime.MinValue)
    {
        radchartPCSUserItems.PlotArea.YAxis.Step = 30;
        radchartPCSUserItems.PlotArea.YAxis.MinValue = dtMinDate.AddMonths(-1).ToOADate();
        radchartPCSUserItems.PlotArea.YAxis.MaxValue = dtMaxDate.AddDays(30).ToOADate();
  
        radchartPCSUserItems.PlotArea.YAxis2.Step = 30;
        radchartPCSUserItems.PlotArea.YAxis2.MinValue = dtMinDate.AddMonths(-1).ToOADate();
        radchartPCSUserItems.PlotArea.YAxis2.MaxValue = dtMaxDate.AddDays(30).ToOADate();
    }
  
    radchartPCSUserItems.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
    radchartPCSUserItems.DataBind();       
}
Ves
Telerik team
 answered on 04 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?