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

I want to display Line Chart Programmatically. I do not want to display anything on X-Axis. I want to display some integer values on Y-Axis. By using the below code Line chart is getting displayed but some series are not fully getting displayed.

I am using dataTable (dt) to bind the chart.
Below are the two different approaches.

With first approach, i am getting the series in chart, but which is not using full length of x-axis irrespective of series item data for each series.

With second approach, i am not able to view the series in the chart. In order to resolve the issue with first approach, i also tried this second approach.

if (dt != null && dt.Rows.Count > 0)
{
    //First approach STARTS
    RadChartBiddingLineGraph.DefaultType = Telerik.Charting.ChartSeriesType.Line;
    RadChartBiddingLineGraph.PlotArea.YAxis.AutoScale = false;
    RadChartBiddingLineGraph.PlotArea.YAxis.AddRange(Convert.ToInt32(dt.Rows[0][3]), Convert.ToInt32(dt.Rows[0][4]), 10);
    RadChartBiddingLineGraph.DataGroupColumn = "Hotel";
    RadChartBiddingLineGraph.DataManager.ValuesYColumns = new String[] { "RateValue" };
    RadChartBiddingLineGraph.DataSource = dt;
    RadChartBiddingLineGraph.DataBind();
    foreach (Telerik.Charting.ChartSeries series in RadChartBiddingLineGraph.Series)
    {
        series.Appearance.LabelAppearance.Visible = false;
        RadChartBiddingLineGraph.PlotArea.XAxis.Appearance.LabelAppearance.Visible = false;
    }
    //First approach ENDS
 
 
    //Second approach STARTS
    DataTable dt2 = new DataTable();
    // Get the distinct records. HERE dt1 is the table in which there are all records(which are retrieved from SP)
    dt2 = dt.DefaultView.ToTable(true, dt.Columns[0].ColumnName);
    int s = 0;
    RadChartBiddingLineGraph.PlotArea.YAxis.AutoScale = false;
    RadChartBiddingLineGraph.PlotArea.YAxis.AddRange(120, 185, 5);
    foreach (DataRow item in dt2.Rows) //dt2 is the datatable in if have now distinct AuctionInviteIDs
    {
        //just get the data on basis of AuctionInviteId
        //if want the result in datatable
        DataTable dtFilteredTable = (from a in dt.AsEnumerable()
                                     where a.Field<Int32>("AuctionInviteID").Equals(item["AuctionInviteID"])
                                     select a).CopyToDataTable();
        ChartSeries chartSeries = new ChartSeries();
        chartSeries.Name = s.ToString();
        RadChartBiddingLineGraph.AddChartSeries(chartSeries);
        chartSeries.Type = ChartSeriesType.Line;
 
        foreach (DataRow item2 in dtFilteredTable.Rows)
        {
            chartSeries.AddItem(Convert.ToInt32(item2["RateValue"]));
            //RadChartBiddingLineGraph.Series[s].AddItem(Convert.ToInt32(item2["RateValue"]));
        }                                       
        RadChartBiddingLineGraph.Series.Add(chartSeries);
        s = s + 1;                                   
    }
    RadChartBiddingLineGraph.DataGroupColumn = "Hotel";
    RadChartBiddingLineGraph.DataSource = dt;
    RadChartBiddingLineGraph.DataBind();
 
    foreach (Telerik.Charting.ChartSeries series in RadChartBiddingLineGraph.Series)
    {
        series.Appearance.LabelAppearance.Visible = false;
        RadChartBiddingLineGraph.PlotArea.XAxis.Appearance.LabelAppearance.Visible = false;
    }
    //Second approach ENDS
 
}

With first approach, i am getting the graph "Result.jpg" as in the attachment, which is not using the full length of x-axis for each series.
I need the graph to be displayed as in "Approach-1.jpg" attachment, which uses the full length of x-axis for each series.

Your help would be appreciated.

Peshito
Telerik team
 answered on 01 Oct 2012
4 answers
124 views
I am looking for some way to display a progress bar for a survey.  The progress would increase with each question completed.  I see a RadProgressArea tool in the list but I can't figure out how to use it for this purpose.  Any suggestion to point me in the right direction would be greatly appreciated.
Peter Filipov
Telerik team
 answered on 01 Oct 2012
1 answer
199 views
Hi, I have a problem when I try to use the radwindow (confirm or alert) with javascript, please help me!

Here is my code:

function ShowOverCash() {
  var strOver = "";
  strOver = $("#<%=hdMsg.ClientID%>").attr("innerHTML");
  //alert(strOver);
  //var oConfirm = radconfirm(strSobreGiro, "aprSobreGiro", 700, 350, null, "La solicitud presenta Sobregiro");
 
  var oConfirm = radalert("hello", "aprSobreGiro");
}
 
function aprSobreGiro(arg) { 
  alert(arg);
  return false;
}

I have commented thr original code for test, but doesn't work.

when the program call the function ShowOverCash, fire a Error like this:
 Microsoft JScript runtime Error: can´t get the property value from '_visibilityMode': the object is undefined or null 

Marin Bratanov
Telerik team
 answered on 01 Oct 2012
3 answers
276 views
I need to add GridHeaderItem just like the way it is done in this link with the GridView
http://csharpdotnetfreak.blogspot.com/2008/11/merging-gridview-headers-to-have.html

Here's the part of the code from the link:
protected void grvMergeHeader_RowCreated
(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
    GridView HeaderGrid = (GridView)sender;
    GridViewRow HeaderGridRow =
    new GridViewRow(0, 0, DataControlRowType.Header,
    DataControlRowState.Insert);
    TableCell HeaderCell = new TableCell();
    HeaderCell.Text = "Department";
    HeaderCell.ColumnSpan = 2;
    HeaderGridRow.Cells.Add(HeaderCell);

    HeaderCell = new TableCell();
    HeaderCell.Text = "Employee";
    HeaderCell.ColumnSpan = 2;
    HeaderGridRow.Cells.Add(HeaderCell);

    grvMergeHeader.Controls[0].Controls.AddAt
    (0, HeaderGridRow);

}
}

I tried on my own up to this point but with no sucess. MyRadGrid is the name of the RadGrid.

 

 

protected

void RollUpDataRadGrid_ItemCreated(object sender, GridItemEventArgs e)

 

{

 

if (e.Item is GridHeaderItem)

 

{

 

RadGrid HeaderGrid = (RadGrid)sender;

 

 

GridHeaderItem headerItem = new GridHeaderItem(MyRadGrid.MasterTableView, 0, 0);

 

 

TableCell headerCell = new TableCell();

 

headerCell.Text =

"Department";

 

headerCell.ColumnSpan = 2;

headerItem.Cells.Add(headerCell);

headerCell =

new TableCell();

 

headerCell.Text =

"Employee";

 

headerCell.ColumnSpan = 2;

headerItem.Cells.Add(headerCell);

MyRadGrid.Controls[0].Controls.AddAt(0, headerItem);

}

}

 

 

 

 

I will appreciate if anyone has some inputs to it.

Thanks,
Raju
Tsvetoslav
Telerik team
 answered on 01 Oct 2012
6 answers
550 views
I have a fixed position div that is always at the bottom of my page.  Inside that is a RadComboBox with around 30 items.  Sometimes it expands upwards, sometimes it expands downwards and so out of view and unusable. 

How can I force the RadComboBox to always expand upwards?

Thanks.
Vivek
Top achievements
Rank 1
 answered on 01 Oct 2012
1 answer
78 views
Hi,
I need create chart with possibiliti to display pictures below x-axis line in 2 (or more) rows. In sample picture you can see 2 rows 'act' and 'fcst'. The pictures should be displayed for each hour depends on data .
Is it possible in RadChart (or any different Telerik charts?)
Regards.
Leszek
Vladimir Milev
Telerik team
 answered on 01 Oct 2012
4 answers
486 views
I am Fresher and also very new to telerik,so
Is their any good site or tutorial to learn telerik control self from basic
Thank U
Kate
Telerik team
 answered on 01 Oct 2012
1 answer
111 views
I am following the post to do Automatic CRUD operation on rad grid using Entity Framework by using:
http://demos.telerik.com/aspnet-ajax/grid/examples/automaticoperations/efdatabinding/defaultvb.aspx

My code for Design Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Demo.aspx.cs" Inherits="Telerik.Demo" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <style type="text/css">
        .MyImageButton
        {
            cursor: hand;
        }
        .EditFormHeader td
        {
            font-size: 14px;
            padding: 4px !important;
            color: #0066cc;
        }
    </style>
</head>
<body class="BODY" style="background-color: Black">
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="EntityDataSource1" GridLines="None"
            AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
            AllowAutomaticDeletes="True" AllowSorting="True" Width="750px" OnItemCreated="RadGrid1_ItemCreated"
            CellSpacing="0" Skin="Black">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <ClientSettings>
                <Selecting CellSelectionMode="None"></Selecting>
            </ClientSettings>
            <MasterTableView DataSourceID="EntityDataSource1" AutoGenerateColumns="False" DataKeyNames="ID"
                CommandItemDisplay="Top">
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                </RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID"
                         MaxLength="5">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
                        UniqueName="Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Address" HeaderText="Address" SortExpression="Address"
                        UniqueName="Address">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DeptID" HeaderText="DeptID" SortExpression="DeptID"
                        UniqueName="DeptID">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
                </Columns>
                <EditFormSettings>
                    <EditColumn ButtonType="ImageButton" />
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=Entity"
            DefaultContainerName="Entity" EnableDelete="True" EnableFlattening="False" EnableInsert="True"
            EnableUpdate="True" EntitySetName="EMPLOYEEs" EntityTypeFilter="EMPLOYEE">
        </asp:EntityDataSource>
    </div>
    </form>
</body>
</html>

Code Behind Page:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;


namespace Telerik
{
    public partial class Demo : System.Web.UI.Page
    {
        Entity ent = new Entity();
        EMPLOYEE emp = new EMPLOYEE();
        protected void Page_Load(object sender, EventArgs e)
        {  
                RadGrid1.DataSourceID = null;
                BindGrid();
        }

        public void BindGrid()
        {
                var query5 = from employee in ent.EMPLOYEEs
                             select new
                             {
                                 ID = employee.ID,
                                 NAME = employee.NAME,
                                 ADDRESS = employee.ADDRESS,
                                 DEPTID = employee.DEPTID
                             };
                RadGrid1.DataSource = query5;
        }

        protected void RadGrid1_ItemCreated(object sender, Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                if (!(e.Item is GridEditFormInsertItem))
                {
                    GridEditableItem item = e.Item as GridEditableItem;
                    GridEditManager manager = item.EditManager;
                    GridTextBoxColumnEditor editor = manager.GetColumnEditor("ID") as GridTextBoxColumnEditor;
                    editor.TextBoxControl.Enabled = false;
                }
            }
        }

        protected void gv1_NeedDataSource(object sender, Web.UI.GridNeedDataSourceEventArgs e)
        {
            BindGrid();
        }
    }
}

while execution it does nothing,only grid is displayed without any of the CRUD operation
Plz Help,
Thanks
Andrey
Telerik team
 answered on 01 Oct 2012
2 answers
125 views
I have a radgrid that when the page loads all items are in edit mode. When I click to go to the next page all of the items on the next page aren't in edit mode. :( I gave to click "edit" for each item. I'd like for the next page to go into edit mode too.

This is what I'm using to get it into edit mode, which works for the first page.

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        LinkButton lnkBtnDelete = (LinkButton)item["AutoGeneratedDeleteColumn"].Controls[0];
        lnkBtnDelete.Attributes["onclick"] = "javascript:return confirm(\'Do you want to delete this item?\')";
    }
    if (!Page.IsPostBack && e.Item is GridEditableItem)
    {
        e.Item.Edit = true;
    }
 
}

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        foreach (GridItem item in RadGrid1.MasterTableView.Items)
        {
            if (item is GridEditableItem)
            {
                GridEditableItem editableItem = item as GridDataItem;
                editableItem.Edit = true;
            }
        }
        RadGrid1.Rebind();
    }
}



Kee Fai Foong
Top achievements
Rank 1
 answered on 30 Sep 2012
1 answer
164 views
Hi,

I have a grid with a lot of data.  I notice that when I add a new row it load the grid and presents the editable section at the very end of the grid pagination.  This increases the amount of time required to add a record.  Whenever we are adding a record we are doing so on the first page so it is most desirable to have the insert happen in the 1st position instead of having to reload the grid and go to the end.  Hope that make sense and how can I accomplish this.

Thanks

Eric
Jayesh Goyani
Top achievements
Rank 2
 answered on 30 Sep 2012
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?