Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
254 views
Hi

I have a Radwindow with a button.
I am opening that window through a button click in the parent window.
But when I cam clicking the button on the RAD Window it disappears, I have tried with RAD Ajax Pannel but it that case the values posted in the window from my parent page disappears. Is there any standard way to keep the rad window on postback also.

Code for showing the window in aspx.vb page:

Protected Sub cmd_Search_Ref_Doc_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles cmd_Search_Ref_Doc.Click



        MySql = "Select Txn_Type from Master_Inventory_Txn_Type WHERE type_id =" & txt_Doc_No_Req.Value

        Dim SearchDt As DataTable = ComFunc.GetData(MySql)

        Dim TextBoxComment As Label = DirectCast(Rad_Window_Ref_Doc.ContentContainer.FindControl("lbl_Document_Name"), Label)
        TextBoxComment.Text = SearchDt.Rows(0).Item("Txn_Type")

        Dim RadWindowGrid As RadGrid = DirectCast(Rad_Window_Ref_Doc.ContentContainer.FindControl("radGridDocument"), RadGrid)
        MySql = "Select Doc_No, Doc_Date from BL_Txn_Item_Journal WHERE Txn_Type =" & txt_Doc_No_Req.Value
        SearchDt = ComFunc.GetData(MySql)
        RadWindowGrid.DataSource = SearchDt
        RadWindowGrid.DataBind()

        Dim script As String = "function f(){$find(""" + Rad_Window_Ref_Doc.ClientID + """).show();Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, True)

    End Sub

Code for Rad Window in ASPX Page:

 <telerik:RadWindow ID="Rad_Window_Ref_Doc" runat="server" 
            Skin="Outlook" VisibleOnPageLoad="false" EnableViewState="false"
            Width="550" Height="300" Modal="True" ReloadOnShow="true" ShowContentDuringLoad="false"
            Behaviors="Close, Maximize, Move, Reload" BorderStyle="Solid" 
            Title="Reference Documents" VisibleStatusbar="False">
            
             <ContentTemplate>
                
                 
                    
                        <table width="500px" style="height:70px;">
                            <tr>
                                <td>
                                    Search Document type
                                </td>
                                <td>
                                    <asp:Label ID="lbl_Document_Name" Font-Bold="true" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Document No
                                </td>
                                <td>
                                    <asp:TextBox ID="txt_Document_No" Width="200px" runat="server"></asp:TextBox> 
                                    <asp:ImageButton ID="cmd_Search_Document_No"  ImageUrl="~/Project/image/button/search-button.jpg" runat="server" />
                                </td>
                            </tr>
                    
                         </table>

                       
                

                 <telerik:RadGrid ID="radGridDocument" 
                        runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
                        AllowPaging="false" GridLines="None" ShowGroupPanel="true" Width="500" Skin="Outlook">
                        <PagerStyle Mode="NumericPages"></PagerStyle>
                        <ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true"></ClientSettings>
                        <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
                            <Pdf PageHeight="210mm" PageWidth="297mm" PageTopMargin="45mm">
                            </Pdf>
                        </ExportSettings>
       
        
                        <MasterTableView  DataKeyNames="Doc_No" AllowMultiColumnSorting="True" GroupLoadMode="Server">
           
                        <Columns>
                            <telerik:GridBoundColumn  DataField="Doc_No" HeaderText="Doc No" SortExpression="Doc_No" UniqueName="Doc_No" > 
                            <HeaderStyle Width="250px" HorizontalAlign="Center" />
                               <ItemStyle HorizontalAlign="Left" />
                           </telerik:GridBoundColumn>
                           <telerik:GridDateTimeColumn DataField="Doc_Date" HeaderText ="Date" 
                            UniqueName="Doc_Date" DataFormatString="{0:dd/MMM/yyyy}" PickerType="None"></telerik:GridDateTimeColumn>
                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="ViewCh" Text="Select Challan"
                            UniqueName="SelectCH" ImageUrl="~/Project/image/RadControls/Grid/Skins/Default/Edit.gif"></telerik:GridButtonColumn>
                        </Columns>
                    </MasterTableView>
                    </telerik:RadGrid>
                   
            </ContentTemplate>
    </telerik:RadWindow>







Princy
Top achievements
Rank 2
 answered on 24 Jun 2014
5 answers
178 views
I am experiencing an error with dynamically loaded tabs and pageviews when I enable ScrollChildren.

When the page loads, I can click on any of the tabs and it dynamically loads each pageview just fine.  But once I scroll it throws up a big nasty exception:

"Unhandled exception at line 15, column 9936 in http://localhost:56040/Web/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=rsmDetail_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=3.5.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:eb198dbd-2212-44f6-bb15-882bde414f00:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2013.3.1114.35,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:en-US:3e277e38-c51f-44dd-a424-df507d29c5b5:16e4e7cd:86526ba7:874f8ea2:f7645509:24ee1bba:1e771326:88144a7a:a7e79140:e330518b:8e6f0d33:6a6d718d:f46195d3:19620875:cda80b3:ed16cbdc:92fe8ea0:fa31b949:490a9d4e:bd8f85e4:11a04f7e:58366029:b7778d6c

0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: -38.960000000000036 is not a valid value for Int32."

I have not created a sample application that replicates the issue.  Any feedback would be appreciated!
VK
Top achievements
Rank 1
 answered on 23 Jun 2014
0 answers
117 views
I have two separate Date columns  on the same SQL Server table, Date column --(1) Name = rowView["Name"].ToString() and Date column -- (2)   Name = rowView["NameNew"].ToString() .  I want to compare the dates and if they not equal, than draw two separate line on the same chart. I can't seem to get it working, but I can draw one line at a time. Attached see mu code. Any help will be appreciated. Below is my code

 using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;
    using System.Data.SqlClient;
    using System.Data;
    using Telerik.Reporting.Charting;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// Summary description for rptWaterfall.
    /// </summary>
    public partial class rptNewReport : Telerik.Reporting.Report
    {
        private Telerik.Reporting.Charting.ChartSeries _series;
        private Telerik.Reporting.Charting.ChartSeries _seriesNew;
        public rptNewReport ()
        {
            /// <summary>
            /// Required for telerik Reporting designer support
            /// </summary>
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        private void chart1_NeedDataSource(object sender, EventArgs e)
        {
            DataSet ds;
            Telerik.Reporting.Processing.Chart chart;
            DateTime stepDate;
            DateTime stepDateNew;
            string interval,  Name,  NameNew, pointLabel, pointLabelnew, interval2;
            int riskWeight, likeNew, idOld, step, stId;

            if (_series == null)
            {

                chart = sender as Telerik.Reporting.Processing.Chart;

                ds = CreateChartDataSet();

                DataView view = ds.Tables[0].DefaultView;

                Telerik.Reporting.Chart chartDef = (Telerik.Reporting.Chart)chart.ItemDefinition;
                _series = new Telerik.Reporting.Charting.ChartSeries();

                Name = string.Empty;
                

                SetXAxisRange(view);

                foreach (DataRowView rowView in view)
                {
                    staId = (int)rowView["ID"];
                    step = int.Parse(rowView["Step"].ToString());
                    riskWeight = (int)rowView["averageweight"];
                    interval = rowView["Interval"].ToString();
                    interval2 = rowView["IntervalNew"].ToString();
                    Name = rowView["Name"].ToString();
                    likelihood = (int)rowView["Likelihood"];
                    likeNew = (int)rowView["idOld"];                    

                    if (DateTime.TryParse(interval, out stepDate))
                        pointLabel = stepDate.ToString("MM/dd/yy");
                    else
                        pointLabel = string.Empty;                   


                    if (DateTime.TryParse(interval, out stepDate))
                    {
                        string str = null;                         
                        str += stepDate.ToString("MM/dd/yy");                         
                        pointLabel = str;
                    }
                    else
                        pointLabel = string.Empty;

                   

                    Telerik.Reporting.Charting.ChartSeriesItem seriesItem = CreateSeriesItem(pointLabel, averageweight, stId);

                    _series.AddItem(seriesItem);
                }

                if (string.IsNullOrEmpty(Name))
                    Name = "ESPN Report";

                _series.Appearance.LineSeriesAppearance.Color = Color.Cyan;
                _series.Name = Name;
                _series.Type = ChartSeriesType.Line;
                chart1.ChartTitle.TextBlock.Text = "New Report";
                chartDef.Series.Clear();
                chartDef.Series.Add(_series);
            }
            if (_seriesNew == null)
            {

                chart = sender as Telerik.Reporting.Processing.Chart;

                ds = CreateChartDataSet();
                DataView view2 = ds.Tables[0].DefaultView;

                Telerik.Reporting.Chart chartDefNew = (Telerik.Reporting.Chart)chart.ItemDefinition;
                _seriesNew = new Telerik.Reporting.Charting.ChartSeries();


                NameNew = string.Empty;
                SetXAxisRangeNew(view2);

                foreach (DataRowView rowView2 in view2)
                {
                    staId = (int)rowView["ID"];
                    step = int.Parse(rowView["Step"].ToString());
                    riskWeight = (int)rowView["averageweight"];
                    interval = rowView["Interval"].ToString();
                    interval2 = rowView["IntervalNew"].ToString();
                    Name = rowView["NameNew"].ToString();
                    likelihood = (int)rowView["Likelihood"];
                    likeNew = (int)rowView["idOld"];       


                    if (DateTime.TryParse(interval2, out stepDateNew) )
                    {
                        string strNew = null;
                        strNew += stepDateNew.ToString("MM/dd/yy");
                        pointLabelnew = strNew;
                    }
                    else
                        pointLabelnew = string.Empty;


                    Telerik.Reporting.Charting.ChartSeriesItem seriesItemNew = CreateSeriesItemNew(pointLabelnew,averageweight, stId);
                    _seriesNew.AddItem(seriesItemNew);
                }

                if (string.IsNullOrEmpty(NameNew))
                    NameNew = "New Report";

                _seriesNew.Appearance.LineSeriesAppearance.Color = Color.Black;
                _seriesNew.Name = NameNew;
                _seriesNew.Type = ChartSeriesType.Line;

                chart1.ChartTitle.TextBlock.Text = "New Chart Rport";
                chartDefNew.Series.Clear();
                chartDefNew.Series.Add(_seriesNew);



            }
        }

        private Telerik.Reporting.Charting.ChartSeriesItem CreateSeriesItem(string pointLabel, int riskWeight, int statusId)
        {
            Telerik.Reporting.Charting.ChartSeriesItem seriesItem = new Telerik.Reporting.Charting.ChartSeriesItem(averageweight, pointLabel);
            seriesItem.Label.TextBlock.Appearance.Corners.SetCornersType(Telerik.Reporting.Charting.Styles.CornerType.Round);
            seriesItem.Label.TextBlock.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;

            if (statusId == 1) 
            {
                seriesItem.Label.TextBlock.Appearance.FillStyle.MainColor = Color.White;
                seriesItem.Label.TextBlock.Appearance.TextProperties.Color = Color.Black;
            }
            else if (statusId == 2) 
            {
                seriesItem.Label.TextBlock.Appearance.FillStyle.MainColor = Color.Gray;
                seriesItem.Label.TextBlock.Appearance.TextProperties.Color = Color.Black;
            }
            else//Complete
            {
                seriesItem.Label.TextBlock.Appearance.FillStyle.MainColor = Color.Black;
                seriesItem.Label.TextBlock.Appearance.TextProperties.Color = Color.White;
            }

            return seriesItem;
        }

        private Telerik.Reporting.Charting.ChartSeriesItem CreateSeriesItemNew(string pointLabelnew,int riskWeight, int statusId)
        {
            Telerik.Reporting.Charting.ChartSeriesItem seriesItemNew = new Telerik.Reporting.Charting.ChartSeriesItem(riskWeight, pointLabelnew);
            seriesItemNew.Label.TextBlock.Appearance.Corners.SetCornersType(Telerik.Reporting.Charting.Styles.CornerType.Round);
            
            if (statusId == 1) 
            {
                seriesItemNew.Label.TextBlock.Appearance.FillStyle.MainColor = Color.Red;
                seriesItemNew.Label.TextBlock.Appearance.TextProperties.Color = Color.Black;
            }
            else if (statusId == 2) 
            {
                seriesItemNew.Label.TextBlock.Appearance.FillStyle.MainColor = Color.Gray;
                seriesItemNew.Label.TextBlock.Appearance.TextProperties.Color = Color.Black;
            }
            else 
            {
                seriesItemNew.Label.TextBlock.Appearance.FillStyle.MainColor = Color.Black;
                seriesItemNew.Label.TextBlock.Appearance.TextProperties.Color = Color.White;
            }

            return seriesItemNew;
        }


        private void SetXAxisRange(DataView view)
        {
            int interval, firstInterval, lastInterval, interval2;

            lastInterval = int.MinValue;
            firstInterval = int.MaxValue;

             
            foreach (DataRowView rowView in view)
            {
                if (int.TryParse(rowView["Step"].ToString(), out interval))
                {
                    if (interval > lastInterval)
                        lastInterval = interval;
                    if (interval < firstInterval)
                        firstInterval = interval;
                }
            }

            //Get min and max step in result set
            foreach (DataRowView rowView in view)
            {
                if (int.TryParse(rowView["Step"].ToString(), out interval2))
                {
                    if (interval2 > lastInterval)
                        lastInterval = interval2;
                    if (interval2 < firstInterval)
                        firstInterval = interval2;
                }
            }

            double start = firstInterval;
            double end = lastInterval;

            //Avoid divide by zero error
            if (view.Count > 0)
            {
                chart1.PlotArea.XAxis.AddRange(start, end, 1);
            }
        }


        private void SetXAxisRangeNew(DataView view2)
        {
            int interval2, firstInterval, lastInterval;

            lastInterval = int.MinValue;
            firstInterval = int.MaxValue;

            //Get min and max step in result set
            foreach (DataRowView rowView2 in view2)
            {
                if (int.TryParse(rowView2["Step"].ToString(), out interval2))
                {
                    if (interval2 > lastInterval)
                        lastInterval = interval2;
                    if (interval2 < firstInterval)
                        firstInterval = interval2;
                }
            }

            double start = firstInterval;
            double end = lastInterval;

            //Avoid divide by zero error
            if (view2.Count > 0)
            {


                chart1.PlotArea.XAxis.AddRange(start, end, 1);

            }
        }

Ebenezer
Top achievements
Rank 1
 asked on 23 Jun 2014
2 answers
147 views
We have a RadGrid setup in which we are rebuilding the columns each postback but want to support column reordering, so we are maintaining the OrderIndexes of the columns in a ViewState object.  This approach has been working:  In the ColumnsReorder server side event we load the saved OrderIndexes from viewstate and apply reordering based on the event's Source and Target, then save the modified OrderIndexes back into ViewState.  In PreRender, we apply the saved OrderIndexes to the columns (see below code) and the columns show up in the expected order.

However, we have one problem:  We have certain command columns that we do not want to be movable, so when the ColumnsReorder event fires and either the Source or Target is one of these command columns we cancel the event (e.Cancelled = true;).  Unfortunately, when we cancel the event the grid displays the columns in the default order even though we are still applying the saved OrderIndexes to the columns in PreRender:

// Called from OnPreRender.
    private void RestoreOrderIndexes()
    {
       
      // Load the OrderIndexes saved in ViewState.
      var columnOrder = (Dictionary<string, int>)this.ViewState["GridColumnOrder"];
      if (columnOrder == null)
        return;
 
      // Apply the OrderIndexes to the grid columns.
      foreach (string columnName in columnOrder.Keys)
      {
        var gridColumn = this.MasterTableView.Columns.FindByUniqueNameSafe(columnName);
        if (gridColumn != null)
          gridColumn.OrderIndex = columnOrder[columnName];
      }
 
    }

I've verified that the OrderIndexes are being applied to the columns even when the ColumnsReorder event is cancelled via our OnColumnsReorder method, but the grid is simply not rendered with the modified order.  It seems the OrderIndex settings are ignored when the ColumnsReorder event is cancelled.

If I don't cancel the event and simply return from the OnColumnsReorder method when a command column is specified, the command column gets moved client side even though the OrderIndex for the command column wasn't modified by our code.  Any subsequent column reordering after that will see the command column suddenly pop back into place because it wasn't actually moved in the OrderIndex viewstate collection.

Do you have any suggestions for this issue?
Luke
Top achievements
Rank 2
 answered on 23 Jun 2014
2 answers
384 views
I have encountered an error here where I am attempting to use the AutoPostBackOnFilter of a grid and it is throwing a Javascript error: 

Uncaught TypeError: Cannot read property '_filterOnKeyPressWithDelay' of null

I am creating the grid in code with no markup:

//Create the Rad Grid
Telerik.Web.UI.RadGrid tmpRadGrid = new Telerik.Web.UI.RadGrid();
tmpRadGrid.Init += new EventHandler(tmpRadGrid_Init);
tmpRadGrid.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(tmpRadGrid_NeedDataSource);
tmpRadGrid.SelectedIndexChanged += new EventHandler(tmpRadGrid_SelectedIndexChanged);
tmpRadGrid.MasterTableView.ExpandCollapseColumn.Visible = false;
tmpRadGrid.Width = Unit.Percentage(100);
tmpRadGrid.ID = "radGrid" + tabText;
tmpRadGrid.Skin = "Silk";
tmpRadGrid.AutoGenerateColumns = false;
tmpRadGrid.AllowFilteringByColumn = true;
tmpRadGrid.GroupingSettings.CaseSensitive = false;
tmpRadGrid.AllowSorting = true;
tmpRadGrid.ClientSettings.EnableRowHoverStyle = true;
tmpRadGrid.ClientSettings.Selecting.AllowRowSelect = true;
tmpRadGrid.ClientSettings.EnablePostBackOnRowClick = true;
tmpRadGrid.CellPadding = 0;
tmpRadGrid.CellSpacing = 0;
tmpRadGrid.AllowPaging = true;
tmpRadGrid.PageSize = 50;
tmpRadGrid.PagerStyle.AlwaysVisible = true;
 
//Create the columns
Telerik.Web.UI.GridTemplateColumn tmpCol_Name = new Telerik.Web.UI.GridTemplateColumn();
tmpCol_Name.ItemTemplate = new GridNameColumnTemplate();
tmpCol_Name.ItemStyle.Width = new Unit(150);
tmpCol_Name.ItemStyle.VerticalAlign = VerticalAlign.Top;
tmpCol_Name.HeaderText = "Name";
tmpCol_Name.DataField = "FullName";
tmpCol_Name.SortExpression = "FullName";
tmpCol_Name.UniqueName = "FullName";
tmpCol_Name.FilterDelay = 0;
tmpCol_Name.FilterControlWidth = Unit.Percentage(80);
tmpCol_Name.AutoPostBackOnFilter = true;
tmpCol_Name.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;
 
Telerik.Web.UI.GridBoundColumn tmpCol_Title = new Telerik.Web.UI.GridBoundColumn();
tmpCol_Title.ItemStyle.Width = new Unit(150);
tmpCol_Title.ItemStyle.VerticalAlign = VerticalAlign.Top;
tmpCol_Title.HeaderText = "Business Title";
tmpCol_Title.DataField = "Title";
tmpCol_Title.SortExpression = "Title";
tmpCol_Title.UniqueName = "Title";
tmpCol_Title.FilterDelay = 0;
tmpCol_Title.FilterControlWidth = Unit.Percentage(80);
tmpCol_Title.AutoPostBackOnFilter = true;
tmpCol_Title.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;
 
Telerik.Web.UI.GridTemplateColumn tmpCol_ContactInfo = new Telerik.Web.UI.GridTemplateColumn();
tmpCol_ContactInfo.ItemTemplate = new GridContactInfoColumnTemplate();
tmpCol_ContactInfo.ItemStyle.Width = new Unit(100);
tmpCol_ContactInfo.ItemStyle.VerticalAlign = VerticalAlign.Top;
tmpCol_ContactInfo.HeaderText = "Contact Information";
tmpCol_ContactInfo.DataField = "FullContactInfo";
tmpCol_ContactInfo.SortExpression = "FullContactInfo";
tmpCol_ContactInfo.UniqueName = "ContactInfo";
tmpCol_ContactInfo.FilterDelay = 0;
tmpCol_ContactInfo.FilterControlWidth = Unit.Percentage(80);
tmpCol_ContactInfo.AutoPostBackOnFilter = true;
tmpCol_ContactInfo.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;
 
Telerik.Web.UI.GridBoundColumn tmpCol_Location = new Telerik.Web.UI.GridBoundColumn();
tmpCol_Location.ItemStyle.Width = new Unit(70);
tmpCol_Location.ItemStyle.VerticalAlign = VerticalAlign.Top;
tmpCol_Location.FilterControlWidth = Unit.Percentage(60);
tmpCol_Location.DataField = "OfficeCode";
tmpCol_Location.HeaderText = "Office Code";
tmpCol_Location.SortExpression = "OfficeCode";
tmpCol_Location.UniqueName = "Office";
tmpCol_Location.FilterDelay = 0;
tmpCol_Location.AutoPostBackOnFilter = true;
tmpCol_Location.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;
 
//Add the columns to the grid
tmpRadGrid.MasterTableView.Columns.Add(tmpCol_Name);
tmpRadGrid.MasterTableView.Columns.Add(tmpCol_Title);
tmpRadGrid.MasterTableView.Columns.Add(tmpCol_ContactInfo);
tmpRadGrid.MasterTableView.Columns.Add(tmpCol_Location);
 
tmpRadGrid.DataSource = tmpLetterContacts;
tmpRadGrid.DataBind();

Some of the columns are templates with the following templates: 
class GridNameColumnTemplate : ITemplate
{
    public void InstantiateIn(Control container)
    {
        Literal lit = new Literal();
        lit.DataBinding += new EventHandler(lit_DataBinding);
        container.Controls.Add(lit);
    }
 
    public void lit_DataBinding(object sender, EventArgs e)
    {
        Literal l = (Literal)sender;
        Telerik.Web.UI.GridDataItem container = (Telerik.Web.UI.GridDataItem)l.NamingContainer;
        Directory_BO.Employee tmpEmp = (Directory_BO.Employee)container.DataItem;
        l.Text = "<table><tr><td style='border:none;vertical-align:top;padding:0 3px 0 0 !important;' width='45px;'><img width='45px' src='/controls/EmployeePhoto.ashx?img=thumb&id=" + tmpEmp.ID + "' /></td><td style='border:none;padding:0px;vertical-align:top;'>" + tmpEmp.FullName + "</td></tr></table>";
    }
}
 
class GridContactInfoColumnTemplate : ITemplate
{
    public void InstantiateIn(Control container)
    {
        Literal lit = new Literal();
        lit.DataBinding += new EventHandler(lit_DataBinding);
        container.Controls.Add(lit);
    }
 
    public void lit_DataBinding(object sender, EventArgs e)
    {
        Literal l = (Literal)sender;
        Telerik.Web.UI.GridDataItem container = (Telerik.Web.UI.GridDataItem)l.NamingContainer;
        Directory_BO.Employee tmpEmp = (Directory_BO.Employee)container.DataItem;
        l.Text = tmpEmp.FullContactInfo;
    }
}

What is causing this error?  Is there a way to correct this?  I need the filtering to occur on Enter press.

Thanks,

Chris

Pavlina
Telerik team
 answered on 23 Jun 2014
2 answers
108 views
I want to use C# classes to query the database and create a data table and then set it as my DataSource for my TileList. However, after some debugging it seems that TileList does not have a "OnNeedDataSource" attribute to run a method that will query the data table. I know that I can set the DataSourceID, but I prefer to do it via C# code. This is what it looks like

<telerik:RadTileList runat="server" ID="PurchaseTileList" Width="900px"
                TileRows="1"
                EnableDragAndDrop="True" 
                SelectionMode="None"
                OnTileDataBound="TileListPurchase_OnDataBound"
                OnNeedDataSource="TileListPurchase_NeedDataSource">
                <DataBindings>
                    <CommonTileBinding TileType="RadTextTile" Shape="Square" DataTitleTextField="ProductDescription" DataNameField="ProductID" />
                    <TilePeekTemplate>
                        <div class="productNamePeek"><%# DataBinder.Eval(Container.DataItem,"PName") %></div>
                    </TilePeekTemplate>
                </DataBindings>
                <Groups>
                    <telerik:TileGroup>
                        <telerik:RadTextTile runat="server" Shape="Square" Font-Size="18px" Font-Bold="true"
                             Text="Products">
                            <Title Text=""></Title>
                        </telerik:RadTextTile>
                    </telerik:TileGroup>
                </Groups>
            </telerik:RadTileList>

My TileListPurchase_NeedDataSource will set Data Source to a created DataTable (This, however, is never run)

and my TileListPurchase_OnDataBound currently doesn't do much seeing as I'm not sure how to set these values for the tile.
Jason
Top achievements
Rank 1
 answered on 23 Jun 2014
1 answer
111 views
I am having trouble with rad org chart, when scrolling on the Ipad the tree crashes
The tree has 4 levels and about 120 nodes so the width is more than height.

All the nodes are expanded by default.

When the user scrolls the tree on the Ipad the website crashes.


Code For the tree
<telerik:RadOrgChart ID="orgchrtTree" runat="server" LoadOnDemand="Nodes" PersistExpandCollapseState="true" OnClientNodePopulated="OnClientNodePopulated">
            <RenderedFields>
                <NodeFields>
                    <telerik:OrgChartRenderedField DataField="Value" />
                </NodeFields>
                <ItemFields>
                    <telerik:OrgChartRenderedField DataField="NodeGroupID" />
                </ItemFields>
                <ItemFields>
                    <telerik:OrgChartRenderedField DataField="NodeID" />
                </ItemFields>
            </RenderedFields>
            <GroupEnabledBinding>
                <NodeBindingSettings DataFieldID="GroupID" DataFieldParentID="ParentGroupID" />
                <GroupItemBindingSettings DataFieldID="NodeID" DataFieldNodeID="GroupID" DataTextField="Value" />
            </GroupEnabledBinding>
        </telerik:RadOrgChart>
   
Code behind
protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {                
                }
                Presenter.OnViewLoaded();
                orgchrtTree.GroupEnabledBinding.NodeBindingSettings.DataSource = GetTreeGroupData();
                orgchrtTree.GroupEnabledBinding.GroupItemBindingSettings.DataSource = GetFollettFamilyTreeData();;
                orgchrtTree.DataBind();
                orgchrtTree.EnableDrillDown = true;
                orgchrtTree.EnableCollapsing = true;
                orgchrtTree.EnableGroupCollapsing = true;            
            }
            catch (Exception ex)
            {
                base.LogError(ex);
                base.ShowErrorMessage(ex.Message);
            }        
        }

Please help me to find a solution for this problem
Dimitar
Telerik team
 answered on 23 Jun 2014
1 answer
96 views
Hi, I am using RadAjaxManager with AjaxUpdateControl in my project to update panels and controllers. The task is simple, I need to choose from initial buttons to load necessary objects to datalist and asp:panel. The panel will contain dynamic usercontrol from different projects. My settings are like this;

<telerik:RadScriptManager ID="RadScriptManager" runat="server" EnablePartialRendering="true"  />
    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server" >
        <ClientEvents OnResponseEnd="onResponseEnd" OnRequestStart="onRequestStart"/>
        <AjaxSettings >
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager">
            <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="listInjectors" />
                 <telerik:AjaxUpdatedControl ControlID="injectorsTemplate"/>
               </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>


I have a datalist with items, in javascript of that item onclick i invoke RadAjaxManager to send a ajax request and depending on that i will update listInjectors and injectorsTemplate. When I complete the action it is ok that i can see new interface is changed but there is no javascript binding or button events are working. Also in my every UserControl I have different javascript source which are added with optimization Script.Render(~/xyz.js). After the operation I can see that that file is not loaded. I have buttons radiobuttons and textboxes in the usercontrol and non of their validation nor onclicks are working. 

Can you please explain why?
Thanks,


Viktor Tachev
Telerik team
 answered on 23 Jun 2014
1 answer
896 views
Aquí el código de una plantilla para automatizar el filtro de una columna de tipo fecha para el RadGrid. Los pasos son:

1. En el evento "ColumnCreated" del RadGrid en la columna especificada se le agrega la plantilla por ejemplo así:
Private Sub NombreRadGrid_ColumnCreated(sender As Object, e As GridColumnCreatedEventArgs) Handles rgdSolicitudes.ColumnCreated
   if e.Column Is GridDateTimeColumn And NombreRadGrid.MasterTableView.AllowFilteringByColumn then
      Dim itemDate As GridDateTimeColumn = TryCast(e.Column, GridDateTimeColumn)
      itemDate.FilterTemplate = New hrrFiltroRangoFecha(Page, itemDate.UniqueName, CDate(startDate), CDate(endDate), CDate("01-01-2014"), Now)
        'itemDate.UniqueName ES EL NOMBRE DE LA COLUMNA O DEL CAMPO
        'CDate(startDate) ES LA FECHA DE INICIO SELECCIONADA
        'CDate(endDate) ES LA FECHA FINAL SELECCIONADA
        'CDate("01-01-2014") ES LA FECHA MINIMA PARA SELECCIONAR
        'Now ES LA FECHA MAXIMA PARA SELECCIONAR
   end if
End Sub

2. En el evento "ItemCommand" del RadGrid, cuando el comando sea "RadGrid.FilterCommandName" sucede esto:
Private Sub NombreRadGrid_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles rgdSolicitudes.ItemCommand
    If e.CommandName = RadGrid.FilterCommandName Then
       Dim item As GridFilteringItem = CType(e.Item, GridFilteringItem)
       For Each column As GridColumn In rgdSolicitudes.MasterTableView.RenderColumns
          If TypeOf column Is GridBoundColumn Then
               Dim boundColumn As GridBoundColumn = TryCast(column, GridBoundColumn)
               Select Case boundColumn.DataField
               Case "Fecha"  <------------------- (Es el nombre del campo o de la columna)
                   If boundColumn.CurrentFilterValue <> "" Then
                      Me.startDate = CType(Mid(boundColumn.CurrentFilterValue, 1, 10), Date)
                      Me.endDate = CType(Mid(boundColumn.CurrentFilterValue, 12, 10), Date)
                  End If
               End Select
          End If
      Next
    End If
End Sub

3. En el código de la pagina se agrega estas dos propiedades:
Protected Property startDate() As System.Nullable(Of DateTime)
    Get
       If ViewState("strD") IsNot Nothing Then
          Return DirectCast(ViewState("strD"), DateTime)
       Else
          Return New DateTime(2014, 1, 1) '<------- ESTA ES LA FECHA INICIAL MINIMA PARA EL FILTRO DE FECHA
      End If
    End Get
    Set(ByVal value As System.Nullable(Of DateTime))
        ViewState("strD") = value
    End Set
End Property

Protected Property endDate() As System.Nullable(Of DateTime)
    Get
       If ViewState("endD") IsNot Nothing Then
          Return DirectCast(ViewState("endD"), DateTime)
       Else
          Return New DateTime(Year(Now), Month(Now), Day(Now)) '<------ ESTA ES LA FECHA FINAL MAXIMA PARA EL FILTRO FECHA
       End If
     End Get
     Set(ByVal value As System.Nullable(Of DateTime))
         ViewState("endD") = value
      End Set
End Property

4. Se crea una clase por ejemplo con el nombre de "hrrFiltroRangoFecha":
Imports System.Web.UI.WebControls

Public Class hrrFiltroRangoFecha
Implements ITemplate
Private rdpFechaInicio As RadDatePicker
Private rdpFechaFinal As RadDatePicker
Private strColumna As String '<------ ES EL NOMBRE DE LA COLUMNA DE TIPO FECHA DEL RADGRID
 Private fchInicialMinima As Date '<------ ES LA FECHA MINIMA DEL DATEPICKER INICIAL
Private fchFinalMaxima As Date '<------ ES LA FECHA MAXIMA DEL DATEPICKER FINAL
Private fchInicial As Date '<----------- ES LA FECHA SELECCIONADA DEL DATEPICKER INICIAL
Private fchFinal As Date '<----------- ES LA FECHA SELECCIONADA DEL DATEPICKER FINAL
Protected Pagina As Page

Public Sub New(ByVal Pag As Page, ByVal strCol As String, ByVal fchIni As Date, ByVal fchFin As Date, ByVal fchIniMin As Date, ByVal fchFinMax As Date)
Pagina = Pag
strColumna = strCol
fchInicialMinima = fchIniMin
fchFinalMaxima = fchFinMax
fchInicial = fchIni
fchFinal = fchFin
rdpFechaInicio = New RadDatePicker()
rdpFechaFinal = New RadDatePicker()
ScriptManager.RegisterStartupScript(Pagina, Pagina.GetType(), "FormatoFecha", "function FormatoFecha(picker) {var date = picker.get_selectedDate(); var dateInput = picker.get_dateInput(); var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());return formattedDate;}", True)
End Sub

Private Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
container.ClientIDMode = ClientIDMode.AutoID
Dim lbl1 As New Label
Dim lbl2 As New Label
lbl1.Text = "Del "
lbl2.Text = " al "
container.Controls.Add(lbl1)

rdpFechaInicio.EnableViewState = False
rdpFechaInicio.Width = 130
rdpFechaInicio.MinDate = fchInicialMinima 
rdpFechaInicio.MaxDate = fchFinalMaxima
rdpFechaInicio.FocusedDate = fchInicialMinima 
rdpFechaInicio.ToolTip = "Fecha de inicio"
rdpFechaInicio.ID = String.Format("FechaInicio{0}", strColumna)
rdpFechaInicio.DbSelectedDate = fchInicial
AddHandler rdpFechaInicio.DataBinding, AddressOf FechaInicio_DataBinding
rdpFechaInicio.ClientEvents.OnDateSelected = String.Format("FechaInicioSeleccionada_{0}", strColumna)
container.Controls.Add(rdpFechaInicio)

container.Controls.Add(lbl2)

rdpFechaFinal.EnableViewState = False
rdpFechaFinal.Width = 130
rdpFechaFinal.MinDate = fchInicialMinima 
rdpFechaFinal.MaxDate = fchFinalMaxima 
rdpFechaFinal.FocusedDate = Now
rdpFechaFinal.ToolTip = "Fecha de final"
rdpFechaFinal.ID = String.Format("FechaFinal{0}", strColumna)
rdpFechaFinal.DbSelectedDate = fchFinal
AddHandler rdpFechaFinal.DataBinding, AddressOf FechaFinal_DataBinding
rdpFechaFinal.ClientEvents.OnDateSelected = String.Format("FechaFinalSeleccionada_{0}", strColumna)
container.Controls.Add(rdpFechaFinal)
End Sub

Public Sub FechaInicio_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
Dim rdpInicio As RadDatePicker = DirectCast(sender, RadDatePicker)
Dim contenido As GridItem = DirectCast(rdpInicio.NamingContainer, GridItem)
Dim contenidoFinal As GridItem = DirectCast(rdpFechaFinal.NamingContainer, GridItem)
Dim script As String = "function FechaInicioSeleccionada_" + strColumna + "(sender,args) {var tableView=$find(""" + TryCast(contenido, GridItem).OwnerTableView.ClientID + """);var ToPicker = $find(""" + TryCast(contenidoFinal, GridItem).FindControl(String.Format("FechaFinal{0}", strColumna)).ClientID + """);var fromDate = FormatoFecha(sender);var toDate = FormatoFecha(ToPicker);tableView.filter(""" + strColumna + """, fromDate + "" "" + toDate, ""Between"");}"
ScriptManager.RegisterStartupScript(Pagina, Pagina.GetType(), String.Format("FechaInicioSeleccionada_{0}", strColumna), script, True)
End Sub

Public Sub FechaFinal_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
Dim rdpFinal As RadDatePicker = DirectCast(sender, RadDatePicker)
Dim contenido As GridItem = DirectCast(rdpFinal.NamingContainer, GridItem)
Dim contenidoInicio As GridItem = DirectCast(rdpFechaInicio.NamingContainer, GridItem)
Dim script As String = "function FechaFinalSeleccionada_" + strColumna + "(sender,args) {var tableView=$find(""" + TryCast(contenido, GridItem).OwnerTableView.ClientID + """);var FromPicker = $find(""" + TryCast(contenidoInicio, GridItem).FindControl(String.Format("FechaInicio{0}", strColumna)).ClientID + """);var fromDate = FormatoFecha(FromPicker);var toDate = FormatoFecha(sender);tableView.filter(""" + strColumna + """, fromDate + "" "" + toDate, ""Between"");}"
ScriptManager.RegisterStartupScript(Pagina, Pagina.GetType(), String.Format("FechaFinalSeleccionada_{0}", strColumna), script, True)
End Sub
End Class

EL UNICO PROBLEA QUE TIENE ES QUE SE PIERDE EL FILTRO CUANDO SE QUIERE FILTRAR AL MISMO TIEMPO OTRA COLUMNA. ALGUIEN QUE PUEDA APOYAR Y SOLUCIONAR EL PROBLEMA. POR OTRO LADO TENGO OTROS FILTROS CON PLANTILLAS PARA EL RADGRID (RADCOMBOBOX Y RADSLIDER) QUE DESPUES PUBLICARÉ.
Pavlina
Telerik team
 answered on 23 Jun 2014
2 answers
206 views
<telerik:RadGrid ClientSettings-Selecting-AllowRowSelect="True" runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="true"
                                    OnSortCommand="RadGrid1_SortCommand" OnPageIndexChanged="RadGrid1_PageIndexChanged" OnPageSizeChanged="RadGrid1_PageSizeChanged"
                                    AllowFilteringByColumn="true" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged" Width="100%" OnPreRender="RadGrid1_PreRender"
                                    OnItemDataBound="RadGrid1_ItemDataBound" OnColumnsReorder="RadGrid1_ColumnsReorder">
                                    <ClientSettings EnablePostBackOnRowClick="true" AllowColumnsReorder="true">
                                    </ClientSettings>
                                    <MasterTableView AutoGenerateColumns="False" TableLayout="Auto">
                                        <Columns>
                                            <telerik:GridImageColumn AllowFiltering="false" DataType="System.String" DataImageUrlFields="Image" ImageAlign="AbsMiddle" ImageHeight="100px">
                                            </telerik:GridImageColumn>
....

For some reason my GridImageCoulmn refuses to let me place the images where I want them. It always cuts them off (see attached). I have tried every ImageAlign argument and the images do not move at all. It does not center them in the row like I have seen in every example and I cannot find anyone who has a similar issue. 


Pavlina
Telerik team
 answered on 23 Jun 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?