Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
314 views

 

 


I am trying to set conditional RadComboBoxItem visibility using javascript: RadComboBoxItem.hide().  It will work fine without Filter="Contains" enabled on the ComboBox, but when this is turned on, the ComboBox shows the hidden items the second time it is opened.  Is there any way around this.

Thanks,
Thomas

aspx:

 

<telerik:RadComboBox runat="server" ID="rcbTest" Filter="Contains" > 
    <Items> 
        <telerik:RadComboBoxItem Text="Test1" /> 
        <telerik:RadComboBoxItem Text="Test2" /> 
        <telerik:RadComboBoxItem Text="Test3" /> 
        <telerik:RadComboBoxItem Text="Test4" /> 
    </Items> 
</telerik:RadComboBox> 
<asp:CheckBox ID="cbxTest" runat="server" onclick="Test(this);" /> 

javascript:

 
    function Test(cbx) {  
        var rcb = $find('<%=rcbTest.ClientID %>');  
        var items = rcb.get_items();  
        for (var i = 0; i < items.get_count(); i++) {  
            if (i != 2) {  
                if(cbx.checked)  
                    items.getItem(i).hide();  
                else  
                    items.getItem(i).show();  
            }  
                  
        }  
    } 

 

Jesus
Top achievements
Rank 1
 answered on 29 Apr 2011
2 answers
170 views
I have a radgrid where each row is basically a set of drop down boxes and text boxes that the user can edit...they can "Add" new rows of the same control and it should just add a defaulted row of that those controls in edit mode to the bottom of the grid...

When I first bind the Datasource it works fine...binds the one row that exists in the table to the grid..when I add a new row my routine that constructs a new datatable based on the existing rows in the grid and adding a new default row to the bottom works fine...however when it gets rebound to the grid the new row is not in edit mode and the original row is now doubled... (please see attached document for image samples...)



<Telerik:RadGrid ID="rgRuleCompares" runat="server" 
            onitemdatabound="rgRuleCompares_ItemDataBound" 
            EnableLinqExpressions="False" Width="100%" AllowPaging="True" 
            PageSize="10" DataMember="reg_rule_compares" GridLines="None" 
                                    onprerender="rgRuleCompares_PreRender1" 
                                    onitemcommand="rgRuleCompares_ItemCommand" 
                                    onneeddatasource="rgRuleCompares_NeedDataSource1" EnableViewState="true" >
        <MasterTableView DataKeyNames="column_name,comparison_type,comparison_value,start_and_or" CommandItemDisplay="Top" AutoGenerateColumns="False" HeaderStyle-Height="10px" EditMode="InPlace" DataMember="reg_rule_compares" HeaderStyle-CssClass="gridHeader" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" >
            <Columns>
                <Telerik:GridDropDownColumn UniqueName="start_and_or" DataField="start_and_or" HeaderText="Comparison Item" ListDataMember="start_and_or" ListTextField="start_and_or" ListValueField="start_and_or"/>
                <Telerik:GridDropDownColumn UniqueName="column_name" DataField="column_name" HeaderText="Register Column"  ListDataMember="column_names" ListTextField="column_name" ListValueField="column_name"/>
                <Telerik:GridDropDownColumn UniqueName="comparison_type" DataField="comparison_type" HeaderText="Comparison Type"  ListDataMember="comparison_type" ListTextField="comparison_type" ListValueField="comparison_type"/>
                <Telerik:GridBoundColumn UniqueName="comparison_value" DataField="comparison_value" DataType="System.String" HeaderText="Comparison Value"  />
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
    </Telerik:RadGrid>



 protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {             
                DataTable dt = GetEmptyCompareTable();
                dt = AddFirstCompareRow(dt);
                GetCompareData(dt);

                rgRuleCompares.DataBind();
            
            }
        }

protected void rgRuleCompares_ItemCommand(object sender, GridCommandEventArgs e)
        {
            DataTable dt = BuildCompareTableFromGrid();
            dt = AddNewCompareRow(dt);
            GetCompareData(dt);

        }

        private DataTable BuildCompareTableFromGrid()
        {
            int cnt = rgRuleCompares.Items.Count;
            DataTable dt = GetEmptyCompareTable();


            for (int i = 0; i < cnt; i++)
            {
                GridEditableItem editedItem = (GridEditableItem)rgRuleCompares.EditItems[0];
                string val1 = editedItem.OwnerTableView.DataKeyValues[i]["start_and_or"].ToString();
                string val2 = editedItem.OwnerTableView.DataKeyValues[i]["comparison_type"].ToString();
                string val3 = editedItem.OwnerTableView.DataKeyValues[i]["comparison_value"].ToString();
                string val4 = editedItem.OwnerTableView.DataKeyValues[i]["column_name"].ToString();


                DataRow row;
                row = dt.NewRow();
                row["start_and_or"] = val1;
                row["column_name"] = val4;
                row["comparison_type"] = val2;
                row["comparison_value"] = val3;
                dt.Rows.Add(row);


            }
            return dt;
        }

 private DataTable GetEmptyCompareTable()
        {
            DataTable dt = new DataTable();
            DataColumn col;
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "start_and_or";
            dt.Columns.Add(col);
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "column_name";
            dt.Columns.Add(col);
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "comparison_type";
            dt.Columns.Add(col);
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "comparison_value";
            dt.Columns.Add(col);


            dt.TableName = "reg_rule_compares";


            return dt;
        }

 private void GetCompareData(DataTable dt)
        {
            DataSet ds = new DataSet();
            dt.TableName = "reg_rule_compares";
            ds.Tables.Add(dt);
            ds = BuildCompareDropDownTables(ds);
            
            rgRuleCompares.DataSource = ds;
        }

 private DataSet BuildCompareDropDownTables(DataSet ds)
        {
            DataTable dt = new DataTable();
            DataColumn col;
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "comparison_type";
            dt.Columns.Add(col);


            string[] s = { "Contains", "StartsWith", "EndsWith", "=" };


            foreach (string str in s)
            {
                string field = str.ToString();


                DataRow row;
                row = dt.NewRow();
                row["comparison_type"] = field;
                dt.Rows.Add(row);


            }
            dt.TableName = "comparison_type";
            ds.Tables.Add(dt);


            dt = new DataTable();
            
            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "column_name";
            dt.Columns.Add(col);


            string[] s1 = { "Memo", "Payee" };


            foreach (string str in s1)
            {
                string field = str.ToString();


                DataRow row;
                row = dt.NewRow();
                row["column_name"] = field;
                dt.Rows.Add(row);


            }
            dt.TableName = "column_names";
            ds.Tables.Add(dt);


            dt = new DataTable();


            //This adds a column to the table
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "start_and_or";
            dt.Columns.Add(col);


            string[] s2 = { "START", "AND", "OR" };


            foreach (string str in s2)
            {
                string field = str.ToString();


                DataRow row;
                row = dt.NewRow();
                row["start_and_or"] = field;
                dt.Rows.Add(row);


            }
            dt.TableName = "start_and_or";
            ds.Tables.Add(dt);                     


            return ds;
        }

  private DataTable AddFirstCompareRow(DataTable dt)
        {
            DataRow row;
            row = dt.NewRow();
            row["start_and_or"] = "START";
            row["column_name"] = "Memo";
            row["comparison_type"] = "Contains";
            row["comparison_value"] = "";
            dt.Rows.Add(row);


            return dt;
        }


        private DataTable AddNewCompareRow(DataTable dt)
        {
            DataRow row;
            row = dt.NewRow();
            row["start_and_or"] = "AND";
            row["column_name"] = "Memo";
            row["comparison_type"] = "Contains";
            row["comparison_value"] = "";
            dt.Rows.Add(row);

            return dt;
        }


 private void rgRuleCompares_PreRender(object sender, System.EventArgs e)
        {
            
                foreach (GridItem item in rgRuleCompares.MasterTableView.Items)
                {
                    if (item is GridEditableItem)
                    {
                        GridEditableItem editableItem = item as GridDataItem;
                        editableItem.Edit = true;
                    }
                }
                rgRuleCompares.Rebind();
            
        }

 protected void rgRuleCompares_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
           
        }
Matthew
Top achievements
Rank 1
 answered on 29 Apr 2011
1 answer
31 views
I want to use teh "AddNewRecordButton"  because I want to fire off the ItemCommand eventHandler. However, I dont want to have a new row inserted into the grid...I want to run my own function instead...is there a way to do this?


Thanks
Matthew
Top achievements
Rank 1
 answered on 29 Apr 2011
2 answers
140 views
Hello. I'm using the RadEditor control without the toolbars as recommended here:
http://www.telerik.com/community/forums/aspnet-ajax/editor/remove-toolbar.aspx
This works fine, but I'm also trying to show a RadWindow. The style for hiding the
toolbar is causing the RadWindow to not show. I believe the offending style is this.
.RadWindow.RadWindow_Default.rwNormalWindow.rwTransparentWindow 
    { 
        display: none !important; 
    } 

Is it possible to use the RadEditor without a toolbar and show a RadWindow?

Thanks
Scott

Scott Michetti
Top achievements
Rank 1
Iron
 answered on 29 Apr 2011
2 answers
90 views
I need to put a small label between the gridview and the paging buttons of the gridview. I need to display a value in that label that is completely unrealted with the gridview stored proc.This value is coming from a different stored proc. user want to see the value between the gridview and paging buttons, the next and prev buttons. Is it possible to do that.

Any help will be higly apprceciated
Anjali
Top achievements
Rank 1
 answered on 29 Apr 2011
3 answers
212 views

We are using the ListBox control on a common page in our application.  We are using the Move Up, Move Down and Delete features.  This control is used in 508 and non-508 mode.  We are unable to tab into the ListBox no matter what mode we are in.  Is tabbing into this control supported?  Is there a different way to get to the rows of the box without using the mouse?

<telerik:RadListBox ID="rlbFilters" runat="server" AllowDelete="True" 
    AllowReorder="True" Height="100px" Width="450px" OnDeleted="OnCriteriaRemoval" 
    OnReordered="OnCriteriaReorderd" OnClientSelectedIndexChanged="rlbFilters_SelectedIndexChanged"
    AutoPostBackOnReorder="true" AutoPostBackOnDelete="true" Visible="false" >
    <ButtonSettings />
</telerik:RadListBox>


Thank you,
Lindsay

Mike
Top achievements
Rank 1
 answered on 29 Apr 2011
3 answers
83 views
Hi 

I am using several RedHtmlFeild as user controls on my publishing pages and now as i changes the direction of page to rtl, the content inside the RedHtmlFeild is still in ltr direction . What i want is that on editing the page RedHtmlFeild should show content in rtl direction. Please suggest something so that RedHtmlFeild  also supports rtl. Also its urgent.

Thanks
Rajat Jindal
Rumen
Telerik team
 answered on 29 Apr 2011
3 answers
117 views
I use the following method to build a table of all of the current values in a Gridview after any edits may have occured...

private DataTable BuildRenameTableFromGrid()
        {
            int cnt = rgRuleReplace.Items.Count;
            DataTable dt = GetEmptyRenameTable();


            for (int i = 0; i < cnt; i++)
            {
                GridEditableItem editedItem = (GridEditableItem)rgRuleReplace.EditItems[0];
                string val1 = editedItem.OwnerTableView.DataKeyValues[i]["replace_addto"].ToString();
                string val2 = editedItem.OwnerTableView.DataKeyValues[i]["column_name"].ToString();
                string val3 = editedItem.OwnerTableView.DataKeyValues[i]["new_value"].ToString();


                DataRow row;
                row = dt.NewRow();
                row["replace_addto"] = val1;
                row["column_name"] = val2;
                row["new_value"] = val3;
                dt.Rows.Add(row);


            }
            return dt;
        }


Here is the gridview...

 <Telerik:RadGrid ID="rgRuleReplace" runat="server"  
            onitemdatabound="rgRuleReplace_ItemDataBound" 
            EnableLinqExpressions="False" Width="100%" AllowPaging="True" 
            PageSize="10" DataMember="reg_rule_renames" GridLines="None" 
                                    onitemcommand="rgRuleReplace_ItemCommand" 
                                    onprerender="rgRuleReplace_PreRender1"
                                    onneeddatasource="rgRuleReplace_NeedDataSource1" 
                                    EnableViewState="true">
        <MasterTableView DataKeyNames="replace_addto,column_name,new_value" CommandItemDisplay="Top" AutoGenerateColumns="False" HeaderStyle-Height="10px" EditMode="InPlace" DataMember="reg_rule_renames" HeaderStyle-CssClass="gridHeader" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" >
            <Columns>
                <Telerik:GridDropDownColumn UniqueName="replace_addto" DataField="replace_addto" HeaderText="Comparison Item" ListDataMember="replace_addto" ListTextField="replace_addto" ListValueField="replace_addto"/>
                <Telerik:GridDropDownColumn UniqueName="column_name" DataField="column_name" HeaderText="Register Column"  ListDataMember="column_names" ListTextField="column_name" ListValueField="column_name"/>
                <Telerik:GridBoundColumn UniqueName="new_value" DataField="new_value" DataType="System.String" HeaderText="New Value" />
                <%--<Telerik:GridEditCommandColumn ButtonType="LinkButton" EditText="Edit" UniqueName="editbutton" />--%>
                
               


            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
    </Telerik:RadGrid>


But regardless of what the value of the edited column is the only value retrieved is the original value of the column before it was edited.  Any ideas what I'm missing?
Matthew
Top achievements
Rank 1
 answered on 29 Apr 2011
3 answers
95 views
Hi,

I have customized some of the resx files for the Editor and I see the changes I made when I run in Visual Studio, but I do not see them when I publish the site.  I apologize for this basic question, but do I have to deploy the resx files in the App_GlobalResources folder?  I tried setting as Embedded Resource but this did not work.

Thanks.
Rumen
Telerik team
 answered on 29 Apr 2011
2 answers
102 views

Hi,

 I have added resource control which is showing fine in radschedule  advance form. I need to change end date and time according to selected value from the added resource, however unable to find selected index changed event of added resource!! Do I need to implement AdvancedForm.ascx for that or should I use “AdvancedInsertTemplate” “AdvancedEditTemplate”  with normal dropdown?

If I implement second approach getting issue in “AdvancedInsertTemplate” and “AdvancedEditTemplate” while retrieving reoccurrence rules and parent ID…. 

Peter
Telerik team
 answered on 29 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?