Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
169 views
void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)  
    {  
        DataRowView drv = e.DataItem as DataRowView;  
        DateTime startDate = (DateTime)drv["EventDate"];  
        DateTime endDate = (DateTime)drv["EndDate"];  
        StringBuilder sb = new StringBuilder();  
        sb.Append(drv["Title"].ToString());  
        sb.AppendFormat("\n{0} - {1}", startDate.ToShortDateString(), endDate.ToShortDateString());  
        e.SeriesItem.Name = drv["Source"].ToString();  
        e.SeriesItem.ActiveRegion.Tooltip = sb.ToString();  
          
    } 
I'm struggling getting the series names to show up properly in the legend. All I get is 'Series xx' and I'm sure I'm overlooking something very simple, or at least I hope so.

Basic theory: I'm grabbing list items from various SharePoint lists via Lists Web service, converting the XmlNodes into DataSets, doing a little manipulation to the data, then create a DataTable with all List items.
DataTable schema looks like:
dt.Columns.Add("Source"typeof(String));  
dt.Columns.Add("Title"typeof(string));  
dt.Columns.Add("From"typeof(double));  
dt.Columns.Add("To"typeof(double));  
dt.Columns.Add("EventDate"typeof(DateTime));  
dt.Columns.Add("EndDate"typeof(DateTime)); 

For each Source, I want it to show up in different colors for the Gantt chart and display the name so the user knows which list it came from.

Snippet for chart:
ChartSeries series = new ChartSeries();  
RadChart1.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;  
                  
        RadChart1.PlotArea.YAxis.Appearance.LabelAppearance.RotationAngle = 45;  
        RadChart1.PlotArea.YAxis.LabelStep = 1;  
        RadChart1.PlotArea.YAxis.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Top;  
        RadChart1.Series.Clear();  
        RadChart1.PlotArea.YAxis.AutoScale = false;  
        RadChart1.PlotArea.YAxis.AxisMode = ChartYAxisMode.Extended;  
 
        DataTable dt = getListItems();  
 
        RadChart1.PlotArea.YAxis.AddRange(from.ToOADate(), to.ToOADate(), step);  
        RadChart1.DataSource = dt;  
 
        series.Type = ChartSeriesType.Gantt;  
        series.Appearance.LabelAppearance.Visible = false;  
        series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.SeriesName;  
        series.Appearance.BarWidthPercent = 30M;  
        series.DataYColumn = "From";  
        series.DataYColumn2 = "To";  
        RadChart1.Series.Add(series);  
        RadChart1.SeriesOrientation = ChartSeriesOrientation.Horizontal;  
        RadChart1.ChartTitle.TextBlock.Text = "Aggregated Calendar";  
        if(_realWidth > 0)  
            RadChart1.Width = new Unit(_realWidth * .97);  
RadChart1.DataBind(); 

Here is the ItemDataBound event:
void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)     
    {     
        DataRowView drv = e.DataItem as DataRowView;     
        DateTime startDate = (DateTime)drv["EventDate"];     
        DateTime endDate = (DateTime)drv["EndDate"];     
        StringBuilder sb = new StringBuilder();     
        sb.Append(drv["Title"].ToString());     
        sb.AppendFormat("\n{0} - {1}", startDate.ToShortDateString(), endDate.ToShortDateString());     
        e.SeriesItem.Name = drv["Source"].ToString();     
        e.SeriesItem.ActiveRegion.Tooltip = sb.ToString();     
             
    }    
 

I would expect to be able to set the column that is being used for the Series like
series.DataSeriesColumn = "Source"; //DataTable column name 
similar to how you specify the DataYColumn, DataYColumn2, etc.

Surely, I don't have to create new ChartSeries objects for every list I aggregate? Any help would be appreciated.
Ves
Telerik team
 answered on 23 Sep 2009
4 answers
208 views
How can I make a GridEditCommandColumn work as a GridExpandColumn?
<telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../Grafikk/RadGrid/SinglePlus.gif" EditText="Edit" CancelImageUrl="../Grafikk/RadGrid/SingleMinus.gif" CancelText="Cancel" ItemStyle-HorizontalAlign="Center" /> 

First I want the PLUS gif to become a MINUS gif when clicked and my EditFormTemplate opens, and when I click on MINUS, a cancel command is fired.
Yavor
Telerik team
 answered on 23 Sep 2009
4 answers
119 views
Hi,

I have a small search page that dumps it's results to a RadGrid. My search routine looks like this:
 var searchResults = db.AbsenceSearch(txtIndividualSearchBox.Text.ToUpper(),  
                ddlEnterprises.SelectedValue == "-1" || ddlEnterprises.SelectedValue == "" ? null : (int?)Convert.ToInt32(ddlEnterprises.SelectedValue), ddlDivisions.SelectedValue == "-1" || ddlDivisions.SelectedValue == "" ? null : (int?)Convert.ToInt32(ddlDivisions.SelectedValue),  
                dateFrom,  
                dateTo,  
                reevaluationPeriod,  
                cbIsOpen.Checked,  
                userid).ToList();  
 
            RadGrid1.DataSource = searchResults

My initial databind seems to have correct DataKeys values in the grid, but when I do another search with new search field values, my new data appears OK, but the old Datakeys are still there. I for example found out that on initial pageload I have a DataKey value of 2000 in the 3rd item row in the grid, and when I do an new search, and the grid loads with the new data, I still have DataKey value 2000 in the 3rd item row.

This is how I am retrieving the Datakeys:
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
        {  
 
            if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem)  
            {  
                int eID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["id"];  
                Response.Redirect(<to some page>);  
            }  
        } 

I am sure this is a simple beginner mistake. Please help.

reg.
Axel
Tsvetoslav
Telerik team
 answered on 23 Sep 2009
1 answer
159 views
Is there a way to disable all toolbars? I did a search and didn't find anything.
Princy
Top achievements
Rank 2
 answered on 23 Sep 2009
4 answers
282 views
Hi,

I have a radgrid set up with detailtables and nestedviewtemplate.

The markup (without all the details...) looks like this :
<telerik:radgrid ...> 
  <DetailTables> 
    <telerik:GridTableView ...> 
      <DetailTables> 
        <telerik:GridTableView ...> 
          <NestedViewTemplate> 
            <telerik:RadTabStrip ...> 
            </telerik:RadTabStrip> 
            <telerik:RadMultiPage ...> 
              <telerik:RadPageView ...> 
                <telerik:RadGrid ...> 
                  <DetailTables> 
                    <telerik:GridTableView ...> 
                      <DetailTables> 
                        <telerik:GridTableView ...> 
                        </telerik:GridTableView> 
                      </DetailTables> 
                    </telerik:GridTableView> 
                  </DetailTables> 
                </telerik:RadGrid> 
              </telerik:RadPageView> 
            </telerik:RadMultiPage> 
          <NestedViewTemplate> 
        </telerik:GridTableView   
      </DetailTables> 
    </telerik:GridTableView   
  </DetailTables> 
</telerik:radgrid> 

I would like to have all parent rows, of the row the user left or right-clicks,selected.
In my code-behind i have code in the ItemCommmand event that when a user expands a row e.Item.Selected is set to true.
So that row is selected, but i also would like the parent rows to be selected and all other rows deselected.

We have the Office2007 skin (very nice one by the way!!) and selected rows are displayed in orange. The reason we want the parent rows selected as well is to make it easer for the user to see where he "is" in the hierarchial grid.

Does anybody know what i need to do to make this work? I think i have to set each grid (the grids in the NestedViewTemplate as well) to multiselect. And then catch the left or right mouseclick, loop through each parent control and clear all selected items if the parent is a grid and if it is a griditem the set selected to true?
Tsvetoslav
Telerik team
 answered on 23 Sep 2009
3 answers
136 views
Hi,

I have a Radcolorpicker on my web user control page. This usercontrol is invoked from aspx page. And the Scriptmanager tag is on the master page. It builds well. But at runtime I get the following error -
 " Script control '<control ID>' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl  "

It works well in a standalone page. Anything I missed to configure?


Thanks,
Prashant Phalle.
Petio Petkov
Telerik team
 answered on 23 Sep 2009
2 answers
94 views
Is it possible to add templates to the radmenu via javascript.

A little more exact question could be : How do I add a RadTextBox (I want to possibly use other controls as well) to a radmenuitem via javascript?
Baatezu
Top achievements
Rank 2
 answered on 23 Sep 2009
1 answer
220 views
I use the Compass framework for CSS design at the start of my css file I have a global style reset applied. This occurs on line 1 of the very first style sheet in my mark up. As it's meant to be applied first and then overridden by any style afterward. It is just in a .css file linked in as a stylesheet in my header tag.

However it seems that on text fields (or possible all controls that are decorated) that the RadForm decorator is inserting it's CSS before my reset so half of the CSS applied to the textboxes is ruined since margins and padding are all changed.

I can resolve the problem by removing the table altering reset portion so I definitly verified that it is caused by it however why is it being caused by it? Is there a setting for the decorator that will tell it to make sure to apply it self last?

Also why is the documentation for the RadFormDecorator almost non existent when you view the telerik help online?
Martin
Telerik team
 answered on 23 Sep 2009
2 answers
156 views
Is there a trick to have the check box labels decorated?  A very simple dialog box, but the labels for check boxes seem untouched by the decorator.  We are using the "Hay" skin, declared in the webconfig.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="printDialog.aspx.vb" Inherits="printDialog" %> 
 
<!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>Print Options</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <div> 
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" /> 
    <script language="javascript" type="text/javascript">  
 
        function GetRadWindow() {  
            var oWindow = null;  
            if (window.radWindow) oWindow = window.radWindow;  
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;  
            return oWindow;  
        }  
 
        function returnToParent() {  
            //create the argument that will be returned to the parent page  
            var oArg = new Object();  
 
            oArg.showTitle = document.getElementById("chkTitle").checked;  
            oArg.pageTitle = $find("txtTitle").get_value();  
            oArg.showLegend = document.getElementById("chkLegend").checked;  
            oArg.showNorthArrow = document.getElementById("chkNA").checked;  
 
 
            //get a reference to the current RadWindow  
            var oWindow = GetRadWindow();  
 
            //Close the RadWindow and send the argument to the parent page  
            oWindow.close(oArg);  
        }  
 
        function onCancel() {  
            var oWindow = GetRadWindow();  
            oWindow.argument = null;  
            oWindow.close();  
        }  
 
        function onCheckChanged_chkTitle() {  
            if (document.getElementById("chkTitle").checked) {  
                $find("txtTitle").enable();  
            }  
            else {  
                $find("txtTitle").disable();  
            }  
        }  
 
    </script> 
        <table> 
            <tr> 
                <td> 
                    <asp:CheckBox ID="chkTitle" runat="server" Text="Show Title?" /> 
                </td> 
            </tr> 
            <tr> 
                <td>&nbsp;&nbsp;&nbsp;  
                    <telerik:RadTextBox ID="txtTitle"   
                                        runat="server"   
                                        Label="Title"   
                                        Enabled="false"   
                                        MaxLength="50" 
                                        Width="250px">  
                    </telerik:RadTextBox>                  
                </td> 
            </tr> 
             <tr> 
                <td> 
                    <asp:CheckBox ID="chkLegend" runat="server" Text="Show Legend?" on /> 
                </td> 
            </tr> 
            <tr> 
                <td> 
                    <asp:CheckBox ID="chkNA" runat="server" Text="Show North Arrow?" /> 
                </td> 
            </tr> 
       </table> 
       <br /> 
       <table> 
        <tr> 
            <td> 
                <asp:Button ID="btnOK" runat="server" Text="Print" OnClientClick="returnToParent(); return false;" /> 
            </td> 
            <td> 
                <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="onCancel(); return false;" /> 
            </td> 
        </tr> 
       </table> 
    </div> 
    </form> 
</body> 
</html> 
 

 
Partial Class printDialog  
    Inherits System.Web.UI.Page  
 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        chkTitle.Attributes.Add("onclick""onCheckChanged_chkTitle();")  
    End Sub 
End Class 
Martin
Telerik team
 answered on 23 Sep 2009
1 answer
89 views
Hi,

Anyone know how to use CotextMenu in listbox? is this possible? any examples?
Shinu
Top achievements
Rank 2
 answered on 23 Sep 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?