Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
104 views
I'm attempting to create a custom field editor, and using the RadDropDownFilter example as a guide.  My custom editor however has multiple fields - two text boxes, and two combo boxes.

When using the example code, on a postback the ArrayList in the SetEditorValues method only contains a single value - not the values entered for all four controls.  The ExtractValues method does seem to be outputting an ArrayList with four elements.

Any thoughts?  I'm guessing the issue might be that the inherited class - RadFilterDataFieldEditor - doesn't support multiple values?  Should I be deriving from some other class?  Code for the custom editor:

public class RadFilterRangeValueTypeStrategy : RadFilterDataFieldEditor
        {
            private RadComboBox _combo_ValueType;
            private RadComboBox _combo_Strategy;
 
            private RadTextBox _textMin;
            private RadTextBox _textMax;
 
 
            protected override void CopySettings(RadFilterDataFieldEditor baseEditor)
            {
                base.CopySettings(baseEditor);
 
                var editor = baseEditor as RadFilterRangeValueTypeStrategy;
                if (editor != null)
                {
                    DataSource_ValueType = editor.DataSource_ValueType;
                    DataTextField_ValueType = editor.DataTextField_ValueType;
                    DataValueField_ValueType = editor.DataValueField_ValueType;
 
                    DataSource_Strategy = editor.DataSource_Strategy;
                    DataTextField_Strategy = editor.DataTextField_Strategy;
                    DataValueField_Strategy = editor.DataValueField_Strategy;
 
                    MinValue = editor.MinValue;
                    MaxValue = editor.MaxValue;
                }
            }
 
 
            public override System.Collections.ArrayList ExtractValues()
            {
                ArrayList list = new ArrayList();
 
                list.Add(_combo_ValueType.SelectedValue);
 
                list.Add(_combo_Strategy.SelectedValue);
 
                list.Add(_textMin.Text);
 
                list.Add(_textMax.Text);
 
                return list;
 
            }
 
            public override void InitializeEditor(System.Web.UI.Control container)
            {
 
                Label minLabel = new Label();
                minLabel.Text = "Min: ";
 
                container.Controls.Add(minLabel);
 
                _textMin = new RadTextBox();
                _textMin.ID = "MinValue";
                _textMin.Text = MinValue;
                _textMin.Width = Unit.Pixel(30);
                container.Controls.Add(_textMin);
 
 
                Label maxLabel = new Label();
                maxLabel.Text = "  Max: ";
 
                container.Controls.Add(maxLabel);
 
                _textMax = new RadTextBox();
                _textMax.ID = "MaxValue";
                _textMax.Text = MaxValue;
                _textMax.Width = Unit.Pixel(30);
                container.Controls.Add(_textMax);
 
 
 
                Label valueTypeLabel = new Label();
                valueTypeLabel.Text = "  Value Type: ";
 
                container.Controls.Add(valueTypeLabel);
 
                _combo_ValueType = new RadComboBox();
                _combo_ValueType.ID = "ValueTypeCombo";
                _combo_ValueType.DataTextField = DataTextField_ValueType;
                _combo_ValueType.DataValueField = DataValueField_ValueType;
                _combo_ValueType.DataSource = DataSource_ValueType;
                _combo_ValueType.DataBind();
                _combo_ValueType.Width = Unit.Pixel(30);
                container.Controls.Add(_combo_ValueType);
 
 
 
                Label strategyLabel = new Label();
                strategyLabel.Text = "  Strategy: ";
 
                container.Controls.Add(strategyLabel);
 
                _combo_Strategy = new RadComboBox();
                _combo_Strategy.ID = "StrategyCombo";
                _combo_Strategy.DataTextField = DataTextField_Strategy;
                _combo_Strategy.DataValueField = DataValueField_Strategy;
                _combo_Strategy.DataSource = DataSource_Strategy;
                _combo_Strategy.DataBind();
                _combo_Strategy.Width = Unit.Pixel(40);
                container.Controls.Add(_combo_Strategy);
 
               
            }
 
            public override void SetEditorValues(System.Collections.ArrayList values)
            {
                if (values != null && values.Count > 0)
                {
                    if (values[0] == null)
                        return;
                    var item = _combo_ValueType.FindItemByValue(values[0].ToString());
                    if (item != null)
                        item.Selected = true;
                }
 
                if (values != null && values.Count > 1)
                {
                    if (values[1] == null)
                        return;
                    var item = _combo_Strategy.FindItemByValue(values[1].ToString());
                    if (item != null)
                        item.Selected = true;
                }
 
                if (values != null && values.Count > 2)
                {
                    if (values[2] == null)
                        return;
 
                    _textMin.Text = values[2].ToString();
                }
 
                if (values != null && values.Count > 3)
                {
                    if (values[3] == null)
                        return;
 
                    _textMax.Text = values[3].ToString();
                }
            }
 
            public string DataTextField_ValueType
            {
                get
                {
                    return (string)ViewState["DataTextField_ValueType"] ?? string.Empty;
                }
                set
                {
                    ViewState["DataTextField_ValueType"] = value;
                }
            }
 
            public string DataValueField_ValueType
            {
                get
                {
                    return (string)ViewState["DataValueField_ValueType"] ?? string.Empty;
                }
                set
                {
                    ViewState["DataValueField_ValueType"] = value;
                }
            }
 
            public RadFilterDropDownEditorDataSource DataSource_ValueType
            {
                get
                {
                    return (RadFilterDropDownEditorDataSource)ViewState["DataSource_ValueType"] ?? new RadFilterDropDownEditorDataSource();
                }
                set
                {
                    ViewState["DataSource_ValueType"] = value;
                }
            }
 
 
 
            public string DataTextField_Strategy
            {
                get
                {
                    return (string)ViewState["DataTextField_Strategy"] ?? string.Empty;
                }
                set
                {
                    ViewState["DataTextField_Strategy"] = value;
                }
            }
 
            public string DataValueField_Strategy
            {
                get
                {
                    return (string)ViewState["DataValueField_Strategy"] ?? string.Empty;
                }
                set
                {
                    ViewState["DataValueField_Strategy"] = value;
                }
            }
 
            public RadFilterDropDownEditorDataSource DataSource_Strategy
            {
                get
                {
                    return (RadFilterDropDownEditorDataSource)ViewState["DataSource_Strategy"] ?? new RadFilterDropDownEditorDataSource();
                }
                set
                {
                    ViewState["DataSource_Strategy"] = value;
                }
            }
 
 
            public string MinValue
            {
                get
                {
                    return (string)ViewState["MinValue"] ?? string.Empty;
                }
                set
                {
                    ViewState["MinValue"] = value;
                }
            }
 
            public string MaxValue
            {
                get
                {
                    return (string)ViewState["MaxValue"] ?? string.Empty;
                }
                set
                {
                    ViewState["MaxValue"] = value;
                }
            }
 
        }
 
 
 
    }
Mira
Telerik team
 answered on 28 Jun 2011
2 answers
89 views
Where do i find the documentation on this control?  I have looked and only can find the documentation for the SilverLight version which is different.

Thanks,
Doug
Prashant
Top achievements
Rank 1
 answered on 28 Jun 2011
1 answer
65 views
I have a RadBinaryImage in the RadRotator itemTemplate. Is there any way i can find the radBinaryimage in the radrotator ? so that i can control the imageurl.

i try :

Dim image as RadBinaryImage = RadRotator1.findControl("RadBinaryImage1")

but it doesnt work.


Regards,
KEA
Slav
Telerik team
 answered on 28 Jun 2011
2 answers
77 views
Hi,

I have a RadGrid with RadNumericTextBox. One of the RadNumericTextBox  has a event that fires up when the content is changed.
The problem is that after the event is called I wish to set focus in another text box in the grid but it doesn't happens anything, no expections, no focus just like I hadn't the last line of the code bellow. Notice that I have the RadGrid wraped in a Ajax UpdatedControls

Here is the changed event:

  protected void txt2_Changed(object sender, EventArgs e)
  {
  RadNumericTextBox txt1 = (RadNumericTextBox)((RadNumericTextBox)sender).Parent.FindControl("txt1");
  RadNumericTextBox txt2 = (RadNumericTextBox)sender;
  RadNumericTextBox txt3 = (RadNumericTextBox)((RadNumericTextBox)sender).Parent.FindControl("txt3");
 
  txt3.Value = txt2.Value * (txt1.Value / 100);
 
  RadAjaxManager1.ResponseScripts.Add(String.Format("$find('{0}').focus();", txt3.ClientID));
 
}

Regula
Top achievements
Rank 1
 answered on 28 Jun 2011
1 answer
118 views
Hi

How can i upload file word or pdf file in database ?. Can you help me

thanks
Shinu
Top achievements
Rank 2
 answered on 28 Jun 2011
1 answer
255 views


I am running the trial version of Telerik controls on a windows 7 64 bit os.
I am running Visual Studio 2008.

I have just downloaded the trial version and am in the process of simply validating that the controls work on a copy of my production web project and added the Rad Date Input and the Rad Date Picker.
I am able to build the project without issue.
However when I attempt to run the project in the environment i get the following error when accessing the page where I added the controls.

* Note that in attempting to resolve this I've added a reference to the designer to my project

BindingFailure was detected

Message: The assembly with display name 'Telerik.Web.UI.Skins' failed to load in the 'Load' binding context of the AppDomain with ID 2. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Telerik.Web.UI.Skins' or one of its dependencies. The system cannot find the file specified.
File name: 'Telerik.Web.UI.Skins'

=== Pre-bind state information ===
LOG: User = LTWS2009-01\wwm
LOG: DisplayName = Telerik.Web.UI.Skins
 (Partial)
LOG: Initial PrivatePath = G:\Development\Midas\Web\Midas\Midas Source\Midas\MidasWeb\bin
Calling assembly : Telerik.Web.UI, Version=2011.1.519.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: G:\Development\Midas\Web\Midas-ComponentOne\Midas Source\Midas\MidasWeb\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
=============================================

I'm kind of dead in the water. I would appreciate any help / suggestions.

Thanks
Bill

Lini
Telerik team
 answered on 28 Jun 2011
1 answer
59 views
Hi,

I am creating a chart via code and adding to a placeholder, and with the exception of appearance, it works fine, I see the series values, etc. and all is well. I am doing the following

 Dim rc As New RadChart
                rc.SeriesOrientation = Telerik.Charting.ChartSeriesOrientation.Horizontal
                rc.AutoLayout = True
                rc.AutoTextWrap = True
                rc.ChartTitle.TextBlock.Appearance.AutoTextWrap = True

But despite this, the chart titles do no auto wrap and I get a result like the attached screen shot. Any thoughts on how to overcome this?
Evgenia
Telerik team
 answered on 28 Jun 2011
2 answers
139 views
Hi,

I am having difficulty setting the default value for the combox inside a grid. Getting an error

Selection out of range
Parameter name: value

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Selection out of range
Parameter name: value

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Selection out of range
Parameter name: value]
   Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +173
   Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +471
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback


My Goal is to show combobox as a templated column inside a grid. I am using the   SelectedValue='<%# Bind("ReqUpdate") %>'  to do the binding. The grid is bounded with the datasource using "RadGrid1_NeedDataSource".  When I had set the combox Text property, I was not getting any error but the first item in the combo was getting selected.

Other note: When I replace the radcombox with the DropDownList, everything works fine and the value is set properly. But I need to handle client side, onselectedindexchange event. As a result I need to use RADCOMBOX.

Please let me know how can I quickly resolve this issue.

Thanks,
navneet

Navneet
Top achievements
Rank 1
 answered on 28 Jun 2011
1 answer
62 views
Hi

I have a hierarchical grid where some of the columns I want to total but the total to be at the top in the header. I have a working set of code below which shows the hierarchical grid and I want to sum the 3 columns "ValueToSum","ValueToSum2" and "ValueToSum3". I would like the totals in the group headers (both levels).

If this is not possible then do say, thanks

ASPX
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="DataFormatting._Default" %>
  
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
  
  
<form id="form1" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
  
    <div class="contributionTable" >
        <asp:PlaceHolder ID="PlaceHolder1" runat="server" >
        <telerik:RadGrid ID="clientContribution" runat="server" 
            onitemdatabound="clientContribution_ItemDataBound" >
        </telerik:RadGrid>
        </asp:PlaceHolder>
    </div>
  
</form>


.cs Code Behind

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Diagnostics;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
  
namespace DataFormatting
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                BuildTheGrid();
            }
  
        }
        protected void clientContribution_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridGroupHeaderItem)
            {
                GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
                DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
  
            }
  
        }
        #region Build the grid
        private DataSet BuildTheGrid()
        {
            try
            {
  
                clientContribution.DataSource = null;
                DataSet contributionColumns = LoadGridData();
  
  
                // Define the main grid
                for (int loopPos = clientContribution.MasterTableView.Columns.Count; loopPos > 0; loopPos--)
                {
                    clientContribution.MasterTableView.Columns.RemoveAt(loopPos - 1);
                }
                clientContribution.ID = "MyGrid";
                clientContribution.DataSource = contributionColumns;
                clientContribution.Width = Unit.Percentage(98);
                clientContribution.AutoGenerateColumns = false;
                clientContribution.ShowStatusBar = true;
                clientContribution.MasterTableView.Width = Unit.Percentage(100);
  
                // now build the hierarchical grid
                clientContribution.MasterTableView.GroupByExpressions.Add(
                    new GridGroupByExpression("GroupValue1 group by GroupValue1"));
                clientContribution.MasterTableView.GroupByExpressions.Add(
                    new GridGroupByExpression("GroupValue2 group by GroupValue2"));
  
                GridBoundColumn boundColumn = new GridBoundColumn();
  
                foreach (DataColumn col in contributionColumns.Tables[0].Columns)
                {
                        boundColumn = new GridBoundColumn();
                        clientContribution.MasterTableView.Columns.Add(boundColumn);
                        boundColumn.DataField = col.ColumnName;
                        boundColumn.HeaderText = col.ColumnName;
                        boundColumn.Visible = true;
  
                }
                clientContribution.DataBind();
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc.Message);
                return null;
            }
            finally
            {
            }
            return null;
  
        }
        #endregion
  
        #region Load the Grid Data
        private DataSet LoadGridData()
        {
            // return the data to display
            DataSet contributionData = new DataSet("MyData");
  
            DataTable gridData = contributionData.Tables.Add("ContData");
  
            gridData.Columns.Add(new DataColumn("GroupValue1"));
            gridData.Columns.Add(new DataColumn("GroupValue2"));
            DataColumn decCol = new DataColumn("ValueToSum");
            decCol.DataType = System.Type.GetType("System.Int32");
            gridData.Columns.Add(decCol);
            DataColumn perCol = new DataColumn("ValueToIgnore");
            perCol.DataType = System.Type.GetType("System.Int32");
            gridData.Columns.Add(perCol);
            DataColumn decCol2 = new DataColumn("ValueToSum2");
            decCol2.DataType = System.Type.GetType("System.Int32");
            gridData.Columns.Add(decCol2);
            DataColumn perCol2 = new DataColumn("ValueToIgnore2");
            perCol2.DataType = System.Type.GetType("System.Int32");
            gridData.Columns.Add(perCol2);
            DataColumn decCol3 = new DataColumn("ValueToSum3");
            decCol3.DataType = System.Type.GetType("System.Int32");
            gridData.Columns.Add(decCol3);
            DataColumn perCol3 = new DataColumn("ValueToIgnore3");
            perCol3.DataType = System.Type.GetType("System.Int32");
            gridData.Columns.Add(perCol3);
  
  
            for (int j = 1; j < 5; j++)
            {
                for (int i = 1; i < 5; i++)
                {
                    DataRow dataRow = contributionData.Tables[0].NewRow();
  
                    dataRow["GroupValue1"] = "Header 1 as " + j.ToString();
                    dataRow["GroupValue2"] = "Heading 2 as " + j.ToString();
                    dataRow["ValueToSum"] = 1234 * i * j;
                    dataRow["ValueToIgnore"] = 805 * i * j;
                    dataRow["ValueToSum2"] = 42 * i * j;
                    dataRow["ValueToIgnore2"] = 901 * i * j;
                    dataRow["ValueToSum3"] = 651 * i * j;
                    dataRow["ValueToIgnore3"] = 104 * i * j;
  
                    contributionData.Tables[0].Rows.Add(dataRow);
                }
            }
            return contributionData;
        }
        #endregion
  
    }
}
Mira
Telerik team
 answered on 28 Jun 2011
1 answer
366 views
I'm using the built-in export buttons of the RadGrid control which are default to be aligned to the right side.

There are 2 columns for the command item row and the buttons are located in the second one. I set the align of the second column to the left but how could I remove the first column or set its width to 0 then setting the colspan of the second column to 2?

 Many thanks,
Pavlina
Telerik team
 answered on 28 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?