Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
216 views
I have a RadTreeView on a form that is being populated by code with the node.add method described in your documentation. (http://www.telerik.com/help/aspnet-ajax/treeview-load-on-demand-client.html)  It works great for loading the items, but when you click one or do anything that causes a PostBack, all the items disappear.

APSX
<%@ Page Title="" Language="C#"  MasterPageFile="~/Content/themes/Level_One.Master" AutoEventWireup="true" CodeBehind="RequestManager.aspx.cs" Inherits="WebApplication.Forms.RequestManager" %>
 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ MasterType VirtualPath="~/Content/themes/Level_One.Master" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <%: System.Web.Optimization.Styles.Render("~/Content/css") %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="main_placeholder" runat="server">
    <telerik:RadCodeBlock ID="cb1" runat="server">
        <script type="text/javascript">
            function mngRequestStarted(ajaxManager, eventArgs) {
                // alert(eventArgs.get_eventTargetElement())
                var newArr = new Array();
                for (var name in ajaxManager) {
                    newArr.push(name + "<-->" + ajaxManager[name])
 
                }
            }
 
        </script>
    </telerik:RadCodeBlock>
 
    <telerik:RadScriptManager ID="main_radscriptmanager" runat="server" EnableViewState="true"></telerik:RadScriptManager>
    <telerik:RadAjaxLoadingPanel ID="main_loading" runat="server" Skin="Metro" EnableViewState="true"></telerik:RadAjaxLoadingPanel>
 
        <telerik:RadAjaxManager ID="main_ajaxmanager" runat="server" EnableAJAX="true" EnableViewState="true" ClientEvents-OnRequestStart="mngRequestStarted">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="tvRequestList">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="tvRequestList" LoadingPanelID="main_loading" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
                <telerik:AjaxSetting AjaxControlID="main_windowmanager">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="main_windowmanager" LoadingPanelID="main_loading" />
                        <telerik:AjaxUpdatedControl ControlID="wndw_permissions" LoadingPanelID="main_loading" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnSave" EventName="Click">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="btnSave" UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnCancel"></telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
 
    <asp:Button ID="cmdTest" runat="server" OnClick="cmdTest_Click" />
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Height="700px" Width="100%" EnableViewState="false">
          <telerik:RadPane ID="Pane1" runat="server" Height="100%" Width="20%">
               <telerik:RadTreeView ID="tvRequestList" runat="server"
                   Skin="Metro" PersistLoadOnDemandNodes="true"
                   OnNodeExpand="tvRequestList_NodeExpand"
                   OnNodeClick="tvRequestList_NodeClick">
 
               </telerik:RadTreeView>
          </telerik:RadPane>
          <telerik:RadSplitBar ID="RadSplitbar1" runat="server" CollapseMode="Forward">
          </telerik:RadSplitBar>
          <telerik:RadPane ID="Pane2" runat="server">
               Pane2 - 100px
          </telerik:RadPane>
  <%--        <telerik:RadSplitBar ID="Radsplitbar2" runat="server" CollapseMode="Forward">
          </telerik:RadSplitBar>
          <telerik:RadPane ID="Pane3" runat="server" Height="150">
               Pane3 - 150px
          </telerik:RadPane>--%>
     </telerik:RadSplitter>
    <telerik:RadWindowManager runat="server" ID="RadWindowManager1" EnableViewState="true"></telerik:RadWindowManager>
</asp:Content>

Code Behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jabil.Core;
using DataEntities.Application.Context;
using DataEntities.Application.Entities;
using Telerik.Web.UI;
using System.Collections;
using System.Collections.Generic;
 
namespace WebApplication.Forms
{
    public partial class RequestManager : FrameworkPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Master.PageTitle = "Request Manager";
 
            if (!IsPostBack)
            {
                LoadRootNodes(tvRequestList);
            }
        }
 
        private void LoadRootNodes(RadTreeView tv)
        {
            using (RequestsDataContext rdc = new RequestsDataContext(string.Empty))
            {
                List<RequestManagerTreeList> tl = rdc.GetRequestManagerTreeViewList(1, 0, false).ToList<RequestManagerTreeList>();
                foreach (RequestManagerTreeList tlItem in tl)
                {
                    RadTreeNode tn = new RadTreeNode();
                    tn.Text = tlItem.ItemName;
                    tn.Value = ("L1" + tlItem.ItemId.ToString());
                    tn.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
                    tv.Nodes.Add(tn);
                }
            }
        }
 
        protected void tvRequestList_NodeExpand(object sender, RadTreeNodeEventArgs e)
        {
            try
            {
                using (RequestsDataContext rdc = new RequestsDataContext(string.Empty))
                {
                    string itemValue = e.Node.Value;
 
                    if (itemValue.Substring(0, 1) == "L")
                    {
                        int level = Convert.ToInt32(itemValue.Substring(1, 1)) + 1;
                        int itemId = Convert.ToInt32(itemValue.Substring(2, itemValue.Length - 2).ToString());
                        string levelTag = "L" + level.ToString();
                        List<RequestManagerTreeList> tl = rdc.GetRequestManagerTreeViewList(level, itemId, false).ToList<RequestManagerTreeList>();
                        foreach (RequestManagerTreeList tlItem in tl)
                        {
                            RadTreeNode tn = new RadTreeNode();
                            tn.Text = tlItem.ItemName;
                            tn.Value = levelTag + tlItem.ItemId.ToString();
                            if (level < 3)
                            {
                                tn.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
                            }
                            e.Node.Nodes.Add(tn);
 
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
                show_error_message(ex.Message);
            }
        }
 
        protected void tvRequestList_NodeClick(object sender, RadTreeNodeEventArgs e)
        {
            show_error_message("Test");
        }
 
        private void show_error_message(string error_message)
        {
 
            string error = error_message.Replace("'", "");
 
 
            main_ajaxmanager.ResponseScripts.Add(string.Format("window.radalert(\"" + error + "\")"));
 
        }
 
        protected void cmdTest_Click(object sender, EventArgs e)
        {
            show_error_message("Test");
        }
    }
}

Scott
Top achievements
Rank 1
 answered on 25 Aug 2014
2 answers
119 views
Hi,

I'm calling a page containing a data pager. Part of my initial call url is a page number I would like to go to.
I searched around and tried a lot of things without success:
- FireCommand
- SEO Paging

What is the designed way to specify a start page for a data pager?

THANKS!
Jens-Thomas
Top achievements
Rank 1
 answered on 25 Aug 2014
2 answers
161 views
I have an application where I am dynamically creating a group of tabs, each one with a radgrid on it, from the code behind.  The radgrid includes a TemplateColumnEdit column (GridEditCommandColumn cannot be used because the link fires javascript to decide based on row data which of 7 types of dialog to present for editing).  Here is a portion of the code:

var colEdit = new GridTemplateColumn();
colEdit.UniqueName = "TemplateEditColumn";
colEdit.AllowFiltering = false;
colEdit.HeaderStyle.Width = Unit.Percentage(5);
colEdit.ItemStyle.VerticalAlign = VerticalAlign.Top;
colEdit.ItemTemplate = new TemplateColumnEdit("EditLink");

The column always says "Edit" regardless of the language/culture.  I need either to translate it, or to display ~/App_Themes/Default/RadGrid/Edit.gif.  How can this be accomplished from code behind?

Thank you.
Princy
Top achievements
Rank 2
 answered on 25 Aug 2014
17 answers
718 views
I have problem with the AutoCompleteBox where i get an Object reference not set to an instance of an object error in popup.

I have the placed the control inside a DetailsView like this

<InsertItemTemplate>
 <telerik:RadComboBox ID="CmbChemicalsInsertMode" CheckBoxes="true" Filter="Contains" HighlightTemplatedItems="true" ExpandDirection="Up" MarkFirstMatch="true" AllowCustomText="true" DataTextField="Name" EmptyMessage="Vælg stoffer" Runat="server">
</telerik:RadComboBox>
 <asp:ImageButton ID="BtnAddChemical" CausesValidation="false" ToolTip="Tilføj valgte" width="15px" height="15px" ImageUrl="~/Images/plus.png" OnClick="BtnAddChemical_Click" runat="server" ></asp:ImageButton>
<telerik:RadTextBox ID="TxtDeclaration" TextMode="MultiLine" Rows="5" Text='<%# DataBinder.Eval(Container, "DataItem.Declaration") %>' Runat="server" Skin="Metro"
              Width="170px" />
               
 <telerik:RadAutoCompleteBox ID="RACBChemicals"  InputType="Token" AllowCustomEntry="true" Skin="Metro" DataTextField="Name" DropDownWidth="400"
    DropDownHeight="250" Runat="server"></telerik:RadAutoCompleteBox>
</InsertItemTemplate>

The detailsview is located inside a RadWindow. As soon as i start typing something in the field, i get the previous mentioned popup error.
As soon as i try to move the AutoCompleteBox outside of the DetailsView, the error stops and the control works fine

Martin
Top achievements
Rank 2
 answered on 25 Aug 2014
3 answers
367 views
Hi Guys,

I'm trying to create a chart with multiple line series' below is my code:



string
sql = string.Format(@"SELECT     dbo.ProductSales.OrderDate, dbo.ProductSales.ProductID, dbo.ProductSales.UnitsSold, dbo.Product.Name
                                    FROM         dbo.ProductSales INNER JOIN
                      dbo.Product ON dbo.ProductSales.ProductID = dbo.Product.ProductID
 
                                    WHERE     (DistributionCentreID = 3) AND (dbo.Product.ProductID = 10)
                                    GROUP BY dbo.ProductSales.OrderDate, dbo.ProductSales.ProductID, dbo.ProductSales.UnitsSold, dbo.Product.Name
                                    HAVING      (OrderDate >= CONVERT(DATETIME, '01/10/2013', 103)) AND (OrderDate <= CONVERT(DATETIME, '10/10/2013', 103))");
        SqlUtils db = new SqlUtils("Charon");
 
        try
        {
            DataTable dt = db.FillTable(sql);
 
            RadHtmlChart htmlChart = new RadHtmlChart();
            htmlChart.ID = "htmlChart";
            htmlChart.Width = Unit.Pixel(680);
            htmlChart.Height = Unit.Pixel(400);
 
            htmlChart.Legend.Appearance.Position = ChartLegendPosition.Bottom;
 
            htmlChart.PlotArea.XAxis.TitleAppearance.Text = "Date";
            htmlChart.PlotArea.YAxis.TitleAppearance.Text = "Units Sold";
 
            htmlChart.PlotArea.XAxis.MajorTickType = TickType.Outside;
 
            htmlChart.PlotArea.XAxis.MinorTickType = TickType.Outside;
 
            //htmlChart.PlotArea.XAxis.DataLabelsField = row["OrderDate"].ToString();
 
 
 
            foreach (DataRow row in dt.Rows)
            {
                var lineSeries = new LineSeries { Name = row["Name"].ToString() };
 
 
                lineSeries.LabelsAppearance.Visible = true;
                lineSeries.TooltipsAppearance.Color = System.Drawing.Color.White;
                lineSeries.TooltipsAppearance.DataFormatString = string.Format("{0} x {1}", row["UnitsSold"], row["Name"]);
                lineSeries.DataFieldY = "UnitsSold";
                lineSeries.DataFieldX = "OrderDate";
 
                //SeriesItem seriesItem = new SeriesItem();
 
                var unitsSold = (int)row["UnitsSold"];
 
                //lineSeries.SeriesItems.Add(unitsSold);
 
                CategorySeriesItem seriesItem1 = new CategorySeriesItem();
 
                seriesItem1.Y = unitsSold;
 
                lineSeries.SeriesItems.Add(seriesItem1);
 
                htmlChart.PlotArea.Series.Add(lineSeries);
 
            }
 
 
 
            HtmlChartHolder.Controls.Add(htmlChart);
 
            //LineChart.DataSource = trendAnalysisbyDate(1);
            //LineChart.DataBind();
        }
        finally
        {
            db.Close();
        }



Example Data & how the chart currently looks is attached...

I've just hidden the Name column.. just a text string..

I want the chart to show Units Sold on the left (y axis) and the order date on the bottom (x axis) and the product name to the be label/ledgend..

Any help would be great. Thanks!



Shinu
Top achievements
Rank 2
 answered on 25 Aug 2014
2 answers
386 views
Hi,
I am working on a menu using a RadGrid. developing in C#

I have a MasterTableView that contains the Main information, and one GridTableView in DetailTables. (Check menu attach file)
Once I click the expanded icon on then master table, the grid table view is displayed.

I am looking at selecting a record on the GridTableView (by clicking on the record) to open a form.

However the OnSelectedIndexChanged is not firing.
So I don't know if it should be set up diferently when in a GridTableView (as it is working if I put the event in the RadGrid at a higher level)
Or if I should use another event.

This is how I have set it up (Check html file attached for more details):
- EnablePostBackOnRowClick="true" in the Client settings of the RadGrid.
- OnSelectedIndexChanged="GV_SelectedIndexChanged" set up in the GridTableView, and the C# code added accordingly.

Thank you for your help.

Anne
Anne
Top achievements
Rank 1
 answered on 25 Aug 2014
0 answers
136 views
 
hello 

I am using Telerik ReportViewer to display reports,
But when I print report ,it  exports to pdf instead of printing. as shown in attached image.



please help.
Kishor
Top achievements
Rank 2
 asked on 25 Aug 2014
3 answers
234 views
Hello,

Is there any client API or mechanism that can be used to configure RADEditor MaxTextLength property dynamically in the Client code (JavaScript)? I need to control maximum number of characters should be allowed to enter into editor (single instance) depending on context option (jquery) selected by the user. For example, 200 characters for legend but 1000 characters for reference etc.

Thanks,
Chuck
Shinu
Top achievements
Rank 2
 answered on 25 Aug 2014
1 answer
127 views
Dear Team,

I have 3 controls. First one is textbox, second is AsyncUpload and Third is textbox  again. Initially we are focusing on textbox1 and enter 'Tab' button from keyboard focusing on AsyncUpload Control and when i again click on 'Tab' from keyboard it needs to focus on textbox2 where as it is happening on double tab from keyboard.

Please let me know how i can solve this issue.

Thanks and Regards,
Rajender.A
Princy
Top achievements
Rank 2
 answered on 25 Aug 2014
1 answer
91 views
Hi Telerik Team,

I has been working with Telerik Controls for the last months and there is something that still I can't feel as something good. When I create the Local Resource (resx) file for my aspx page, a lot of tags are added to the aspx, and of course a lot of local resources entries in the resx file. I do understand the entries created on resx file, but the number of tags become kind on insane in the aspx file, for example for a simple RadTextBox that was originally like this:

<telerik:RadTextBox ID="ttxtFirstName" runat="server" Width="100%" ></telerik:RadTextBox>
(I do not define Skin as it is set on web.config for all the telerik controls)

And after creating the local resource my aspx ends like this:

<telerik:RadTextBox ID="ttxtFirstName" runat="server" Width="100%" 
                                    LabelCssClass="" LabelWidth="64px" 
                                    meta:resourcekey="ttxtFirstNameResource1" Resize="None" 
                                    ResolvedRenderMode="Classic">
                                    <EmptyMessageStyle Resize="None" />
                                    <ReadOnlyStyle Resize="None" />
                                    <FocusedStyle Resize="None" />
                                    <DisabledStyle Resize="None" />
                                    <InvalidStyle Resize="None" />
                                    <HoveredStyle Resize="None" />
                                    <EnabledStyle Resize="None" />
                                </telerik:RadTextBox>

So, as you can see a lot of tags (and lines, because each tag is using one line of code) are generated and if you ask me, it doesn't look simple and even can break the low "beauty" of the code that we can have.

Is this completely necessary?, when a local resource for a ASP.NET textbox is generated the only thing added to our code is the metarsourcekey. Is there a way to create the local resource different from using option inside Tools Menu that could be used to avoid this?

I will leave aside the number of entries generated in resx file, just cause those can be ignored or removed. But what bothers me is to mess up with the code, even if it is the aspx file.

Consider that we could have very long forms where the number of controls can be large and adding around 10 lines per each control is not pretty. Hope that you could share a solution.

Regards,

Oscar Ramirez




Ianko
Telerik team
 answered on 25 Aug 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?