Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
33 views
hello people.
i have created an User Control in which i am using telerik grid and all its properties(ascx page)
Now if i am create one aspx page in the same solution and try to use that control its working all fine

but when i copy all the control files in some other solution
some properties are working, some are not like(filtering,paging and skin)
please help me out

thanks
Prince
Prince
Top achievements
Rank 1
 asked on 12 Sep 2012
2 answers
248 views
I load a RadCombo box via a store procedure.  To that list I want to add an "All" item at position 0.

I tried doing it this way:

 

protected void rcbYear_PreRender(object sender, EventArgs e)
        {
            RadComboBox combo = sender as RadComboBox;
            if (ViewState[combo.ClientID] != null)
            {
                var rcbi = new RadComboBoxItem();
                rcbi.Attributes.Add("0", "All");
                combo.Items.Insert(0, rcbi);
                combo.DataBind();
            }
        }

I verified that when the combo box comes in has the values from the store proc.  The method runs normally but the combo ends with the same items as when it came in.

Any ideas?

a.wilks
Top achievements
Rank 1
 answered on 12 Sep 2012
1 answer
118 views
<telerik:RadGrid ID="rgLabelManager" runat="server" Skin="ARC" AutoGenerateColumns="false" 
GridLines="None" AllowSorting="true" AllowPaging="true" PageSize="10" 
OnNeedDataSource="LabelManager_NeedDataSource" OnItemDataBound="LabelManager_ItemDataBound"
OnUpdateCommand="LabelManager_UpdateCommand" OnInsertCommand="LabelManager_InsertCommand">
<
PagerStyle Mode="NextPrevAndNumeric" />        
<MasterTableView Width="100%" AutoGenerateColumns="false" EditMode="InPlace" 
CommandItemDisplay="TopAndBottom">
<Columns>
<telerik:GridTemplateColumn  UniqueName="ContactName" SortExpression="LastName" HeaderText="Contact Name" 
ItemStyle-Width="60%" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <%#((String)DataBinder.Eval(Container.DataItem, "FirstName")).Substring(0,1).ToUpper()%>
<%
#((String)DataBinder.Eval(Container.DataItem, "FirstName")).Substring(1).ToLower()%>   
<%#((String)DataBinder.Eval(Container.DataItem, "LastName")).Substring(0,1).ToUpper()%>
<%
#((String)DataBinder.Eval(Container.DataItem, "LastName")).Substring(1).ToLower()%>
</ItemTemplate>
<EditItemTemplate>

<telerik:RadComboBox ID="rcbContactName" runat="server" EnableVirtualScrolling="true"
ShowMoreResultsBox="true" ItemsPerRequest="10" EnableLoadOnDemand="true" Width="400" 
OnClientItemsRequesting
="GenericRadCombo_OnClientItemsRequesting" 
OnClientItemsRequested
="rcbLookupContact_OnClientItemsRequested" 
OnClientDropDownClosing
="rcbLookupContact_OnClientDropDownClosing">
<
WebServiceSettings Method="LookupContact" Path="~/service/scriptservice.asmx" />
</telerik:RadComboBox> &nbsp;&nbsp;
<asp:LinkButton runat="server" ID="lbAdd" Text="Add New Contact" style="display:none;" 
OnClick="lnkAddContact_Click"></asp:LinkButton>
</EditItemTemplate>
</telerik:GridTemplateColumn> 

I want to access "lbAdd" from Javascript and keep getting error that lbAdd in not in the context. I've tried
$find('<%=lbAdd.ClientID %>')  and 
document.getElementById("<%=lbAdd.ClientID %>")

Please let me know if I'm missing something to access lbAdd - I need to change the display based on different conditions.
Princy
Top achievements
Rank 2
 answered on 12 Sep 2012
3 answers
111 views
Hi All,

      How to make a StackPanel dockable vertically.

Thanks in Advance.
Princy
Top achievements
Rank 2
 answered on 12 Sep 2012
3 answers
168 views
Hello everyone,
I'm searching for a solution to set a DropDownWidth in my GridDropDownColumn.
I'm loading the Grid dynamically, just like this demo and I want to be able to edit and insert data in this Grid.
So there are this GridDropDownColumns and the text is showing in two lines, but I want to be able to set the width so that the text is in one line and the Combobox of this GridDropDownColumns is larger. Is there a solution for this problem?

Thanks in advance,
Esmi
Shinu
Top achievements
Rank 2
 answered on 12 Sep 2012
3 answers
82 views
here my code:
KTFrameworkCusEntities dcc = new KTFrameworkCusEntities();
IQueryable<
udv_Articles> _udvResult;
    public IEnumerable<udv_Articles> getAllArticleByCat(int catid)
    {
  
        //KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
        //_udvPro = null;
        _udvResult = dcc.udv_Articles.Include("udv_Categories").Where(t => t.ArticleID == 99999999);
        loadArticlebyCate(catid);
        return _udvResult.OrderByDescending(t => t.UpdatedDate).ToList();
    }
  
    protected IQueryable<udv_Articles> loadArticlebyCate(int caid)
    {
        //KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
  
        Func<KTFrameworkCusEntities, IQueryable<udv_Articles>> _IEProList = CompiledQuery.Compile((KTFrameworkCusEntities ne) => ne.udv_Articles.Include("udv_Categories").Where(t => t.udv_Categories.CateID == caid));
  
        if (_IEProList(dcc).Count() > 0)
        {
            _udvResult = _udvResult.Concat(_IEProList(dcc));
        }
        IEnumerable<udv_Categories> _IECatList = dcc.udv_Categories.Where(c => c.ParentID == caid);
        if (_IECatList.Count() > 0)
        {
            foreach (var item in _IECatList)
            {
                loadArticlebyCate(item.CateID);
            }
        }
  
        return _udvResult;
    }
 
IQueryable<udv_Categories> _udvResult2;
    public IEnumerable<udv_Categories> getAllCategoriesByCat(int catid)
    {
        //KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
        //_udvPro = null;
        _udvResult2 = dcc.udv_Categories.Where(t => t.CateID == 99999999);
        loadCategorybyCate(catid);
        return _udvResult2.Where(t => t.IsActive == true).OrderBy(t => t.DisplayOrder).ToList();
    }
 
    protected IQueryable<udv_Categories> loadCategorybyCate(int caid)
    {
        //KTFrameworkCusEntities dc = new KTFrameworkCusEntities();
 
        Func<KTFrameworkCusEntities, IQueryable<udv_Categories>> _IEProList = CompiledQuery.Compile((KTFrameworkCusEntities ne) => ne.udv_Categories.Where(t => t.ParentID == caid));
 
        //IEnumerable<udv_Categories> _IEProList = dc.udv_Categories.Where(t => t.ParentID == caid);
        //IEnumerable<udv_Articles> _IEProList = from c in dc.udv_Articles where c.udv_Categories.CateID == caid select c;
        if (_IEProList(dcc).Count() > 0)
        {
            _udvResult2 = _udvResult2.Concat(_IEProList(dcc));
        }
        IEnumerable<udv_Categories> _IECatList = dcc.udv_Categories.Where(c => c.ParentID == caid);
        if (_IECatList.Count() > 0)
        {
            foreach (var item in _IECatList)
            {
                loadCategorybyCate(item.CateID);
            }
        }
        return _udvResult2;
 
    }

<telerik:RadGrid ID="RadGrid1" AllowFilteringByColumn="true" PageSize="20" ShowFooter="True"
    AllowPaging="True" AutoGenerateColumns="false" GridLines="None" ShowStatusBar="true"
    runat="server" OnItemDataBound="RadGrid1_ItemDataBound">
    <GroupingSettings CaseSensitive="false" />
    <MasterTableView EditMode="InPlace" AllowFilteringByColumn="True" ShowFooter="True"
        DataKeyNames="ArticleID" TableLayout="Fixed">
        <Columns>
            <telerik:GridBoundColumn DataField="Title" HeaderText="Tiêu đề" AutoPostBackOnFilter="true"
                CurrentFilterFunction="Contains" ShowFilterIcon="false">
                <HeaderStyle Width="25%" />
            </telerik:GridBoundColumn>
 
           <telerik:GridTemplateColumn DataField="CateID" HeaderText="Danh mục" UniqueName="CateID"
                    HeaderStyle-Width="200px" SortExpression="DisplayOrder">
                    <FilterTemplate>
                        <telerik:RadComboBox ID="RadComboBoxCategories" DataTextField="Title"
                        
                            DataValueField="CateID" Height="100px" AppendDataBoundItems="true"
                            runat="server" >
                            <Items>
                                <telerik:RadComboBoxItem Text="All" />
                            </Items>
                        </telerik:RadComboBox>                          
                    </FilterTemplate>
                    <ItemTemplate>
                       <%# Eval("udv_Categories.Title") %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

if(!ispostback){
  RadGrid1.DataSource = getAllArticleByCat(113);
                RadGrid1.DataBind();
}
 
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridFilteringItem)
        {
            GridFilteringItem item = (GridFilteringItem)e.Item;
            RadComboBox combo = (RadComboBox)item.FindControl("RadComboBoxCategories");
            using (dmsFunction dmsf = new dmsFunction())
            {
                combo.DataSource = getCategoryByParent(113).ToList();
                combo.DataBind();
                combo.AutoPostBack = true;
                combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(combo_SelectedIndexChanged);
            }
        }
    }
 
    void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
       // Custom Filter: Call getAllArticleByCat(Convert.ToInt32(combo.SelectedValue)) to get all Article by Categories
       // Then RadGrid Filter
          // Teach me how... Thanks
    }
Shinu
Top achievements
Rank 2
 answered on 12 Sep 2012
0 answers
76 views
Hi guys,

I have a problem in displaying the data from an sql table in an hierarchic way, as you can see in the screenshot (http://agileprecis.com/db-diagram.jpg), the table tasks will contain endless sub tasks for each task and it's using the referewnce ParentTaskID.

The problem in the grid display is it is displaying the subTasks as a normal row, wil it shouldn't appear unless i expand the specific node.

below is the code i'm using:
<telerik:RadGrid ID="DataGrid" runat="server" ShowStatusBar="True" AllowFilteringByColumn="True"                    AllowAutomaticUpdates="false" Width="100%" AllowAutomaticInserts="false" AllowAutomaticDeletes="false"
AllowPaging="True" PageSize="7" ShowGroupPanel="True">
<MasterTableView AutoGenerateColumns="False" AllowSorting="true" CommandItemDisplay="Top"
AllowAutomaticUpdates="false" AllowAutomaticInserts="false" AllowAutomaticDeletes="false"
HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" DataKeyNames="TaskID, ParentTaskID" Width="100%">
                                                                
<SelfHierarchySettings ParentKeyName="ParentTaskID" KeyName="TaskID" />
<HeaderStyle HorizontalAlign="Center" /><FilterItemStyle HorizontalAlign="Center" />
<NoRecordsTemplate>No Records Found.</NoRecordsTemplate>
<Columns>
<telerik:GridButtonColumn UniqueName="Edit" CommandName="Edit" ButtonType="ImageButton"
 ImageUrl="~/Styles/images/icon_edit.gif" Text="Edit" HeaderText="Edit">
<HeaderStyle Width="35px" HorizontalAlign="center" />
 </telerik:GridButtonColumn>
 
<telerik:GridBoundColumn DataField="TaskID" Visible="True" HeaderText="TaskID" ReadOnly="True"
SortExpression="TaskID" UniqueName="TaskID"></telerik:GridBoundColumn>
                                                                     
<telerik:GridBoundColumn DataField="TaskTitle" HeaderText="TaskTitle" SortExpression="TaskTitle"
UniqueName="TaskTitle"> </telerik:GridBoundColumn>
                                                                     
<telerik:GridBoundColumn DataField="ParentTaskID" HeaderText="ParentTaskID" SortExpression="ParentTaskID"
Visible="True" UniqueName="ParentTaskID"> </telerik:GridBoundColumn>
                                                                 
</Columns>
</MasterTableView>
</telerik:RadGrid>

Thanks for your support
Mike_T
Top achievements
Rank 1
 asked on 11 Sep 2012
5 answers
163 views

I'm using a client-side API to start the spell check process.

I'm using onchange client-side event to launch the SpellCheck dialog.

However, the SpellCheck dialog still appears & says "The spell check is complete!" even there are no misspelled words.

How can I suppress the SpellCheck dialog when there are no mispelled words ?

-JScript-

 

function MultipleTextSource(sources) {
    this.sources = sources;
    this.get_text = function () {
        var texts = [];
        for (var i = 0; i < this.sources.length; i++) {
            texts[texts.length] = this.sources[i].get_text();
        }
        return texts.join("<controlSeparator><br/></controlSeparator>");
    }
    this.set_text = function (text) {
        var texts = text.split("<controlSeparator><br/></controlSeparator>");
        for (var i = 0; i < this.sources.length; i++) {
            this.sources[i].set_text(texts[i]);
        }
    }
}

function spellCheck(obj, field) {
    var sources =
               [
               new Telerik.Web.UI.Spell.HtmlElementTextSource($get(field))
               ];
    var spell = GetRadSpell(obj);
    spell.set_textSource(new MultipleTextSource(sources));
    spell.startSpellCheck();
}

 

-ASPX-

<telerik:RadSpell ID="RadSpell1" runat="server"  />

<asp:TextBox ID="TextBox1" runat="server" />


-Code Behind-

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 TextBox1.Attributes.Add("onchange", "spellCheck('" & RadSpell1.ClientID & "','" & TextBox1.ClientID & "')")

End Sub

 

Martha
Top achievements
Rank 1
 answered on 11 Sep 2012
2 answers
46 views
I run the attached sample and add one expression, then I click the dropdown menu item to switch to select another item, it will throw exception. I cannot find the root cause.

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            DataTable dt = new DataTable();


            dt.Columns.Add("AA");
            dt.Columns.Add("BB");


            for (int i = 0; i < 10; i++)
            {
                DataRow row = dt.NewRow();
                row["AA"] = "AA" + i.ToString();
                row["BB"] = "BB" + i.ToString();


                dt.Rows.Add(row);
            }


            for (int i = 0; i < 10; i++)
            {
                RadFilterDropDownEditor dropDownFieldEditor = new RadFilterDropDownEditor();
                RadFilter.FieldEditors.Add(dropDownFieldEditor);
                dropDownFieldEditor.DataTextField = "AA";
                //dropDownFieldEditor.DataValueField = "BB";
                dropDownFieldEditor.DataSource = dt;
                dropDownFieldEditor.FieldName = "PV Field:[" + dt.Rows[i]["BB"].ToString() + "]";


                //RadFilterTextFieldEditor textFieldEditor = new RadFilterTextFieldEditor();
                //RadFilter.FieldEditors.Add(textFieldEditor);
                //textFieldEditor.FieldName = "Code Field:[" + dt.Rows[i]["AA"].ToString() + "]";
            }
        }
    }


    protected void RadFilter_FieldEditorCreating(object sender, RadFilterFieldEditorCreatingEventArgs e)
    {
        if (e.EditorType == "RadFilterDropDownEditor")
        {
            e.Editor = new RadFilterDropDownEditor();
        }
    }


    protected void RadButton1_Click(object sender, EventArgs e)
    {
        


    }


    public class RadFilterDropDownEditor : RadFilterDataFieldEditor
    {
        private RadComboBox _combo;


        protected override void CopySettings(RadFilterDataFieldEditor baseEditor)
        {
            base.CopySettings(baseEditor);
            var editor = baseEditor as RadFilterDropDownEditor;
            if (editor != null)
            {
                DataSource = editor.DataSource;
                DataTextField = editor.DataTextField;
                DataValueField = editor.DataValueField;
            }
        }


        public override System.Collections.ArrayList ExtractValues()
        {
            ArrayList list = new ArrayList();
            list.Add(_combo.Text);
            return list;
        }


        public override void InitializeEditor(System.Web.UI.Control container)
        {
            _combo = new RadComboBox();
            _combo.ID = "RadComboBoxField";
            _combo.DataTextField = DataTextField;            
            _combo.DataSource = DataSource;
            _combo.DataBind();
            container.Controls.Add(_combo);
        }


        public override void SetEditorValues(System.Collections.ArrayList values)
        {
            if (values != null && values.Count > 0)
            {
                if (values[0] == null) return;


                _combo.Text = values[0].ToString();
            }
        }




        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 DataTable DataSource
        {
            get
            {
                return (DataTable)ViewState["DataSource"] ?? new DataTable();
            }
            set
            {
                ViewState["DataSource"] = value;
            }
        }
    }
}

Tsvetina
Telerik team
 answered on 11 Sep 2012
13 answers
909 views

I am using telerik grid internal sorting functionality.

 

I have set following properties -

AllowNaturalSort="false"

radGrid.MasterTableView.AllowSorting = true;

 

Issue -

If I click on header text of column, data get sorted but if I try to click on image for sorting, sorting is not working only page get postbacks.

Pavlina
Telerik team
 answered on 11 Sep 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?