Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
102 views
Is it possible to just enable sorting on the grid and then allow the users to sort the data in the grid, without having to add any code, behind the scenes? 
Princy
Top achievements
Rank 2
 answered on 06 Apr 2011
3 answers
120 views
I have a calendar that has EnableMultiSelect=true. The user is now able to select one or multiple dates on the calendar. On the server side I need to know the date that user clicks if he is selecting one at a time. Currently the selected date property seems to be good only for single selection mode. The selecteddates property for the multiselectionmode has all the selected dates which does not help me. I need to know the date the user clicked on when the calendar is in multiselection mode. The focused date does not seem to hold the correct value either.

Thanks,
Vithiya
Shinu
Top achievements
Rank 2
 answered on 06 Apr 2011
3 answers
100 views
Hi,

I want to use Scheduler for resource availability, The way I want to show the scheduler is
On header, I want to show dates and sub level number of hours for each day
On side, I want work orders followed by employers mapped to each work order


10/01/2010

11/01/2010

9am

12pm

3pm

9am

12pm

3pm

Work Order 1

Employee1







Employee2







Employee3







Work Order 2

Employee1







Employee5







Employee6








Can anyone suggest, is it possible, If so please explain how to do.

Thank you.
Veronica
Telerik team
 answered on 06 Apr 2011
3 answers
216 views
I'm trying to implement a RadGrid with a dropdownlist filter column much like the demos provided on this site. The only difference is when I databind the grid I get only a filtered page of data from the database. So I don't really need the dropdownlist to do any actual filtering of the grid, just trigger the rebind of the grid so it checks the filter values and gets an appropriate page of data from the database.

Here's my custom filter column:
public class FilteringByDropDownBoundColumn : GridBoundColumn
{
    private object listDataSource = null;
    private Unit filterControlWidth = Unit.Percentage(90); // default
    private string filterTextField = "Text";
    private string filterValueField = "Value";
    public string FilterTextField
    {
        get { return filterTextField; }
        set { filterTextField = value; }
    }
    public string FilterValueField
    {
        get { return filterValueField; }
        set { filterValueField = value; }
    }
    protected override void SetupFilterControls(TableCell cell)
    {
        base.SetupFilterControls(cell);
        Control oldFilter = cell.Controls[0];
        cell.Controls.RemoveAt(0);
        DropDownList list = new DropDownList();
        list.ID = "list" + DataField;
        list.AutoPostBack = true;
        list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);
        list.DataTextField = FilterTextField;
        list.DataValueField = FilterValueField;
        list.DataSource = ListDataSource;
        list.Width = FilterControlWidth;
        list.Height = Unit.Pixel(20);
        list.EnableViewState = true;
        list.Attributes.Add("style", "font-size:.9em");
        cell.Controls.AddAt(0, list);
        cell.Controls.RemoveAt(1);
    }
    void list_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridFilteringItem filterItem = (sender as DropDownList).NamingContainer as GridFilteringItem;
        filterItem.FireCommandEvent("Filter", new Pair());
    }
    public new Unit FilterControlWidth
    {
        get
        {
            return (Unit)filterControlWidth;
        }
        set
        {
            filterControlWidth = value;
        }
    }
    public object ListDataSource
    {
        get { return listDataSource; }
        set { listDataSource = value; }
    }
    protected override void SetCurrentFilterValueToControl(TableCell cell)
    {
        base.SetCurrentFilterValueToControl(cell);
        DropDownList list = (DropDownList)cell.Controls[0];
        if (CurrentFilterValue != string.Empty)
        {
            list.SelectedValue = CurrentFilterValue;
        }
    }
    protected override string GetCurrentFilterValueFromControl(TableCell cell)
    {
        DropDownList list = (DropDownList)cell.Controls[0];
        return list.SelectedValue;
    }
    protected override string GetFilterDataField()
    {
        return FilterValueField;
    }

Here's my aspx code-behind:
protected override void OnInit(EventArgs e) 
    InitializeComponent(); 
    base.OnInit(e); 
private void InitializeComponent() 
    SetupTabs(); 
    SetupFilters(NeedsActionAccountsGrid); 
private void DataBindGrid(string view, RadGrid grid) 
    if (grid != null && !string.IsNullOrEmpty(view)) 
    
        QueueViewType viewType = (QueueViewType)(Enum.Parse(typeof(QueueViewType), view)); 
        Rep rep = LoggedInUser; 
        DateTime? LastModifiedBeginDate = null; 
        DateTime? LastModifiedEndDate = null; 
        DateCriteria.SetDate(ref LastModifiedBeginDate, ref LastModifiedEndDate, GetLastModifiedDateCriteria(grid)); 
        List<AccountQueueRecord> datasource = AccountQueueLogic.GetAccountsQueueItems(rep, 
                             viewType, 
                             LastModifiedBeginDate, 
                             LastModifiedEndDate, 
                             GetRegistrationTypeID(grid), 
                             grid.PageSize, 
                             grid.CurrentPageIndex); 
        grid.DataSource = datasource; 
        grid.DataBind(); 
    
private string GetRegistrationTypeID(RadGrid grid) 
    string RegistrationTypeID = null; 
    FilteringByDropDownBoundColumn col = grid.Columns.FindByDataFieldSafe("Registration") as FilteringByDropDownBoundColumn; 
    if (col != null && col.CurrentFilterValue != "All") 
        RegistrationTypeID = col.CurrentFilterValue; 
    return RegistrationTypeID; 
private void SetupFilters(RadGrid grid) 
    if (grid == null) 
        return; 
    LookupTypeService lookupService = new LookupTypeService(); 
    FilteringByDropDownBoundColumn col = grid.Columns.FindByDataFieldSafe("Registration") as FilteringByDropDownBoundColumn; 
    if (col != null) 
    
        List<RegistrationType> list = new List<RegistrationType>(); 
        list.Add(new RegistrationType() { Display = "All", Code = "All" }); 
        list.AddRange(lookupService.GetAllEnabled(LookupTypeEnum.RegistrationType).Cast<RegistrationType>().ToList()); 
        col.ListDataSource = list; 
        col.FilterTextField = "Display"; 
        col.FilterValueField = "Code"; 
    
protected void GridAccountQueue_ItemCommand(object source, GridCommandEventArgs e) 
    if (e.CommandName == RadGrid.FilterCommandName) 
    
        e.Canceled = true; 
        RadGrid grid = (RadGrid)source; 
        grid.MasterTableView.FilterExpression = ""; // clear this since we're providing a filtered datasource 
        string viewID = ""; 
        string gridID = grid.ID; 
        switch (gridID) 
        
            case "NeedsActionAccountsGrid": 
            case "NeedsActionProposalsGrid": 
                viewID = NeedsActionTabs.SelectedTab.SelectedTab.Value; // go to second level of tabs 
                break; 
        
        DataBindGrid(viewID, grid); 
    

And here's my grid declaration:
                    <telerik:RadGrid ID="NeedsActionAccountsGrid" runat="server" OnItemCommand = "GridAccountQueue_ItemCommand"
                        OnSortCommand="GridAccountQueue_SortCommand"
OnPageSizeChanged="GridAccountQueue_PageSizeChanged" 
                        OnPageIndexChanged="GridAccountQueue_PageIndexChanged"
                        AutoGenerateColumns="false" PageSize="10" ShowStatusBar="true" AllowSorting="true"
                        AllowPaging="true" AllowCustomPaging="true" Skin="Simple" AllowFilteringByColumn="true">
                        <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"/>
                        <StatusBarSettings LoadingText="Loading..." />
                        <MasterTableView HeaderStyle-BackColor="Gray" HeaderStyle-ForeColor="White" EnableColumnsViewState="true" TableLayout="Auto">
                            <SortExpressions>
                                <telerik:GridSortExpression FieldName="LastModified" SortOrder="Descending" />
                            </SortExpressions>                  
                            <Columns>
                                <telerik:GridHyperLinkColumn AllowFiltering="false" HeaderText="AC ID" DataTextField="AccountID" DataNavigateUrlFields="AccountID" DataNavigateUrlFormatString="/Administratin/AccountSummary.aspx?id={0}" HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-CssClass="AccountLink" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridHyperLinkColumn>
                                <custom:FilteringByDropDownBoundColumn HeaderText="Rep code" DataField="RepCode" HeaderStyle-Width="6%" ItemStyle-Width="6%" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></custom:FilteringByDropDownBoundColumn>
                                <custom:FilteringByDropDownBoundColumn HeaderText="Registration" HeaderAbbr="Reg." DataField="Registration" HeaderStyle-Width="10%" ItemStyle-Width="10%"></custom:FilteringByDropDownBoundColumn>
                                <custom:FilteringByDropDownBoundColumn HeaderText="Platform" DataField="Platform" HeaderStyle-Width="12%" ItemStyle-Width="12%"></custom:FilteringByDropDownBoundColumn>
                                <custom:FilteringByDropDownBoundColumn HeaderText="Product Type" HeaderAbbr="Prod. Type" DataField="ProductType" HeaderStyle-Width="12%" ItemStyle-Width="12%"></custom:FilteringByDropDownBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Account Holders" HeaderAbbr="Acct. Holders" DataField="AccountHolders" FilterControlWidth="90%" AutoPostBackOnFilter="false"></telerik:GridBoundColumn>
                                <custom:FilteringByDropDownBoundColumn HeaderText="Last Modified" HeaderAbbr="Last Mod." DataField="LastModified"  DataFormatString="{0:M/dd/yyyy h:mm tt}" HeaderStyle-Width="13%" ItemStyle-Width="13%"></custom:FilteringByDropDownBoundColumn>
                                <telerik:GridBoundColumn AllowFiltering="false" HeaderText="Status" DataField="Status" HeaderStyle-Width="15%" ItemStyle-Width="15%"  ></telerik:GridBoundColumn>
                                <telerik:GridButtonColumn ButtonType="ImageButton"  HeaderText="Notes" HeaderStyle-Width="4%" ItemStyle-Width="4%" ImageUrl="../Images/grid/icon_attachment.gif" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridButtonColumn>
                                <telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Docs" HeaderStyle-Width="4%" ItemStyle-Width="4%" ImageUrl="../Images/grid/icon_attachment.gif" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridButtonColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings>
                            <Resizing AllowColumnResize="true" />
                        </ClientSettings>
                    </telerik:RadGrid>

A couple things are happening. CurrentFilterValue is never set. I'm assuming because I call e.Canceled = true. The dropdownlists also are not saving the user selection on postbacks (also because I cancel the event?)

Any ideas?

Chris
Mira
Telerik team
 answered on 06 Apr 2011
1 answer
86 views
Hi,

Is there any way to increase the width of the drop dwon box poulated, because the the style names render are not fully visible to the users. Please see the attached image for more details.

Also want to customize the editor to have only selective icons/buttons int it.

Thanks & Regards,
Jagadish
Stanimir
Telerik team
 answered on 06 Apr 2011
1 answer
155 views

Greetings,

How i can get SelectedItemIndex in listview to client-side?

Regards,

Vasil
Telerik team
 answered on 06 Apr 2011
5 answers
856 views
Hi,

I want particular index item values in radcombobox in client side. in code behind we have get easily like ddlCountyName.Items(1).Text but how to get the same in client side.

Please give me a tips for this one.


Thanks,
Dhamu.
Shinu
Top achievements
Rank 2
 answered on 06 Apr 2011
3 answers
196 views
Hello,

I am trying to use a custom radfilter datafield editor.  I am not binding the radfilter directly to anything.... i am merely using it to provide the user an interface to create an advanced grouped query - and then using it to get the strongly typed where condition.

the field I am having an issue with is technically a numerical field editor - although the fields they are referring to in the database are bit fields.

as a result, i am trying to only allow the user to choose between the values 0 and 1 through a dropdown box (with displayed values of "true" and "false" instead.

this seems to work.... once.  it will add the field editor once, but when i try to add another expression item, it runs into an error.

it looks like i am not passing on some editor variable from the base object... and possibly missing an override, but i am not sure.

the code for the editor is below:

public class RadFilterBooleanDropDownEditor : RadFilterDataFieldEditor
    {
        protected override void CopySettings(RadFilterDataFieldEditor baseEditor)
        {
            base.CopySettings(baseEditor);
            var editor = baseEditor as RadFilterBooleanDropDownEditor;
            if (editor != null)
            {
                //DataSourceID = editor.DataSourceID;
                //DataTextField = editor.DataTextField;
                //DataValueField = editor.DataValueField;
            }
 
        }
         
        public override System.Collections.ArrayList ExtractValues()
        {
            ArrayList list = new ArrayList();
            list.Add(int.Parse(_combo.SelectedValue));
            return list;
        }
 
        public override void InitializeEditor(System.Web.UI.Control container)
        {
            _combo = new RadComboBox();
            _combo.ID = "MyCombo";
            _combo.Width = System.Web.UI.WebControls.Unit.Pixel(48);
 
            _combo.Items.Add(new RadComboBoxItem("True","1"));
            _combo.Items.Add(new RadComboBoxItem("False","0"));
 
            //container.Controls[1].Visible = false;
 
            container.Controls.Add(_combo);
        }
 
 
        public override void SetEditorValues(System.Collections.ArrayList values)
        {
            if (values != null && values.Count > 0)
            {
                if (values[0] == null)
                    return;
                var item = _combo.FindItemByValue(values[0].ToString());
                if (item != null)
                    item.Selected = true;
            }
        }
 
        public string DataTextField
        {
            get
            {
                return (string)ViewState["DataTextField"] ?? string.Empty;
            }
            set
            {
                ViewState["DataTextField"] = value;
            }
        }
        public string DataValueField
        {
            get
            {
                return (string)ViewState["DataValueField"] ?? string.Empty;
            }
            set
            {
                ViewState["DataValueField"] = value;
            }
        }
        public string DataSourceID
        {
            get
            {
                return (string)ViewState["DataSourceID"] ?? string.Empty;
            }
            set
            {
                ViewState["DataSourceID"] = value;
            }
        }
 
        private RadComboBox _combo;
    }


and the error i get is as follows:

Object reference not set to an instance of an object.
 
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.NullReferenceException: Object reference not set to an instance of an object.
 
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:
 
 
[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.RadFilterDataFieldEditor.CreateEditorFrom(RadFilterDataFieldEditor baseEditor) +9
   Telerik.Web.UI.RadFilterSingleExpressionItem.SetupFunctionInterface(Control container) +55
   Telerik.Web.UI.RadFilterExpressionItem.CreateFunctionalInterface() +89
   Telerik.Web.UI.RadFilterExpressionItem.InitializeItem() +24
   Telerik.Web.UI.RadFilter.CreateFilterItems() +284
   Telerik.Web.UI.RadFilter.CreateControlHierarchy() +34
   Telerik.Web.UI.RadFilter.CreateChildControls() +90
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +20
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +365
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +365
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +365
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +365
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +365
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +365
   System.Web.UI.Page.FindControl(String id) +38
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +287
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +878


any help with troubleshooting this issue would be MUCH appreciated.  thanks!
Mira
Telerik team
 answered on 06 Apr 2011
2 answers
96 views
Hi all,

I have a Radgrid with user defined edit control. I set the edit mode to popup. I have RadTextBoxes, RadDatePicker, RadListBoxes and RadAsyncUpload on it. I gave fixed width and height for the edit control. Everything works fine in FF, but I have few issues with the display in IE7.

These are the problems in IE7:
- On edit record pop up when scroll bars appear, listboxes appear outside the edit control popup. If i click on the listbox, it will arrange itself to correct postion. But when i scroll the scroll bar listbox won't scroll.
-When moving scroll bar on the edit control, the listboxes and async uploader don't scroll, as if they are positioned absolute/fixed, which I didn't do.
-Also, i have added header template to listbox and it is taking most of the height of the listbox height. so, i can't see the items in the list box.

I can send the code to reproduce it, if it helps. Any help is greatly appreciated.

Thanks,
CRS
Pavlina
Telerik team
 answered on 06 Apr 2011
3 answers
116 views
Hello All,

I'm new to Telerik controls. I'm sure this must be a simple one but wasn't able to figure out in the documentation. I would like to bind the combo box with the dataset I create dynamically instead of using SQL object datasource control.

Any help would be appreciated.

Thanks.
Shinu
Top achievements
Rank 2
 answered on 06 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?