Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
173 views
I have a treeview that is built on demand. When the user expands a node, that branch is dynamically built. The ExpandMode is set to "TreeNodeExpandMode.ServerSide." The problem I am having is that when the user clicks to expand a node, the page does a postBack and the window is refreshed with the top of the tree being displayed. The user will then have to scroll down to the node that they expaned to see the rest of the branch. I want the page to scroll to the last expanded node the user clicked on. I tried getting the selected node using var selectedNode = tree.get_selectedNode() but that returns null because the user has not actually selected a node. They have only expanded a node.  How can I do this if the treeview.SelectedNode has no setter?

Can someone help me? Can you please provide some sample code?
Plamen
Telerik team
 answered on 22 May 2012
1 answer
82 views
First of all, I would like to appreciate Telerik Team for supporting our critical requirement development.

  OK Coming to point.

I have to display some XY axis radchart to the user.
X-Axis values varies between -400 and +400 Or -1 and +1 (depends on data coming this X-axis value might varies)
Y-Axis values varies between 1 and +1000 (depends on data coming this X-axis value might varies)

Once user click on btnGetChartResult then I would like to show overview of the chart as attached (chart view issue due to number of x-axis scale points.png), In this chart let assume I have X-axis points from -400 to +400 (critical scenario)

If the User wants to see each and every X-axis point with their Y-axis aligned data, Then I would like to give a Zoom in option to see, Then the screen should looks like as attached(chart view issue due to number of x-axis scale points1.png).

Issue we are having with below code, If the user click on btnGetChartResult then the results are as attached(Chart display for on one 1Xaxis point.png).

Issue 1.If the chart has only 1 x-axis for whole chart, its showing zoomed view with scroll option.
Issue 2.Even If the chart has the points between -400 and +400, firstly I would like to show the chart without zoom, if the user wants, he can zoom-in the chart.
Issue 3.Even If am working with below code, sometimes it is showing various behavior in showing the data on chart, to get perfect results some times we are refreshing the chart by clicking on btnGetChartResult,

Please let me know, Where am making mistakes.
Your Help is greatly appreciated!

Thank You Very Much Telerik Team.
Satish



Chart.Aspx

<telerik:RadPageView ID="rpvCapacityTimeliness" runat="server">
                            <div style="padding: 5px; text-align: left;">
                                <asp:UpdatePanel ID="updCapacityTimeliness" runat="server" RenderMode="Inline" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <p>
                                            <telerik:RadChart AutoLayout="True" Height="450px" ID="CapacityRadChart" runat="server" Skin="WebBlue" Width="935px">
                                                <ClientSettings EnableZoom="True" ScrollMode="Both" XScale="10" />
                                                <Appearance>
                                                    <FillStyle MainColor="249, 250, 251">
                                                    </FillStyle>
                                                    <Border Color="160, 170, 182" />
                                                </Appearance>
                                                <Legend Visible="False">
                                                    <Appearance Dimensions-Margins="17.6%, 3%, 1px, 1px" Dimensions-Paddings="2px, 8px, 6px, 3px"
                                                        Position-AlignedPosition="TopRight" Visible="False">
                                                        <ItemTextAppearance TextProperties-Color="102, 102, 102">
                                                        </ItemTextAppearance>
                                                        <FillStyle MainColor="216, 222, 227">
                                                        </FillStyle>
                                                        <Border Color="160, 170, 182" />
                                                    </Appearance>
                                                </Legend>
                                                <PlotArea>
                                                    <YAxis AutoScale="True" AxisMode="Extended">
                                                        <Appearance Color="160, 160, 160">
                                                            <MajorGridLines Color="227, 227, 227" />
                                                            <MinorGridLines Color="227, 227, 227" />
                                                            <TextAppearance AutoTextWrap="False" />
                                                        </Appearance>
                                                        <AxisLabel>
                                                            <TextBlock>
                                                                <Appearance TextProperties-Color="140, 140, 140">
                                                                </Appearance>
                                                            </TextBlock>
                                                        </AxisLabel>
                                                    </YAxis>
                                                    <EmptySeriesMessage Visible="True">
                                                        <Appearance Visible="True">
                                                        </Appearance>
                                                    </EmptySeriesMessage>
                                                    <XAxis AutoScale="True" >
                                                        <Appearance Color="160, 160, 160">
                                                            <MajorGridLines Color="227, 227, 227" Width="0" />
                                                            <TextAppearance AutoTextWrap="True" TextProperties-Color="140, 140, 140" />
                                                        </Appearance>
                                                        <AxisLabel>
                                                            <TextBlock>
                                                                <Appearance TextProperties-Color="140, 140, 140">
                                                                </Appearance>
                                                            </TextBlock>
                                                        </AxisLabel>
                                                    </XAxis>
                                                    <Appearance Dimensions-Margins="18%, 24%, 12%, 10%">
                                                        <FillStyle FillType="Solid" MainColor="">
                                                        </FillStyle>
                                                    </Appearance>
                                                </PlotArea>
                                                <ChartTitle>
                                                    <Appearance>
                                                        <FillStyle MainColor="">
                                                        </FillStyle>
                                                    </Appearance>
                                                    <TextBlock Text="Capacity Timeliness">
                                                        <Appearance TextProperties-Color="102, 102, 102" TextProperties-Font="Arial, 14pt">
                                                        </Appearance>
                                                    </TextBlock>
                                                </ChartTitle>
                                            </telerik:RadChart>
                                        </p>
                                        </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                    </telerik:RadPageView>





Chart.Aspx.Vb


Private Sub ChartLoad(ByRef ds As DataSet, ByRef radchartcontrole As RadChart, ByRef monthlyradchartcontrole As RadChart, ByRef dataXColumnName As String, ByRef dataYColumnName As String,
                                                   ByRef xaxislableName As String, ByRef yaxislableName As String, ByRef monthlyXaxislableName As String, ByRef monthlyYaxislableName As String,
                                                   ByRef monthlyYaxisDataColumn As String, ByRef monthlyXaxisDataColumn As String, ByRef avgDataColumn As String, ByRef charttableValue As Int32,
                                                   ByRef monthlytableValue As Int32, ByRef avgTableValue As Int32, ByRef chartTitle As String, ByRef updatePaneltoHide As UpdatePanel, ByRef timeLinesAvgLabel As String)
                
            Dim dt As DataTable = New DataTable()
            dt = ds.Tables.Item(0)

    If Not ds.Tables(0).Rows.Count > 0 Then
            updatePaneltoHide.Visible = False
            lblAvgDisplay.Text = "No Data Found for the " + chartTitle
            lblAvgDisplay.ForeColor = System.Drawing.Color.Red
            lblAvgDisplay.Font.Bold = True
            lblAvgDisplay.Width = 300

    Else

            dt = ds.Tables.Item(0)

            Dim list As New List(Of StressClass)

            For Each dr As DataRow In dt.Rows
                Dim sc As New StressClass()
                sc.Count = Convert.ToInt32(dr(dataYColumnName))
                sc.CapacityTimeliness = Convert.ToInt32(dr(dataXColumnName))
                list.Add(sc)
            Next

            Dim series As New ChartSeries()
            series.Type = ChartSeriesType.Bar
            series.DataXColumn = dataXColumnName
            series.DataYColumn = dataYColumnName

            radchartcontrole.Clear()

            radchartcontrole.Series.Add(series)
            radchartcontrole.DataSource = list
            radchartcontrole.DataBind()

            radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Text = xaxislableName
            radchartcontrole.PlotArea.XAxis.AxisLabel.Visible = True
            radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
            radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

            radchartcontrole.PlotArea.YAxis.AxisLabel.Visible = True
            radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Text = yaxislableName
            radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
            radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

            radchartcontrole.Series(0).Appearance.BarWidthPercent = CType("10", Decimal)
    
            Dim metricsAvg As String
            metricsAvg = CType(ds.Tables(avgTableValue).Rows(0).Item(avgDataColumn), String)
            radchartcontrole.ChartTitle.TextBlock.Visible = False
            radchartcontrole.Legend.Visible = false

            'Metrics Avg label display
            lblAvgDisplay.Text = timeLinesAvgLabel + metricsAvg + "days"
            lblAvgDisplay.Visible = true
            lblAvgDisplay.Font.Bold = True
            lblAvgDisplay.ForeColor = System.Drawing.Color.Red

            'Binding the monthly chart data
            monthlyradchartcontrole.Clear()
            monthlyradchartcontrole.DataSource = ds.Tables.Item(monthlytableValue)
            monthlyradchartcontrole.DataBind()
            monthlyradchartcontrole.Series(0).DataXColumn = monthlyYaxisDataColumn
            monthlyradchartcontrole.Series(0).DataYColumn = monthlyXaxisDataColumn

            monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Text = monthlyXaxislableName
            monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.Visible = True
            monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
            monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

            monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.Visible = True
            monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Text = monthlyYaxislableName
            monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
            monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

            monthlyradchartcontrole.Legend.Visible = false

    End If

    End Sub


Public Class StressClass
        Private _count As Integer
        Public Property Count() As Integer
            Get
                Return _count
            End Get

            Set(ByVal value As Integer)
                _count = value
            End Set
        End Property

        Private _capacityTimeliness As Integer
        Public Property CapacityTimeliness() As Integer
            Get
                Return _capacityTimeliness
            End Get
            Set(ByVal value As Integer)
                _capacityTimeliness = value
            End Set
        End Property
    End Class
Ves
Telerik team
 answered on 22 May 2012
5 answers
94 views
RadTabStrip -
Does ASP.NET AJAX RadTabStrip allow overflow with TabItemsDropDown as shown in the below link for WinForms? or is there any workaround to do the same?
http://www.telerik.com/help/winforms/tabstrip-radtabstrip-scrolling-and-overflow.html



Regards
Sachin
Kate
Telerik team
 answered on 22 May 2012
4 answers
116 views
Hi there,
      Im working on a collection of data in a grid. I want to set the first row of the grid selected on page-load. If anyone got any ideas please be kind enough to share.

Thanks
Savyo
Shinu
Top achievements
Rank 2
 answered on 22 May 2012
1 answer
148 views
Hey Guys,
I'm hoping you can help me out here with some ugly ajavscript errors I'm getting.
I have a usercontrol which houses an asyncupload control for uploading an image and displaying a preview.
The control works great when inserted into a page stand-alone.  Even several side by side work great.

I now have the need to dynamically load in a variable number of these into a second control according to some configuration logic.
They are added to a placeholder and reloaded with every postback to stop them disappearing.

I am testing with two controls being loaded in.  They appear to load in fine, but only one will work correctly.  Which one works depends on which you use first.  Either one, stays functional until you try and use the second, which then gives the following javascript errors as soon as you click on a file in the file chooser and try to open:

w.Content is undefined
[Break On This Error]  
 
w.Content.Page.MarshalUploads();
 
Teleri...e2c54c1 (line 30193)
Unhandled Error in Silverlight Application Failed to Invoke: _onFilesSelected. at System.Windows.Browser.ScriptObject.Invoke(String name, Object[] args) at UploadPrototype.EventManager.FilesSelected(Int32 filesCount) at UploadPrototype.MainPage.OpenDialog() at UploadPrototype.MainPage.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

Here is the source of the controls being loaded:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ImageUploader.ascx.cs" Inherits="ArtsHub.Controls.ImageUploader" %>
<telerik:RadAjaxPanel ID="rapImageUpload" runat="server" LoadingPanelID="alpLoadingPanel" RenderMode="Inline">
    <telerik:RadBinaryImage ID="imgMainImage" runat="server" ResizeMode="Fit" />
    <telerik:RadAsyncUpload ID="rauMainImage" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" OnFileUploaded="rauMainImage_FileUploaded" />
</telerik:RadAjaxPanel>
<telerik:RadAjaxLoadingPanel ID="alpLoadingPanel" runat="server" />
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
 
    function <%= this.ClientID %>_ClientFileUploaded(sender, eventArgs) {
       var rap = $find("<%= rapImageUpload.ClientID %>");
       rap.ajaxRequest();
    }
 
 
</script>
</telerik:RadCodeBlock>

And the code behind :

public partial class ImageUploader : System.Web.UI.UserControl
{
 
    public RadAsyncUpload UploaderControl { get { return rauMainImage; } }
    public RadBinaryImage BinaryImageControl { get { return imgMainImage; } }
    public Images.ImageFactory.ImageTypes ImageType { get; set; }
    public Globals.SectionIds SectionId { get; set; }
    public string ImageURL { get; set; }
    public int Width { get; set; }
    public int Height { get; set; }
    public string[] AllowedFileExtensions { get; set; }
 
    protected void Page_Init(object sender, EventArgs e)
    {
        UploaderControl.OnClientFileUploaded = this.ClientID + "_ClientFileUploaded";
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
 
            //rauMainImage.AllowedFileExtensions = AllowedFileExtensions;
        }
 
        // Get Preview Image
        if (imgMainImage.DataValue == null && ImageURL != "" && ImageURL != null)
        {
            imgMainImage.ImageUrl = ImageURL;
            imgMainImage.Width = System.Web.UI.WebControls.Unit.Pixel(Width);
            imgMainImage.Height = System.Web.UI.WebControls.Unit.Pixel(Height);
        }
 
    }
 
 
    protected void rauMainImage_FileUploaded(object sender, FileUploadedEventArgs e)
    {
        try
        {
            if (e.IsValid)
            {
                imgMainImage.Width = System.Web.UI.WebControls.Unit.Pixel(Width);
                imgMainImage.Height = System.Web.UI.WebControls.Unit.Pixel(Height);
 
                // Update preview
                using (Stream stream = e.File.InputStream)
                {
                    byte[] imageData = new byte[stream.Length];
                    stream.Read(imageData, 0, (int)stream.Length);
                    imgMainImage.DataValue = imageData;
                    imgMainImage.AlternateText = e.File.FileName;
                }
 
                // Do upload
                IListing thisItem;
 
                switch (SectionId)
                {
                    case Globals.SectionIds.News:
                        thisItem = ContentMain.GetContentMain(ContentMain.GetContentId);
                        break;
                    case Globals.SectionIds.Jobs:
                        thisItem = Job.GetJob(Job.GetJobId);
                        break;
                    case Globals.SectionIds.Classifieds:
                        thisItem = null;
                        break;
                    case Globals.SectionIds.Events:
                        thisItem = null;
                        break;
                    case Globals.SectionIds.MembersResumes:
                        thisItem = MemberResume.GetMemberResume(MemberResume.GetMemberResumeId, null, true);
                        break;
                    case Globals.SectionIds.Directory:
                    default:
                        thisItem = null;
                        break;
 
                }
 
                thisItem.UploadListingImage(e.File, ImageType);
            }
        }
        catch (Exception ex)
        {
            BLL.Emailing.Emailing.EmailBug("Error in ImageUploader.rauMainImage_FileUploaded!", "Section" + SectionId.ToString() + "<br>Error:" + ex.Message.ToString());
        }
 
 
    }
 
}

Any help is greatly appreciated.

Thanks
Peter Filipov
Telerik team
 answered on 22 May 2012
1 answer
56 views

I want to read the Header text of child grid and then use it in displaying alert for specific row.
Below is my codeBehind Code:

Telerik.Web.UI.GridColumn col = null;
            col = rgdLabTest.MasterTableView.DetailTables[0].Columns.FindByUniqueNameSafe("StartAge");
            if (col != null)
            {
                StartAgeCaption = col.HeaderText;
            }

         And in javascript i am using:
if (document.getElementById(id) != null && document.getElementById(id).value == "") {
                    var control = $("#" + id + "_text");
                    var message = '<%=BariAnalyticsEHR.Utility.ContentFetcher.GetValidationMessage("MANDATORY_1", BariAnalyticsEHR.BOL.Classes.EHRSessions.Culture)%>';
                    jAlert(message.replace("#caption#", "<%= StartAgeCaption %>"), control[0].id, null, function (r) {
                        if (r == true) {
                            $("#" + control[0].id).focus();
                        }
                    });
                    return false;
                }

StartAgeCaption value is assigend successfully in the codebehind but in javascript i am not getting that value. Its empty.

Vasil
Telerik team
 answered on 22 May 2012
6 answers
177 views
Hai,

I have grid with data which binds on page load. I have 7 tabs. On clicking the tabs, data in the grid should filter based on the value of a hidden column in the grid. I dont want the filter text box and user inputing the filter text. Is there any way to do it?

Thanks & regards,
Regeesh
pooja
Top achievements
Rank 1
 answered on 22 May 2012
1 answer
131 views
Hi to All,

am doing a web app in vs 2010. for this i want to use telerik controls.

am trying to install it. but am getting error while installation.

Error

unable to find a version of the runtime to run this app.

am getting a this error.plz tell me how to install it.
Petar
Telerik team
 answered on 22 May 2012
1 answer
101 views
Hi to All,

am doing a web app in vs 2010. for this i want to telerik controls.
am dwnloding radcontrols for asp.net from http://www.telerik.com/download-trial-file.aspx?pid=561 
while installing this exe am getting error.
but am getting error like this 

unable to find a version of the runtime to run this application.
how to resole it plz tell me 
Petar
Telerik team
 answered on 22 May 2012
7 answers
768 views
I want to clear all filter item values programatically when I click on certain buttons.  How can I achieve this?

Thanks!
Hari
Top achievements
Rank 1
 answered on 22 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?