Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
83 views
Hi 
  I want my dropdowntree depth level are configurable means if fixed DropDownTree depth level equals =2 then
DropDownTree  populates only level 2 only higher level nodes are disabled.How can I achieved this..
Plamen
Telerik team
 answered on 14 May 2014
1 answer
646 views
I have a radgrid and since I have custom buttons, I am using the CommandItemTemplate. But it throws "Cannot set property 'control' of undefined" error! When I comment out this._RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top; It does not throw the error and ofcourse the CommandItemTemplate is also not visible.
protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            
            this._RadLoadingPanel.ID = "_RadLoadingPanel";
            this._RadLoadingPanel.Transparency = 30;
            this._RadLoadingPanel.Skin = "WebBlue";
            this._RadLoadingPanel.BackgroundPosition = AjaxLoadingPanelBackgroundPosition.Center;
       
            this._RadGrid1.Skin = "WebBlue";
            this._RadGrid1.Width = Unit.Percentage(100);
            this._RadGrid1.GridLines = GridLines.None;
            this._RadGrid1.PageSize = 20;
            this._RadGrid1.AllowPaging = true;
            this._RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            this._RadGrid1.AllowSorting = true;
            this._RadGrid1.AllowFilteringByColumn = false;
            this._RadGrid1.AllowAutomaticUpdates = false;
            this._RadGrid1.AutoGenerateColumns = false;
 
            this._RadGrid1.EnableLinqExpressions = false;
            this._RadGrid1.MasterTableView.NoMasterRecordsText = "No Deals found";
            this._RadGrid1.ShowGroupPanel = false;
            this._RadGrid1.ShowStatusBar = true;
            this._RadGrid1.GroupingEnabled = false;
 
            this._RadGrid1.ClientSettings.Selecting.AllowRowSelect = true;
            this._RadGrid1.ClientSettings.EnableRowHoverStyle = true;
            this._RadGrid1.ClientSettings.EnablePostBackOnRowClick = true;
            this._RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                //add buttons
            this._RadGrid1.MasterTableView.CommandItemTemplate = new DealTemplate(this._RadGrid1, "State");                             
 
            this._RadGrid1.MasterTableView.DataKeyNames = "PriceID";
            this._RadGrid1.MasterTableView.ClientDataKeyNames = "Status";
            this._RadGrid1.MasterTableView.EnableHeaderContextMenu = true;
 
            this._RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = true;
            this._RadGrid1.ClientSettings.ClientEvents.OnRowSelected = "OnRowSelected";           
           
            this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
            this._RadGrid1.ItemDataBound += RadGrid1_ItemDataBound;
   
             #region Columns
}
Princy
Top achievements
Rank 2
 answered on 14 May 2014
3 answers
111 views
How do I add column which is updated using code and can be sortable?
I have RadGrid, which get the data using Entities Framework query.
I added label (lblTest1) to get additional information which isn't returned by the query, but in this way the column isn't sortable (because it's not one of the query outcomes).
Is there a different way to update the column so it will be sortable using the field data or is there a way to sort according to this label?

aspx:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0" 
DataSourceID="ObjectDataSourceIems" OnItemDataBound="RadGrid1_OnItemDataBound" GridLines="None" >
    <MasterTableView DataSourceID="ObjectDataSourceItems" 
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="ItemID" FilterControlAltText="ItemID" HeaderText="ItemID" SortExpression="ItemID" UniqueName="ItemID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="FirstName" FilterControlAltText="First Name" HeaderText="First Name" SortExpression="FirstName" UniqueName="FirstName">
           </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="Test1" SortExpression="" UniqueName="Test1">                                
                <ItemTemplate>
                    <asp:Label ID="lblTest1" runat="server" Text="" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>    
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>
        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
    </MasterTableView>
    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>

<asp:ObjectDataSource ID="ObjectDataSourceIems" runat="server" SelectMethod="GetItemsPaged"
    SelectCountMethod="GetObjectDataSourceIemsByNameCount"
    TypeName="test.BLL.Items.ItemsRepsitory" EnablePaging="True" SortParameterName="sortExpression">
    <SelectParameters>
        <asp:ControlParameter ControlID="TextBoxSearchString" Name="nameSearchString" PropertyName="Text" Type="String" />
        <asp:ControlParameter ControlID="RadioButtonListColumns" Name="searchColumn" PropertyName="SelectedValue" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>

cs:
public void RadGrid1_OnItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item.ItemType != GridItemType.Item && e.Item.ItemType != GridItemType.AlternatingItem) return;
    var item = (Item)e.Item.DataItem;

    MoreInfoRepository moreInfoRepository = new MoreInfoRepository();
    MoreInfo moreInfo = moreInfoRepository.GetMoreInfo(item.ItemID);
    if (moreInfo != null)
    {
        var lblTest1 = (Label)e.Item.FindControl("lblTest1");
        lblTest1.Text = moreInfo.Test1;
    }
}
Princy
Top achievements
Rank 2
 answered on 14 May 2014
7 answers
294 views
Hi,

we have encountered a problem with the GridCalculatedColumn and EnableLinqExpressions = false where we receive an Exception on every PageLoad


Minimal Test Case: 

<telerik:RadGrid ID="RadGrid1" DataSourceID="XmlDataSource1" runat="server" Width="990px"
    EnableLinqExpressions="False">
    <MasterTableView AutoGenerateColumns="False">
        <Columns>
            <telerik:GridBoundColumn runat="server" UniqueName="value1" DataField="value1" HeaderText="Value 1" />
            <telerik:GridBoundColumn runat="server" UniqueName="value1" DataField="value1" HeaderText="Value 2" />
            <telerik:GridCalculatedColumn runat="server" Expression="value1 + value2" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
<asp:xmldatasource id="XmlDataSource1" runat="server" datafile="Source.xml" xpath="DataPoints/Point"/>

source.xml
<?xml version="1.0" encoding="utf-8" ?>
<DataPoints>
  <Point Value1="1" Value2="2"/>
</DataPoints>


This yields the Exception:

Server Error in '/Example' Application.

Cannot remove this column, because it is part of an expression: column = value1 + value2.

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.ArgumentException: Cannot remove this column, because it is part of an expression: column = value1 + value2.

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: 

[ArgumentException: Cannot remove this column, because it is part of an expression: column = value1 + value2.]
   System.Data.DataColumnCollection.CanRemove(DataColumn column, Boolean fThrowException) +1865260
   System.Data.DataColumnCollection.BaseRemove(DataColumn column) +25
   System.Data.DataColumnCollection.Remove(DataColumn column) +53
   Telerik.Web.UI.GridDataTableFromEnumerable.GetColumnsToUse() +6962
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +661
   Telerik.Web.UI.GridResolveEnumerable.Initialize() +32
   Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +20
   Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +163
   Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +129
   Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +398
   Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +159
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +316
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +550
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   Telerik.Web.UI.GridTableView.PerformSelect() +16
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.GridTableView.DataBind() +229
   Telerik.Web.UI.RadGrid.DataBind() +80
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +72
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842



Using Telerik Q2-2012-SP2 (2012.2.912.35)
Peter
Top achievements
Rank 1
 answered on 14 May 2014
1 answer
102 views
Hi Guys,

I am experiencing the following problem:
I created my custom paragraph style "Small" for the FormatBlock Dropdown. It wraps text in <smal> tag and works as as expected.
However after applying this paragraph style it is not replaced with the <h1> etc. default styles when I choose them in the dropdown.
Steps to reproduce:
1. Put any text to the editor. For example: Test
2. Select it and click on the custom "Small" style in the FormatBlock Dropdown.
     Result in the HTML view: <small>Test</small>.
3. Select the word again and click Heading 1 default style.
    Result in the HTML view: <h1><small>Test</small></h1>.

On the other hand when I choose Heading 1, Heading 2, Menu etc. default styles successively, the current value replaces the old one:
<h1>Test</h1>  =>  <h2>Test</h2>  =>  <menu>Test</menu>  => ...

Is this an expected behavior with the custom  paragraph style or not?
Can you offer how to fix this issue in some simple way?

Best Regards,
Yuriy
Ianko
Telerik team
 answered on 14 May 2014
3 answers
478 views

 how to disabled raddropdowntree on particular node level .means i want my raddropdowntree level are configurable
Shinu
Top achievements
Rank 2
 answered on 14 May 2014
4 answers
169 views
Hi,
I'm using telerik RadFilter with RadFilterSqlQueryProvider but unfortunately I couldn't filter my datasource with persian or arabic contexts.
as I checked the generated result by RadFilterSqlQueryProvider  it misses N keyword for Navarchar fields for example when we are filterring a nvarchar field we should write TSQL such this : select * from x where Name Like N'%رضا%' but the filter control just gives select * from x where Name Like '%رضا%' which can only work on varchar fields not Nvarchars.
I set the culture to both arabic and persian cultures but nothing happened.
Any help to solve this issue will be appreciated .
fawad
Top achievements
Rank 1
 answered on 14 May 2014
2 answers
281 views
I have a radgrid that calls NeedsDataSource.  
I have a method like this:

protected void RadGridParentComponents_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       {
           var result = new Inventory().GetComponets(this.HiddenFieldTag.Value);
           RadGridParentComponents.DataSource = result;
       }

Which in turn calls this bll bit of code... GetComponents
public IQueryable<TagInformationComponentView> GetComponets(string tag)
       {
           using (var dbContext = new TIPWebITLibrary.DAL.TIPWebITDataContext())
           {
               if (String.IsNullOrEmpty(tag)) { throw new ArgumentNullException("tag", "Null or Empty is not allowed"); }
               var parent = dbContext.tblTechInventories.Where(x => x.Tag == tag).FirstOrDefault();
               //TODO: Check to ensure it is a parent
               var result = from c in dbContext.tblTechInventories
                            join p in dbContext.tblTechItems on c.ItemUID equals p.ItemUID
                            join t in dbContext.tblTechItemTypes on p.ItemTypeUID equals t.ItemTypeUID
                            where c.ParentInventoryUID == parent.InventoryUID
                            select new TagInformationComponentView()
                            {
                                InventoryUID = c.InventoryUID,
                                ProductName = p.ItemName,
                                ProductType = t.ItemTypeName,
                                Serial = c.Serial,
                                Tag = c.Tag
                            };
 
               if (result.Count() == 0)
                   return new List<TagInformationComponentView>().AsQueryable();
 
               return result.AsQueryable();
           }
 
 
       }


Now the question:

I know I can't wrap this in a USING because the context will be disposed and the RadGrid does not like this...
How do I dispose of the context when I am done with it correctly?  
I have used .toList() in the past but from what i have read this method does not leverage the full power of the radgrids queryable functionality.. Am i wrong in this or what?
Antonio Stoilkov
Telerik team
 answered on 14 May 2014
6 answers
951 views
Hi,

When i want to get radgrid selected items, I show that all the cells' values are null. I applied the solutions below but they didn't work.

Please help for getting selected row values.

*******
  GridDataItem[] itemm = grdWorkReport.MasterTableView.GetSelectedItems();
        string ss = itemm[0]["CalismaTarihi"].Text;   ( --->>> ss  Returns null )

******
 foreach (GridDataItem item in grdWorkReport.SelectedItems)
        {
            Response.Write(item["CalismaTarihi"].Text.ToString()); // CustomerID is the uniquename of column 
        }
*******

My radgrid is :

  <telerik:RadGrid ID="grdWorkReport" Skin="Sitefinity" runat="server" AllowPaging="True"   SelectedItemStyle-BackColor="Orange"
            AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="350px" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemDataBound="RadGrid1_ItemDataBound"
            Width="100%" ShowStatusBar="True" GroupingEnabled="False" AllowSorting="True"
            PageSize="10" AllowCustomPaging="True" OnItemCommand="RadGrid1_ItemCommand"  SortingSettings-SortToolTip="Sıralamak için buraya basınız." AllowMultiRowSelection="true">
            <PagerStyle Mode="NextPrevAndNumeric" PagerTextFormat="{4} {1} sayfada {5} kayıt"
                FirstPageToolTip="İlk Sayfa" LastPageToolTip="Son Sayfa" PrevPageToolTip="Önceki Sayfa"
                NextPageToolTip="Sonraki Sayfa" />
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                </ClientSettings>
            <MasterTableView CommandItemDisplay="Top" AllowFilteringByColumn="false" AllowCustomSorting="true"
                Width="100%">
                <CommandItemSettings ShowExportToWordButton="false" ShowExportToExcelButton="true"
                    ShowExportToCsvButton="false" ShowAddNewRecordButton="false" 
                    ExportToExcelText="Excel'e Aktar" />
                <CommandItemStyle Height="30px" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
           
                <Columns>

                   <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                <ItemTemplate>
                  <asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="ToggleRowSelection"
                    AutoPostBack="True" />
                </ItemTemplate>
                <HeaderTemplate>
                  <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState"
                    AutoPostBack="True" />
                </HeaderTemplate>
              </telerik:GridTemplateColumn>

                 <telerik:GridTemplateColumn UniqueName="RecordId" HeaderText="Kayıt ID" DataField="RecordId"
                         ReadOnly="true" Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblRecordId" runat="server" Text='<%# Eval("RecordId") %>'></asp:Label>
                        </ItemTemplate>
                     
                    </telerik:GridTemplateColumn> 
Shinu
Top achievements
Rank 2
 answered on 14 May 2014
1 answer
193 views
Hi I am using code as shown below: When I click on Popup to open calendar it opens it, but immediately it does a postback. Dont know why this post back happens.
in OnDayRender event I am changing the holiday pattern background colors.

<asp:UpdatePanel ID="updCal1" runat="server">
                                        <ContentTemplate>
                                        <panel>
                                         <telerik:RadDatePicker ID="radcal1" runat="server" AutoPostBack="true">
                                            <ClientEvents OnPopupOpening="OnPopupOpening" />
                                            <Calendar OnDayRender="cal_DayRender" runat="server" AutoPostBack="true"></Calendar>
                                        </telerik:RadDatePicker>
                                        </panel>
                                        </ContentTemplate>                                       
                                        </asp:UpdatePanel>

<script type="text/javascript">
    function OnPopupOpening(sender, args) {
            sender.get_calendar().raise_dayRender();
        }
</script> 



Princy
Top achievements
Rank 2
 answered on 14 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?