Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
160 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
96 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
65 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
92 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
140 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
80 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
5 answers
213 views
hello, every one

in my application i set the paging 30 for RadGrid
and on Insert command of Radgrid i am Inserting New record in database but problem is that after inserting the record
focus is going to the last page of Radgrid, even i am not setting the page Index in my code then also i am facing this problem.

plz tell the solution
Rosen
Telerik team
 answered on 25 Aug 2010
3 answers
147 views

Hello,

I want to use timezone setting in my scheduler.

How can I do it ?

The url given in Demo is not opening

http://demos.telerik.com/aspnet-ajax/scheduler/examples/timezones/defaultcs.aspx

Getting error as "Sorry, we couldn't find the page you're looking for."


Can you post sample code in here for timezone ?

Thanks 

Ashish Sapkale


Veronica
Telerik team
 answered on 25 Aug 2010
5 answers
95 views
Hi all,

I am using the Scheduler with my own data provider (data is stored in a database)

Now, I have a need for linking an appointment to a specific customer, project, sales lead, etc.

I was thinking of implementing this on the advanced form with two extra fields:

Link Type, which is a set of Radio Buttons or a Combobox where each item represents the link type (customer, project....)
Linked To, which is a ComboBox where each item represents for example a Customer (if Link Type "Customer" was chosen).

There is obviously a need to catch the item change event of the RadioButton/ComboBox for the LinkType to populate the Linked To ComboBox with the right items.

How do I subscribe to this event in the advanced forms (both create and edit)?  Or are there any other ways of doing this?

Thanks in advance.

Regards

Henrik
Veronica
Telerik team
 answered on 25 Aug 2010
7 answers
618 views
Hey Telerik-Team,
i ran into a problem concerning the listview control and dynamically added controls. Here is what I am trying to achieve.

I have a listview-control (LV) that is databound to a datatable. The LV also has a custom template
set for its itemtemplate. This custom template dynamically loads another usercontrol containing a radgrid.
So far so good. To facilitate the binding of postbackeventhandlers(click of a button) in this dynamically added control
the control must be added at the init state of the surrounding page. So in the init event handler I call
"Rebind" on the LV
. The rebind causes the controls to be recreated and the event handler of the custom control, e.g.
a linkbutton, is working.

The problem is the following: After rebinding in the init handler, a second
implicit rebind occurs
, set at the prerender state, see below for the call stack:

    App_Code.zzxj7amw.dll!MotifListItemTemplate.InstantiateIn.AnonymousMethod__0(object sender = {System.Web.UI.WebControls.Panel}, System.EventArgs args = {System.EventArgs}) Line 45   C#
     System.Web.dll!System.Web.UI.Control.OnDataBinding(System.EventArgs e) + 0x5c bytes   
     ...
     Telerik.Web.UI.DLL!Telerik.Web.UI.RadListView.PerformSelect() + 0x32 bytes   
     Telerik.Web.UI.DLL!Telerik.Web.UI.RadListView.Rebind() + 0x28 bytes   
     Telerik.Web.UI.DLL!Telerik.Web.UI.RadListView.OnPreRender(System.EventArgs e = {System.EventArgs}) + 0x39 bytes   
     System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() + 0x68 bytes   
    
This rebind forces the user controls to be created again, and I conclude that it also clears the LV's controls collection.
This however flushes the viewstate so that any changes to the contained radgrid are lost (grouping, sorting, etc).

Is there are way to get rid of this second rebind?

I tried to call rebind in the load stage, which seems to keep the second rebind from happening, but the viewstate is lost due to the
assumed clear of the controls collection.

To sum up, I need to have a ListView Control that dynamically adds controls for each item it has, AND keeps track of the viewstate.

I hope my explanations are clear.

Thank you for your support!

Regards,
Kris
Nikolay Rusev
Telerik team
 answered on 25 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?