Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
96 views
I have the following code :
<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
   </telerik:RadScriptManager>
  
   <div>
     <telerik:RadAjaxPanel ID="AjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1">
       <div style="float: left; margin: 38px 0s 0 120px; border: solid 1px grey; width: 300px;
           height: 152px;">
           <telerik:RadRotator ID="RadRotator1" runat="server" Width="220px" Height="135px"
               ItemHeight="135" ItemWidth="110" CssClass="positionCenter" ScrollDuration="500"
              >
              <WebServiceSettings Path="RotatorWebService.asmx" Method="GetRotatorData" />
           </telerik:RadRotator>
       </div>
        
   </telerik:RadAjaxPanel>
   </div>
   </form>

Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.Script.Services
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Web.UI
Imports Telerik.Web.UI
Imports System.Web.UI.WebControls
Imports System.IO
Imports System.Reflection
Imports System.Threading
Imports System.Xml
  
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class RotatorWebService
    Inherits System.Web.Services.WebService
  
    'Private data As DataTable
    Private itemCount As Integer = 5
  
    <WebMethod()> _
Public Function GetRotatorData(ByVal itemIndex As Integer) As RadRotatorItemData()
        If itemIndex >= 11 Then
            Return Nothing
        End If
        Dim result As New List(Of RadRotatorItemData)()
        Dim m_xmlr As XmlTextReader
        'Create the XML Reader
          
  
  
        For i As Integer = itemIndex To itemIndex + (itemCount - 1)
            Dim item As New RadRotatorItemData()
  
            m_xmlr = New XmlTextReader("C:\generated_files\bitems.xml")
            m_xmlr.WhitespaceHandling = WhitespaceHandling.None
            m_xmlr.Read()
  
            m_xmlr.Read()
  
            While Not m_xmlr.EOF
                m_xmlr.Read()
  
                If Not m_xmlr.IsStartElement() Then
                    Exit While
                End If
                Dim genderAttribute = m_xmlr.GetAttribute("book")
                m_xmlr.Read()
                Dim src = m_xmlr.ReadElementString("src")
                Dim link = m_xmlr.ReadElementString("link")
                Dim ii = m_xmlr.ReadElementString("i")
                If (ii = i) Then
                    Dim img As New Image()
                    Dim imgUrl As String = src
                    imgUrl = imgUrl.Replace("~/", HttpContext.Current.Request.ApplicationPath + "/").Replace("//", "/")
                    img.ImageUrl = imgUrl
  
                    img.Width = Unit.Pixel(110)
                    img.Height = Unit.Pixel(135)
                    Dim sw As New StringWriter()
                    Dim writer As New HtmlTextWriter(sw)
                    img.RenderControl(writer)
                    writer.Flush()
                    item.Html = sw.ToString()
                    result.Add(item)
                End If
            End While
            m_xmlr.Close()
  
  
             
        Next
        Return result.ToArray()
    End Function
  
End Class

and the error i get when i run the  page is attached as an image
Fiko
Telerik team
 answered on 25 Aug 2010
10 answers
134 views
I have a rotator that displays a list of stock quotes from a web service I have set up. This service acts as a proxy to an external, third party service that provides us with financial data.

Since our site is under development, I am using their test servers for data. This has revealed the problem with external services... everything comes to a screeching halt while waiting for data from the service. At worst, if the service times out, the page never loads at all. When everything is in production, we should not have these problems, but "should" is not good enough for me.

I've seen through other answers to questions that the Rotator does not support client-side loading. Since this control seems to be oriented towards the use of feeds, I would think that supporting some sort of asynchronous loading would be pretty high on the priority list.

Could you let us know if there are plans to support this... or is there a way to do this that I am overlooking?

Thanks! You guys rock :)
Fiko
Telerik team
 answered on 25 Aug 2010
12 answers
228 views
Good morning:

Has anyone found a good solution for remembering the parameters that were set in the last grid a user worked with?  We're using a pretty simple grid, with filtering, sorting, and paging enabled.  When a user clicks away from the grid page to edit a record on a different page for instance, we'd like to be able to load the page the next time they return to the same grid they were working with when they left, with the sorting, filtering, and paging applied correctly.

We do this with some custom repeater controls we built by using a series of querystring variables, which I guess we could do again here.  Any thoughts you guys have would be helpful.

Thanks; happy Good Friday.

Brad
Pavlina
Telerik team
 answered on 25 Aug 2010
0 answers
81 views
Hello Guys,
I encountred a diffcult spot usig RadScheduler.
I use the scheduler with two resources
    1. Users - a resource of 150 entries (its ok working with it)
    2. Clients - a resource 0f 13,000 entries

When Using the RadScheduler with the client  resource of 13,000 entries it slows down drastically  almost to a halt.
This preformence is unacceptable.
I tried using the advanced form and interfere in the resource control.ascx but it is very complicated there.
i have to use the users and clients as resources because i need grooping and reoccurence and alerts and all the  advanced features.

Did anyone incountered in such a problem? Does anyone  have any solution for that?


 Thanks,
Regards
 Eitan
Roni Lev
Top achievements
Rank 1
 asked on 25 Aug 2010
3 answers
144 views
HI,

I have a web page that dynamically loads RadTabs. The page has a master page. Each RadTab dynamically loads RadDock controls.  Each RadDock control dynamically loads a User Control.  I am attempting to both manually refresh each usercontrol and automatically refresh each usercontrol via a tImer.  After looking at the demos, I have a RadAjaxManager and an UpdatePanel on the web page.

In the first AjaxSetting section, the user control has a RadAjaxManagerProxy with a link button as the AjaxControlID.  The link button is supposed to refresh the user control.  All asp controls in the user control are supposed to be updated through AJAX.

The second section has an asp timer control as the AjaxControlId.  The timer has a timer event that is supposed to refresh the user control.  The radgrid in the user control is supposed to be refreshed in the timer event.

When either manually or automatically refreshing, the page gets a postback which displays all RadDocks.  The intent is solely to refresh the user control without refreshing the entire page.

Thanks,

Al

Web Page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default"
    MasterPageFile="~/loggedIn.master" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Src="~/UserControls/Gadget.ascx" TagName="Gadgets" TagPrefix="uc" %>
<asp:Content ID="ContentArea" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"/>
        <asp:UpdatePanel runat="server" ID="UpdatePanel1">
        <ContentTemplate>
            <div align="right"><asp:LinkButton ID="lbRefresh" Text="Refresh" runat="server"/></div>
            <telerik:RadTabStrip ID="rtsDockTabs" runat="server" MultiPageID="rmpDockTab"/>
            <telerik:RadMultiPage ID="rmpDockTab" runat="server" SelectedIndex="0"/>
        </ContentTemplate>
    </asp:UpdatePanel>
    <br />
    <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" />
</asp:Content>

Web Page Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Collections.Generic;
 
public partial class Default : System.Web.UI.Page
{
    private const string _createPage = "CreateGadget.aspx?Id=";
 
    private List<DockState> CurrentDockStates
    {
        get
        {
            //Store the info about the added docks in the session. For real life
            // applications we recommend using database or other storage medium
            // for persisting this information.
            //get data
            DataLayer.toReadGadgetsDataTable gadgets = DataAccess.GetGadgets(Users.UserInfo.UserId);
 
            List<DockState> currentDockStates = new List<DockState>();
 
            foreach (DataRow dr in gadgets.Rows)
            {
                DataLayer.toReadGadgetsRow row = dr as DataLayer.toReadGadgetsRow;
 
                currentDockStates.Add(CreateDockState(row));
            }
 
            return currentDockStates;
        }
        set
        {
            List<DockState> currentDockStates = value;
 
            foreach (DockState dockState in currentDockStates)
            {
                DockStateTag tag = new DockStateTag(dockState.Tag);
                //update gadget in db
                DataAccess.UpdateGadget(
                    int.Parse(dockState.UniqueName),
                    tag.SearchCriteria,
                    dockState.Title,
                    dockState.Index,
                    tag.DisplayRows
                    );
            }
        }
    }
 
    private void CreateSaveStateTrigger(RadDock dock)
    {
        //Ensure that the RadDock control will initiate postback
        // when its position changes on the client or any of the commands is clicked.
        //Using the trigger we will "ajaxify" that postback.
        dock.AutoPostBack = true;
        dock.CommandsAutoPostBack = true;
 
        AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "DockPositionChanged";
        UpdatePanel1.Triggers.Add(saveStateTrigger);
 
        saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "Command";
        UpdatePanel1.Triggers.Add(saveStateTrigger);
    }
 
    private RadDock CreateRadDockFromState(DockState state)
    {
        RadDock dock = new RadDock();
        dock.DockMode = DockMode.Docked;
        dock.ID = state.UniqueName;
        dock.ApplyState(state);
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        DockCommand dc1 = new DockCommand();
        dc1.AutoPostBack = true;
        dc1.Name = "Edit";
        dc1.Text = "Edit";
        dock.Commands.Add(dc1);
 
        dock.Command += new DockCommandEventHandler(dock_Command);
        return dock;
    }
 
    private DockState CreateDockState(DataLayer.toReadGadgetsRow row)
    {
        DockState dockState = new DockState();
        dockState.UniqueName = row.GadgetId.ToString();
        dockState.Title = row.Title;
        dockState.Width = Unit.Pixel(300);
        DockStateTag tag = new DockStateTag(row.SearchCriteria, row.DisplayRows, row.TabId, row.TabName);
        dockState.Tag = tag.Tag;
        dockState.Index = row.Rank;
        return dockState;
    }
 
    private void Initialize()
    {
        //add all tabs
        DataLayer.toReadTabsDataTable readTabsDataTable = DataAccess.GetTabs(Users.UserInfo.UserId);
        foreach (DataRow dr in readTabsDataTable.Rows)
        {
            DataLayer.toReadTabsRow row = (DataLayer.toReadTabsRow)dr;
            AddTab(row.Name, row.TabId);
            AddPageView(row.Name);
            CreateLayout(rmpDockTab.FindPageViewByID(row.Name));
        }
    }
 
    private void CreateLayout(RadPageView pageView)
    {
        //add raddocklayout
        RadDockLayout dockLayout = new RadDockLayout();
        dockLayout.ID = "rdlGadgets_" + pageView.ID;
        dockLayout.LoadDockLayout += new DockLayoutEventHandler(rdlGadgets_SaveDockLayout);
        dockLayout.SaveDockLayout += new DockLayoutEventHandler(rdlGadgets_SaveDockLayout);
 
        //add dock zone
        RadDockZone dockZone = new RadDockZone();
        dockZone.ID = "rdzGadgets_" + pageView.ID;
        dockZone.Orientation = Orientation.Horizontal;
        dockZone.Width = new Unit(100.0, UnitType.Percentage);
        dockZone.MinHeight =  new Unit(200);
 
        dockZone.Style["float"] = "left";
        dockZone.Style["margin-right"] = "20px";
 
        List<DockState> dockStates = CurrentDockStates;
        int count = dockStates.Count;
        for (int i = 0; i < count; i++)
        {
            RadDock dock = CreateRadDockFromState(dockStates[i]);
 
            DockStateTag tag = new DockStateTag(dock.Tag);
 
            //check which controls belong to this tab
            if (tag.TabName == pageView.ID)
            {
                //We will just add the RadDock control to the RadDockLayout.
                // You could use any other control for that purpose, just ensure
                // that it is inside the RadDockLayout control.
                // The RadDockLayout control will automatically move the RadDock
                // controls to their corresponding zone in the LoadDockLayout
                // event (see below).
 
                //load gadget control into dock
                UserControls_Gadget c = (UserControls_Gadget)LoadControl("~/UserControls/Gadget.ascx");
                c.ID = tag.TabName + "_Gadget" + i.ToString();
                c.DisplayRows = tag.DisplayRows;
                c.SearchCriteria = tag.SearchCriteria;
 
                dock.ContentContainer.Controls.Add(c);
 
                //add to doc zone
                dockZone.Controls.Add(dock);
 
                //We want to save the dock state every time a dock is moved.
                CreateSaveStateTrigger(dock);
            }
        }
 
        //add to layout
        dockLayout.Controls.Add(dockZone);
 
        //add to pageview
        pageView.Controls.Add(dockLayout);
    }
 
    private void AddTab(string tabName, int tabValue)
    {
        RadTab tab = new RadTab();
        tab.Text = tabName;
        tab.PageViewID = tabName;
        //tab.ID = "Tab_" + tabName;
        tab.Value = tabValue.ToString();
        rtsDockTabs.Tabs.Add(tab);
    }
 
    private void AddPageView(string id)
    {
        RadPageView pageView = new RadPageView();
        pageView.ID = id;
        rmpDockTab.PageViews.Add(pageView);
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        //on init, load all docks in this event so display will occur in sequence
        if (!IsPostBack)
        {
            //Initialize();
        }
    }
 
    protected void Page_Init(object sender, EventArgs e)
    {
        //on postback, initialize dock controls so they will display
        //if (IsPostBack)
        {
            Initialize();
        }
    }
 
    void dock_Command(object sender, DockCommandEventArgs e)
    {
        if (sender is RadDock)
        {
            RadDock radDock = sender as RadDock;
            switch (e.Command.Name)
            {
                case "Edit":
                    Response.Redirect(_createPage + radDock.UniqueName);
                    break;
                case "Close":
                    DataAccess.DeleteGadget(int.Parse(radDock.UniqueName));
                    break;
            }
        }
    }
 
    protected void rdlGadgets_LoadDockLayout(object sender, DockLayoutEventArgs e)
    {
        //Populate the event args with the state information. The RadDockLayout control
        // will automatically move the docks according that information.
        foreach (DockState state in CurrentDockStates)
        {
            e.Positions[state.UniqueName] = state.DockZoneID;
            e.Indices[state.UniqueName] = state.Index;
        }
    }
 
    protected void rdlGadgets_SaveDockLayout(object sender, DockLayoutEventArgs e)
    {
        //Save the dock state. This will enable us
        // to recreate the dock in the next Page_Init.
        CurrentDockStates = ((RadDockLayout)sender).GetRegisteredDocksState();
    }
 
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Response.Redirect(_createPage + "0");
    }
}

User Control

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Gadget.ascx.cs" Inherits="UserControls_Gadget" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnRefresh">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rgGadget" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
                <telerik:AjaxUpdatedControl ControlID="pnlNavigation" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
                <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
                <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
                <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
                <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="tmrRefresh">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rgGadget" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<telerik:RadGrid ID="rgGadget" runat="server" Skin="Telerik" ShowHeader="true" ShowStatusBar="false"
    ShowFooter="False" AllowMultiRowSelection="False" GridLines="none" AutoGenerateColumns="false"
    OnItemDataBound="rgGadget_ItemDataBound">
    <MasterTableView NoMasterRecordsText="No Records Found.">
    </MasterTableView>
    <HeaderStyle Width="250px" />
    <ItemStyle Wrap="true" Width="100px" />
    <AlternatingItemStyle BackColor="#F0F4F7" />
    <ItemStyle BackColor="white" />
</telerik:RadGrid>
<asp:Panel ID="pnlNavigation" runat="server">
    <table width="100%">
        <tr>
            <td>
                <asp:LinkButton ID="btnFirst" runat="server" Text="<<" OnClick="btnFirst_Click" /></td>
            <td>
                <asp:LinkButton ID="btnPrevious" runat="server" Text="<" OnClick="btnPrevious_Click" /></td>
            <td>
                <asp:LinkButton ID="btnNext" runat="server" Text=">" OnClick="btnNext_Click" /></td>
            <td>
                <asp:LinkButton ID="btnLast" runat="server" Text=">>" OnClick="btnLast_Click" /></td>
            <td align="right">
                <asp:LinkButton ID="btnRefresh" runat="server" Text="Refresh" OnClick="btnRefresh_Click" /></td>
        </tr>
    </table>
</asp:Panel>
<asp:Panel ID="pnlTimer" runat="server">
    <asp:Timer ID="tmrRefresh" runat="server" Interval="30000" OnTick="tmrRefresh_Tick" />
</asp:Panel>
User Control Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
 
public partial class UserControls_Gadget : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
 
    public int DisplayRows
    {
        get { return (int)ViewState["DisplayRows"]; }
        set { ViewState["DisplayRows"] = value; }
    }
 
    public string SearchCriteria
    {
        set
        {
            ViewState["SearchCriteria"] = value;
            ViewState["PageNumber"] = 0;
            Bind();
        }
    }
 
    public void Bind()
    {
        int numFound;
        DataTable searchEngine = SearchEngineFactory.GetSearchEngineData(
            ViewState["SearchCriteria"].ToString(),
            int.Parse(ViewState["PageNumber"].ToString()),
            int.Parse(ViewState["DisplayRows"].ToString()),
            out numFound);
 
        //add columns to grid
        rgGadget.Columns.Clear();
        for (int i = 2; i < searchEngine.Columns.Count; i++)
        {
            GridHyperLinkColumn  boundColumn = new GridHyperLinkColumn();
            this.rgGadget.MasterTableView.Columns.Add(boundColumn);
            boundColumn.HeaderText = searchEngine.Columns[i].ColumnName;
            boundColumn.DataTextField = boundColumn.HeaderText;
            boundColumn.UniqueName = boundColumn.HeaderText;
            boundColumn.DataNavigateUrlFields = new string[] { "URL" };
        }
 
        rgGadget.DataSource = searchEngine;
        rgGadget.DataBind();
 
        if (numFound > 0)
        {
            ViewState["NumFound"] = numFound;
            if ((int)ViewState["NumFound"] <= (int)ViewState["DisplayRows"])  //no paging necessary
            {
                pnlNavigation.Enabled = false;
            }
            else if ((int)ViewState["PageNumber"] == 0) //on first page
            {
                this.btnFirst.Enabled = false;
                this.btnPrevious.Enabled = false;
                this.btnNext.Enabled = true;
                this.btnLast.Enabled = true;
            }
            else if (((int)ViewState["PageNumber"] + 1) * (int)ViewState["DisplayRows"] >= (int)ViewState["NumFound"]) //last page
            {
                this.btnFirst.Enabled = true;
                this.btnPrevious.Enabled = true;
                this.btnNext.Enabled = false;
                this.btnLast.Enabled = false;
            }
            else
            {
                //in middle
                this.btnFirst.Enabled = true;
                this.btnPrevious.Enabled = true;
                this.btnNext.Enabled = true;
                this.btnLast.Enabled = true;
            }
        }
        else
        {
            pnlNavigation.Enabled = false;
        }
    }
    protected void btnFirst_Click(object sender, EventArgs e)
    {
        ViewState["PageNumber"] = 0;
        Bind();
    }
    protected void btnPrevious_Click(object sender, EventArgs e)
    {
        ViewState["PageNumber"] = (int)ViewState["PageNumber"] - 1;
        Bind();
    }
    protected void btnNext_Click(object sender, EventArgs e)
    {
        ViewState["PageNumber"] = (int)ViewState["PageNumber"] + 1;
        Bind();
    }
    protected void btnLast_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["DisplayRows"] > 0)
        {
            int lastPageNumber = (int)ViewState["NumFound"] / (int)ViewState["DisplayRows"];
            int pageNumberRemainder = (int)ViewState["NumFound"] % (int)ViewState["DisplayRows"];
            if (pageNumberRemainder > 0)
                lastPageNumber++;
            ViewState["PageNumber"] = lastPageNumber - 1;
            Bind();
        }
    }
 
    protected void btnRefresh_Click(object sender, EventArgs e)
    {
        Bind();
    }
    public void tmrRefresh_Tick(object sender, EventArgs e)
    {
        Bind();
    }
    protected void rgGadget_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            //get tooltip value
            DataTable dt = (DataTable)((RadGrid)sender).DataSource;
            int index = ((GridDataItem)e.Item).ItemIndex;
 
            string toolTip = dt.Rows[index]["ToolTip"].ToString();
            if (toolTip != String.Empty)
            {
                foreach (TableCell cell in e.Item.Cells)
                {
                    cell.ToolTip = toolTip;
                }
            }
        }
    }
}
Iana Tsolova
Telerik team
 answered on 25 Aug 2010
1 answer
92 views
When I put my chart into an asp:UpdatePanel, the main "chart" part of the rendered graphic appears offset from the "background" piece where the legend and everything is drawn. Without the UpdatePanel, it works as expected.

I've attached a screen shot of the anomaly. 

Any suggestions?

Thanks
Vladimir Milev
Telerik team
 answered on 25 Aug 2010
2 answers
57 views
Hi

Technically, this question is actually referring to the old classic ASP control (2007 Q3). We are in the process of upgrading, but it's a slow process.

I have a request to clear the content of the editor when the user adds a snippet. Now, since the snippet functionality is entirely handled by the editor, and we only have the toolsfile.xml to configure it, I'm not sure if this is possible. Unless, of cause, you expose an event which fires when the user adds a snippet.

If this functionality is not supported, it's ok. I just want to find out, so I can give a clear answer.

Thanks
Rumen
Telerik team
 answered on 25 Aug 2010
1 answer
83 views
Dear Team,

I draw the Chart in my application based On multiple Series type Chart .i get one series result is correct.but Other series are draw on lost x-axies values Based graph generate.All series are lost x -axies based value graph generated..

i attached my Sample Code.
 first,
1.Aspx page,
2.script for database table..
3.screen shot for my output..and i want output is marked on screen.

with Regards,
S.Kannadasan

cs code

using

 

System;

 

 

using

 

System.Collections;

 

 

using

 

System.Configuration;

 

 

using

 

System.Data;

 

 

using

 

System.Linq;

 

 

using

 

System.Web;

 

 

using

 

System.Web.Security;

 

 

using

 

System.Web.UI;

 

 

using

 

System.Web.UI.HtmlControls;

 

 

using

 

System.Web.UI.WebControls;

 

 

using

 

System.Web.UI.WebControls.WebParts;

 

 

using

 

System.Data.SqlClient;

 

 

using

 

Telerik.Charting;

 

 

using

 

System.Drawing;

 

 

public

 

partial class staggeredLine : System.Web.UI.Page

 

 

{

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

 

SqlConnection dbCon;

 

 

 

if (!Page.IsPostBack)

 

{

dbCon =

 

new SqlConnection(ConfigurationManager.ConnectionStrings["bheldevConnectionString"].ConnectionString);

 

dbCon.Open();

InitRadChart2(dbCon);

dbCon.Close();

}

}

 

 

private void InitRadChart2(SqlConnection dbCon)

 

{

RadChart2.Appearance.BarOverlapPercent = 40;

RadChart2.Appearance.BarWidthPercent = 80;

RadChart2.PlotArea.Appearance.Dimensions.Margins.Left = Telerik.Charting.Styles.

 

Unit.Percentage(10);

 

RadChart2.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Charting.Styles.

 

Unit.Percentage(40);

 

RadChart2.PlotArea.Appearance.Dimensions.Margins.Right = Telerik.Charting.Styles.

 

Unit.Percentage(2);

 

RadChart2.PlotArea.XAxis.Appearance.MajorGridLines.Visible =

 

false;

 

RadChart2.PlotArea.YAxis.Appearance.MajorGridLines.Visible =

 

true;

 

 

 

// Loading all different years and initializing X axis items.

 

 

 

SqlDataAdapter adapter = new SqlDataAdapter("SELECT Distinct(BID_TIME) FROM BID_DETAILS where auc_code='7' ORDER BY BID_TIME ", dbCon);

 

 

 

DataSet ds = new DataSet();

 

adapter.Fill(ds);

RadChart2.PlotArea.XAxis.Clear();

RadChart2.PlotArea.XAxis.AutoScale =

 

false;

 

RadChart2.PlotArea.XAxis.IsZeroBased =

 

false;

 

RadChart2.PlotArea.YAxis.AxisMode =

 

ChartYAxisMode.Extended;

 

 

 

foreach (DataRow dbRow in ds.Tables[0].Rows)

 

{

RadChart2.PlotArea.XAxis.AddItem((dbRow[

 

"BID_TIME"]).ToString());

 

 

}

UpdateRadChart2(dbCon);

 

}

 

 

private void UpdateRadChart2(SqlConnection dbCon)

 

{

 

 

// Remove the previous series.

 

 

RadChart2.Series.Clear();

 

// Form sql query to the database.

 

 

 

//string sqlString = "SELECT auc_code, Vendor_id, BID_TIME, BID_PRICE FROM BID_DETAILS WHERE auc_code='7' ORDER BY auc_code, Vendor_id, BID_TIME, BID_PRICE";

 

 

 

string sqlString = "SELECT distinct Vendor_id FROM BID_DETAILS WHERE auc_code='7'";

 

 

 

//sqlString = String.Format(sqlString, dropDownCategory.SelectedIndex + 1);

 

 

 

SqlDataAdapter adapter = new SqlDataAdapter(sqlString, dbCon);

 

 

 

DataSet ds = new DataSet();

 

adapter.Fill(ds);

 

 

// Load data.

 

 

 

 

//ChartSeries currentSeries = null;

 

 

 

// int i = 0;

 

 

 

foreach (DataRow dbRow in ds.Tables[0].Rows)

 

{

 

 

 

ChartSeries currentSeries = null;

 

 

 

ChartSeriesItemsCollection Ds = new ChartSeriesItemsCollection();

 

currentSeries = RadChart2.CreateSeries((

 

string)dbRow["Vendor_id"], Color.Empty, Color.Empty, ChartSeriesType.Line);

 

currentSeries.Appearance.Border.Color =

 

Color.Black;

 

 

 

// currentSeries.Type = ChartSeriesType.Line;

 

 

currentSeries.Appearance.ShowLabels =

false;

 

 

 

//subcategory_id = dbRow["auc_code"];

 

 

 

//if (subcategory_id != oldsubcategory_id)

 

 

 

//{

 

 

 

 

// oldsubcategory_id = subcategory_id;

 

 

 

//}

 

 

 

if (currentSeries != null)

 

{

 

 

string sqlString1 = "SELECT Vendor_id, BID_TIME, BID_PRICE FROM BID_DETAILS WHERE auc_code='7' and Vendor_id = '" + dbRow["Vendor_id"].ToString() + "' ";

 

 

 

SqlDataAdapter adapter1 = new SqlDataAdapter(sqlString1, dbCon);

 

 

 

DataSet ds1 = new DataSet();

 

adapter1.Fill(ds1);

 

 

 

foreach (DataRow dbRow1 in ds1.Tables[0].Rows)

 

{

 

 

 

// Ds.Add(new ChartSeriesItem(double.Parse(dbRow1["BID_PRICE"].ToString())));

 

 

 

//RadChart2.Series[i].DataLabelsColumn = dbRow1["BID_TIME"].ToString();

 

 

currentSeries.AddItem(

double.Parse(dbRow1["BID_PRICE"].ToString()));

 

 

 

// currentSeries.DataYColumn=dbRow1["BID_PRICE"].ToString();

 

 

 

// RadChart2.PlotArea.XAxis.DataLabelsColumn = dbRow1["BID_TIME"].ToString();

 

 

 

// currentSeries.DataXColumn = dbRow1["BID_TIME"].ToString();

 

 

 

//currentSeries.AddItem(Ds);

 

 

 

// RadChart2.Series[i].AddItem(Ds);

 

 

}

 

 

//currentSeries.AddItem(Ds);

 

 

 

}

 

// i++;

 

 

 

}

 

 

// Set additional properties and settings for the chart.

 

 

 

//RadChart2.ChartTitle.TextBlock.Text = dropDownCategory.SelectedItem.Text;

 

 

}

 

}


aspx.cs

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="staggeredLine.aspx.cs" Inherits="staggeredLine" %>

 

<%

 

@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

 

<%

 

@ Register TagPrefix="telerik" Namespace="Telerik.Charting" Assembly="Telerik.Web.UI" %>

 

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

 

html xmlns="http://www.w3.org/1999/xhtml">

 

<

 

 

head runat="server">

 

 

 

<title>Staggered Line chart - for auction test</title>

 

</

 

 

head>

 

<

 

 

body>

 

 

 

<form id="form1" runat="server">

 

 

 

<div>

 

 

 

<telerik:RadChart ID="RadChart2" runat="server" Height="333px" Skin="LightBrown"

 

 

 

Width="700px" AutoLayout="true" AutoTextWrap="true" >

 

 

 

 

<ChartTitle>

 

 

 

<TextBlock Text="Bid Chart" />

 

 

 

</ChartTitle>

 

 

 

</telerik:RadChart>

 

 

 

 

</div>

 

 

 

</form>

 

</

 

 

body>

 

</

 

 

html>

 

 


CREATE

 

TABLE [dbo].[BID_DETAILS](

 

[BID_DETAIL_ID] [decimal]

(18, 0) NULL,

 

[AUC_CODE] [decimal]

(18, 0) NULL,

 

[VENDOR_ID] [varchar]

(10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[SUPP_ORG_NAME] [varchar]

(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[PROXY_NAME] [varchar]

(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[BID_PRICE] [decimal]

(23, 5) NULL,

 

[BID_DATE] [datetime]

NULL,

 

[BID_TIME] [varchar]

(8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[IS_APPROVED] [varchar]

(10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[GROSS_PRICE] [decimal]

(23, 5) NULL,

 

[ITEM_NUMBER] [decimal]

(18, 0) NULL,

 

[QUANTITY] [decimal]

(23, 3) NULL,

 

[STATUS] [char]

(1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL CONSTRAINT [DF_BID_DETAILS_STATUS] DEFAULT (N'A'),

 

[REASON] [char]

(1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[IP_ADDRESS] [varchar]

(20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

 

)

 

ON [PRIMARY]

 

GO

SET

 

ANSI_PADDING OFF

 



Ves
Telerik team
 answered on 25 Aug 2010
2 answers
130 views
Hi All

I have a scheduler in a page which works fine.

It works fine in IE 7.

But have a issue in IE 8

Have attached the screen shot of both IE 7 and IE 8

<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="AttendanceEmployeeView.aspx.cs"
    Inherits="Products.iSmart.AttendanceEmployeeView" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title>Attendance</title>
    <link href="../ImpetusBlue/Grid.ImpetusBlue.css" rel="stylesheet" type="text/css" />
    <link href="../ImpetusBlue/Menu.ImpetusBlue.css" rel="stylesheet" type="text/css" />
    <link href="../ImpetusBlue/Slider.ImpetusBlue.css" rel="stylesheet" type="text/css" />
    <telerik:RadScriptBlock ID="rsbk" runat="server">
  
        <script type="text/javascript">
            function SizeToFit() {
                window.setTimeout(
            function() {
                var oWnd = GetRadWindow();
                oWnd.SetWidth(650);
                oWnd.SetHeight(413);
                oWnd.moveTo(160, 100);
            }, 400);
            }
  
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
                return oWindow;
            }
              
              
            function setCalendarTable() {
  
                var picker = $find("<%= rdcDate.ClientID %>");
                var calendar = picker.get_calendar();
                var fastNavigation = calendar._getFastNavigation();
                $clearHandlers(picker.get_popupButton());
                picker.get_popupButton().href = "javascript:void(0);";
  
                $addHandler(picker.get_popupButton(), "click", function() {
  
                    var textbox = picker.get_textBox();
                    //adjust where to show the popup table 
                    var x, y;
                    var adjustElement = textbox;
                    if (textbox.style.display == "none")
                        adjustElement = picker.get_popupImage();
  
                    var pos = picker.getElementPosition(adjustElement);
                    x = pos.x;
                    y = pos.y + adjustElement.offsetHeight;
  
                    var e = {
                        clientX: x,
                        clientY: y - document.documentElement.scrollTop
                    };
                    //synchronize the input date if set with the picker one
                    var date = picker.get_selectedDate();
                    if (date) {
                        calendar.get_focusedDate()[0] = date.getFullYear();
                        calendar.get_focusedDate()[1] = date.getMonth() + 1;
                    }
  
                    $get(calendar._titleID).onclick(e);
  
                    return false;
                });
  
                fastNavigation.OnOK =
                    function() {
                        var date = new Date(fastNavigation.Year, fastNavigation.Month, 1);
                        picker.get_dateInput().set_selectedDate(date);
                        fastNavigation.Popup.Hide();
                    }
  
  
                fastNavigation.OnToday =
                    function() {
                        var date = new Date();
                        picker.get_dateInput().set_selectedDate(date);
                        fastNavigation.Popup.Hide();
                    }
            }
              
              
              
  
        </script>
  
    </telerik:RadScriptBlock>
    <style type="text/css">
        .RadScheduler .rsAptContent, .RadScheduler .rsAptIn, .RadScheduler .rsAptMid, .RadScheduler .rsAptOut
        {
            background-image: none !important;
        }
    </style>
</head>
<body onload="SizeToFit()">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="smgr" runat="server">
    </asp:ScriptManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1" IsSticky="true" Style="margin-top: 50px;
        margin-left: 300px; position: absolute; z-index: 100" Transparency="30" HorizontalAlign="Center"
        MinDisplayTime="500" BackColor="#E0E0E0">
        <asp:Image runat="server" ID="LoadingImage1" ImageUrl="~/iSmart/images/Loading.gif"
            AlternateText="Loading..." />
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="LoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rdcDate">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rshdlrAttendance" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <div>
        Select Month  <telerik:RadDatePicker AutoPostBack="true" ID="rdcDate" Style="vertical-align: middle;"
            MinDate="1900-2-1" runat="server" Skin="Office2007" Calendar-EnableMonthYearFastNavigation="true">
            <DateInput ID="DateInput1" DateFormat="MMM-yyyy" runat="server">
            </DateInput>
        </telerik:RadDatePicker>
    </div>
    <br />
    <telerik:RadScheduler ShowNavigationPane="true" Height="300px" ShowHeader="false"
        ID="rshdlrAttendance" runat="server" DataKeyField="Day" DataStartField="DayStart"
        DataEndField="DayEnd" DataSubjectField="Att" AllowDelete="false" AllowEdit="false"
        AllowInsert="false" Skin="Web20" OnAppointmentDataBound="rshdlrAttendance_AppointmentDataBound"
        SelectedView="MonthView" ShowAllDayRow="false" CustomAttributeNames="Att">
        <TimelineView UserSelectable="false" />
        <MonthView MinimumRowHeight="1" />
        <MultiDayView ReadOnly="true" />
        <AppointmentTemplate>
            <div style="width: 100%; text-align: center; font-weight: bold;">
                <%# Eval("Att") %></div>
        </AppointmentTemplate>
    </telerik:RadScheduler>
      
    </form>
</body>
</html>

 

 

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using iSmart.BusinessLayer;
using Telerik.Web.UI;
  
namespace Products.iSmart
{
    public partial class AttendanceEmployeeView : System.Web.UI.Page
    {
        blEmployeeCTC BL = new blEmployeeCTC();
        String UserID;
        int Flag;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AuthenticatedUser"] == null)
                Response.Redirect("~/Admin/HomeCS.aspx");
            else
            {
                UserID = ((ProductAdmin.AuthenticatedUser)Session["AuthenticatedUser"]).UserID;
                //CompanyID = ((ProductAdmin.AuthenticatedUser)Session["AuthenticatedUser"]).CompanyID;
            }
            //UserID = "1359";
            rdcDate.MaxDate = DateTime.Now;
            if (!IsPostBack)
            {
                rdcDate.DatePopupButton.Attributes.Add("onclick", "setCalendarTable();return false;");
                rdcDate.SelectedDate = DateTime.Now;
            }
            if (rdcDate.SelectedDate < DateTime.Now)
                UDFShowAttendance();
        }
        protected void UDFShowAttendance()
        {
            //rshdlrAttendance.DataSource = BL.GetEmployeeAttendance(UserID, DateTime.Now.Month, DateTime.Now.Year, DateTime.Now.Day);
            if (Convert.ToDateTime(rdcDate.SelectedDate).Month == DateTime.Now.Month && Convert.ToDateTime(rdcDate.SelectedDate).Year == DateTime.Now.Year)
                Flag = 1;
            else
                Flag = 0;
            rshdlrAttendance.SelectedDate = Convert.ToDateTime(rdcDate.SelectedDate);
            rshdlrAttendance.DataSource = BL.GetEmployeeAttendance(UserID, Convert.ToDateTime(rdcDate.SelectedDate).Month, Convert.ToDateTime(rdcDate.SelectedDate).Year, DateTime.Now.Day,Flag);
            rshdlrAttendance.DataBind();
  
        }
  
        protected void rshdlrAttendance_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {
            e.Appointment.BackColor = System.Drawing.Color.White;
            e.Appointment.BorderColor = System.Drawing.Color.White;
            if (e.Appointment.Subject != null)
            {
                switch (e.Appointment.Subject)
                {
                    case "P":
                        e.Appointment.ForeColor = System.Drawing.Color.Green;
                        break;
                    case "A":
                        e.Appointment.ForeColor = System.Drawing.Color.Red;
                        break;
                    case "HPA":
                        e.Appointment.ForeColor = System.Drawing.Color.Purple;
                        break;
                    case "HPM":
                        e.Appointment.ForeColor = System.Drawing.Color.RosyBrown;
                        break;
                    case "S":
                        e.Appointment.ForeColor = System.Drawing.Color.SandyBrown;
                        break;
                    case "CO":
                        e.Appointment.ForeColor = System.Drawing.Color.RoyalBlue;
                        break;
                    case "H":
                        e.Appointment.ForeColor = System.Drawing.Color.Tomato;
                        break;
                    case "WH":
                        e.Appointment.ForeColor = System.Drawing.Color.Violet;
                        break;
                    case "OD":
                        e.Appointment.ForeColor = System.Drawing.Color.Turquoise;
                        break;
                    case "X":
                        e.Appointment.ForeColor = System.Drawing.Color.Thistle;
                        break;
                    case "HAA":
                        e.Appointment.ForeColor = System.Drawing.Color.SaddleBrown;
                        break;
                    case "HAM":
                        e.Appointment.ForeColor = System.Drawing.Color.RosyBrown;
                        break;
                    case "EMPTY":
                        e.Appointment.ForeColor = System.Drawing.Color.PaleVioletRed;
                        break;
                    case "OF":
                        e.Appointment.ForeColor = System.Drawing.Color.Pink;
                        break;
                    case "CL":
                        e.Appointment.ForeColor = System.Drawing.Color.Magenta;
                        break;
                    default:
                        e.Appointment.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4E2787");
                        break;
                }
            }
        }
    }
}


Please could I know is there any option to rectify this.

Thank You

-Anto
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
 answered on 25 Aug 2010
3 answers
72 views
Hi everybody,

I have a really annoying bug with my version of radcombobox (2009.1.527.35), when using google chrome browser 5.0 (haven't tested with other browsers). When opening a new page, without touching browser scrollbar, all radcomboboxes behave OK. 

But as soon as I scroll down my page, radcomboboxes open on weird positions, that means their y-offset becomes unpredictable (for example, they open hundreds of pixels up or down from their "normal" position).

Does anybody know the solution ? We can not put our app in production without fixing this.

Thanks,
Vedran
Simon
Telerik team
 answered on 25 Aug 2010
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?