Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
174 views
Hello,

I have RadCaptcha on my page with enabled "Refresh Captcha Image Functionality" but there is one thing if I type wrong captcha I receive error message that's correct then I click on 'Generate new image' and error message still visible but should not be visible because I generate new captcha Image. How can I hide error message when I click on Generate new image link?

Regards.
Princy
Top achievements
Rank 2
 answered on 24 Sep 2013
1 answer
111 views
I am using a raddatetimepicker. On clicking the time picker button, can I display all the time values in a horizontal fashion?
Thanks
Robert
Shinu
Top achievements
Rank 2
 answered on 24 Sep 2013
2 answers
85 views
Hi all,

I use a header context menu to group or ungroup my records in a grid
http://www.telerik.com/help/aspnet-ajax/grid-header-context-menu.html

and I use GroupByExpressions to order by my records.

When I click GroupBy menu at the first time, in event MyRadGrid_NeedDataSource, I get GroupByExpressions by doing the following codes:
MyRadGrid.MasterTableView.GroupByExpressions. But at this time, GroupByExpresssions is empty. I expected that this time there is a record
of GroupByExpresssions.

When I click GroupBy menu again, At this time, GroupByExpressions has one record.???

So my questions are
- Can I get GroupByExpressions when I click on GroupBy menu at the first time ? and How ?
- If Not, Is there any way to workaround this issue ?

Thanks.
Eyup
Telerik team
 answered on 24 Sep 2013
3 answers
304 views
Hi, 

I am trying to achive the below behaviour in RadTreeView at client side.

When uncheck the select All1, all the child nodes should collapse upto First Level which is "Contract1 and Contract2" in my case but presently it is collapsing upto root level "Select All 1" which is incorrect.

For your covenience, I have attached the snap shot and the piece of working code, please have a look and help me to find out the way to achieve this required behaviour.

PFA -  radreeview_desiredbehaviour.png

Hrml and Javascript Markup -
 
<script type="text/javascript">
 
        function OnClientNodeClicked(sender, eventArgs) {
            var tree = $find("<%=RadTreeView1.ClientID %>");
 
            var currentNode = eventArgs.get_node();
            var currentNodeText = currentNode.get_textElement().innerHTML;
            var allNodes = currentNode.get_allNodes();
            var allNodesCount = allNodes.length;
 
            if (currentNode.get_checked())
            {
                for (var i = 0; i < allNodes.length; i++)
                {
                    allNodes[i].set_checked(true);
                    currentNode.set_checked(true);
                    allNodes[i].expand();
                    currentNode.expand()
                }
            }
            else if (!currentNode.get_checked())
            {
                if (currentNodeText == "Select All 1")
                {
                    for (var i = 0; i < allNodesCount; i++)
                    {
                        if (allNodes[i].get_level() == 1)
                        {
                            allNodes[i].expand();
                            currentNode.expand()
                        }
                        else
                        {
                            allNodes[i].set_checked(false);
                            currentNode.set_checked(false);
                            allNodes[i].collapse();
                            currentNode.collapse();
                        }
                    }                                       
                }
            }
            else
            {
                for (var i = 0; i < allNodes.length; i++) {
                    allNodes[i].set_checked(true);
                    currentNode.set_checked(true);
                }
            }
        } 
 
    </script>
  <telerik:RadTreeView ID="RadTreeView1" runat="server" EnableEmbeddedBaseStylesheet="false"
        EnableEmbeddedSkins="false" CheckBoxes="true" OnClientNodeChecked="OnClientNodeClicked">
        
    </telerik:RadTreeView>
 
 
Server Side Code -
 
public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RenderNodes();
            }
        }
 
        protected void RenderNodes()
        {
            List<Contract> contracts = GetData();
            RadTreeNode selectAllContracts = new RadTreeNode("Select All 1");
            RadTreeView1.Nodes.Add(selectAllContracts);
            foreach (Contract contract in contracts)
            {
                RadTreeNode contracNode = new RadTreeNode(contract.Text);
                AddPlanNode(contract, contracNode);
                selectAllContracts.Nodes.Add(contracNode);
            }
            RadTreeView1.ExpandAllNodes();
            RadTreeView1.CheckAllNodes();
        }
 
        private static void AddPlanNode(Contract contract, RadTreeNode contracNode)
        {
            RadTreeNode selectAllPlans = new RadTreeNode("Select All 2");
            contracNode.Nodes.Add(selectAllPlans);
 
            foreach (Plan plan in contract.Plans)
            {
                RadTreeNode planNode = new RadTreeNode(plan.Text);
                selectAllPlans.Nodes.Add(planNode);
 
                AddAdapterNode(plan, planNode);
            }          
        }
 
        private static void AddAdapterNode(Plan plan, RadTreeNode planNode)
        {
            RadTreeNode selectAllAdapters = new RadTreeNode("Select All 3");
            planNode.Nodes.Add(selectAllAdapters);
 
            foreach (Adapter adapter in plan.Adapters)
            {
                RadTreeNode adapterNode = new RadTreeNode(adapter.Text);
                selectAllAdapters.Nodes.Add(adapterNode);
            }
            
        }
 
 
        #region Dummy Data
        private List<Contract> GetData()
        {
            Plan plan1 = new Plan { Text = "Plan1", Adapters = new List<Adapter> { new Adapter { Text = "Adapter1-1" }, new Adapter { Text = "Adapter1-2" } } };
            Plan plan2 = new Plan { Text = "Plan2", Adapters = new List<Adapter> { new Adapter { Text = "Adapter2-1" }, new Adapter { Text = "Adapter2-2" } } };
            Contract contract1 = new Contract { Text = "Contract1", Plans = new List<Plan> { plan1, plan2 } };
 
            Plan plan3 = new Plan { Text = "Plan3", Adapters = new List<Adapter> { new Adapter { Text = "Adapter3-1" }, new Adapter { Text = "Adapter3-2" } } };
            Plan plan4 = new Plan { Text = "Plan4", Adapters = new List<Adapter> { new Adapter { Text = "Adapter4-1" }, new Adapter { Text = "Adapter4-2" } } };
            Contract contract2 = new Contract { Text = "Contract2", Plans = new List<Plan> { plan3, plan4 } };
 
            List<Contract> contracts = new List<Contract> { contract1, contract2 };
            return contracts;
        }
 
        public class Contract
        {
            public string Text { get; set; }
            public List<Plan> Plans { get; set; }
        }
 
        public class Plan
        {
            public string Text { get; set; }
            public List<Adapter> Adapters { get; set; }
        }
 
        public class Adapter
        {
            public string Text { get; set; }
        }
        #endregion
    }
Boyan Dimitrov
Telerik team
 answered on 24 Sep 2013
1 answer
139 views
Is there a way that we can append a query string to an image, when telerik load the images? I have a caching issue. Please let me know how to fix this
Konstantin Dikov
Telerik team
 answered on 24 Sep 2013
3 answers
173 views

Hi,

I have a bit of javascript to populate my RadListBox from WebService when the page is displayed for the first time. Based on some properties in the returned data I want to add imageUrl and/or cssClass to the RadListBoxItems i create. This is what I've come up with:

-aspx:

<telerik:RadListBox ID="_rlbBrokers" runat="server" Skin="Default" PersistClientChanges="true"  
        SelectionMode="Multiple" height="200" /> 

-javascript:

refreshBrokers: function() {  
        var me = this;  
        var brokersList = me.get_brokersList();  
        this.clearBrokers();  
        this.clearWarehouses();  
        Ewita.WebServices.WarehousesService.GetBrokerItems(this._get_includedBrokerTypes(), this._get_includedWarehouseTypes(), this._permission, this._selectionMode, function(result) {  
            var brokersList = me.get_brokersList();  
            var items = brokersList.get_items();  
            brokersList.trackChanges();  
            var selected = false;  
            for (var i = 0; i < result.length; ++i) {  
                var broker = result[i];  
                var brokerItem = new Telerik.Web.UI.RadListBoxItem();  
                brokerItem.set_text(broker.Name);  
                brokerItem.set_value(broker.ID);  
                items.add(brokerItem);  
                if (broker.IsSelected) {  
                    brokerItem.select();  
                    selected = true;  
                }  
                var li = brokerItem.get_element();  
                if (!broker.IsUserPermitted && !broker.IsActive) {  
                    brokerItem.set_imageUrl("/images/inactive_not_permitted.jpg");  
                    Sys.UI.DomElement.addCssClass(li, "inactive_not_permitted");  
                }  
                else if (!broker.IsActive) {  
                    brokerItem.set_imageUrl("/images/inactive.jpg");  
                    Sys.UI.DomElement.addCssClass(li, "inactive");  
                }  
                else if (!broker.IsUserPermitted) {  
                    brokerItem.set_imageUrl("/images/not_permitted.jpg");  
                    Sys.UI.DomElement.addCssClass(li, "not_permitted");  
                }  
            }  
            brokersList.commitChanges();  
            if (selected) {  
                me._brokersSelect();  
            }  
        });  
    }, 

It all works perfect until I click a button which causes a postback. I've set PersistClientChanges to true and items, and items selection is preserved, but any css class and image url set in javascript disappears.

Is there a way to get around this problem?

I'm using Telerik Controls for ASP.NET AJAX v.2009.2.906.20 (tested also on v.2009.02.826.35), Opera 10.0 browser, .NET Framework 3.5 and Visual Studio 2008.

Thanks in advance.

regards 

Paweł Aszklar

Bozhidar
Telerik team
 answered on 24 Sep 2013
1 answer
132 views
I have read through the documentation, but what I want to do doesn't seem to be covered...which seems a little strange as not everyone wants to use AJAX or a window to edit records.

What I would like to is is have custom edit/delete links in each grid row that open up 2 separate (webforms) pages for editing and deleting records respectively. I do NOT want to use a custom control or to use rad window but would like to load a completely enw page. How do I do this within rad Grid?

Many thanks
Simon
Angel Petrov
Telerik team
 answered on 24 Sep 2013
4 answers
322 views
Simple question  :)

Is it possible to assign a name to the Excel file worksheet created via RadGrid.MasterTableView.ExportToExcel() ?  I've noticed that the sheet automatically gets the same name as the given filename, but I would like to be able to change that.


Daniel
Telerik team
 answered on 24 Sep 2013
1 answer
238 views
Hi,

I have used multiple telerik editors in a table row and on click of a radio button I am required to disable the editor and enable it on the click of another radio button. 
For disabling the editor I have tried various methodologies like adding "disabled" and "readonly" attributes(both attributes together and also singularly) but this has not helped me to disable it completely. This does disable the header section of the editor but not its content area which I mainly need.
 
<% Html.Telerik().Editor()
        .Name("txtArea")
        .Tools(tools => tools
            .Clear()
            .Bold().Italic().Underline()
            .JustifyLeft().JustifyCenter().JustifyRight()
            .InsertUnorderedList().InsertOrderedList()
            .Indent().Outdent()
 
          ).HtmlAttributes(new
          {
              style = "display:inline;height:50;width:500;",
              @readonly="readonly",
              @disabled="disabled"
 
          })
         .ClientEvents(events => events.OnChange("change"))
        .Value(HttpUtility.HtmlDecode(EnglishWording))
        .Render();
                    %>


However on partial postback of the table(html table containing the editor) rendering the editor again results in the disabling of the editor(its content area section) and I am again not able to return to its enabled state - by removing any readonly or disabled attributes. Kindly let me know what would be the correct way of disabling and enabling the editor.
Slav
Telerik team
 answered on 24 Sep 2013
3 answers
243 views
I want to be able to have the size column, have an autocomplete feature to where they would start typing and it would automatically show them the options that they can choose from, and they would need to choose one of them. Also i want to have the Description column also have an autocomplete feature but i want its options to be loaded based on whatever is chosen for the size column. Is this possible? if so, how would i go about doing something like this?

protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["GridData"] == null)
            {
                DataTable table = GetTable();
                Session.Add("GridData", table);
            }
            DefineGridStructure();
        }
 
 
        private void DefineGridStructure()
        {
            RadGrid grid = new RadGrid();
            grid.ID = "RadGrid1";
            grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource);
            grid.AutoGenerateEditColumn = true;
            grid.AutoGenerateDeleteColumn = true;
            grid.AllowAutomaticInserts = false;
            grid.Width = Unit.Percentage(100);
            grid.PageSize = 15;
            grid.AllowPaging = true;
            grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            grid.AutoGenerateColumns = false;
            grid.MasterTableView.Width = Unit.Percentage(100);
            grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom;
            grid.AllowAutomaticDeletes = false;
            grid.AllowAutomaticUpdates = false;
            grid.InsertCommand +=grid_InsertCommand;
            grid.MasterTableView.DataKeyNames = new string[] { "RowNumber" };
            GridBoundColumn boundColumn = new GridBoundColumn();
            boundColumn.DataField = "RowNumber";
            boundColumn.HeaderText = "RowNumber";
            boundColumn.ReadOnly = true;
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Size";
            boundColumn.HeaderText = "Size";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Description";
            boundColumn.HeaderText = "Description";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Quantity";
            boundColumn.HeaderText = "Quantity";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Duration";
            boundColumn.HeaderText = "Duration";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "DurationType";
            boundColumn.HeaderText = "DurationType";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Amount";
            boundColumn.HeaderText = "Amount";
            grid.MasterTableView.Columns.Add(boundColumn);
            PlaceHolder1.Controls.Add(grid);
        }
 
        private void grid_InsertCommand(object sender, GridCommandEventArgs e)
        {
            // Looking to loop through the form so i can insert the values into the datatable
        }
 
 
 
 
 
        void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            DataTable current = (DataTable)Session["GridData"];
            RadGrid grid = (RadGrid)sender;
            grid.DataSource = current;
 
        }
 
 
 
        static DataTable GetTable()
        {
            //
            // Here we create a DataTable with a few columns.
            //
            // Create Datatable to store all colums
            DataTable dt = new DataTable();
            DataRow dr = null;
            dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
            dt.Columns.Add(new DataColumn("Size", typeof(string)));
            dt.Columns.Add(new DataColumn("Description", typeof(string)));
            dt.Columns.Add(new DataColumn("Quantity", typeof(string)));
            dt.Columns.Add(new DataColumn("Unit", typeof(string)));
            dt.Columns.Add(new DataColumn("Duration", typeof(string)));
            dt.Columns.Add(new DataColumn("DurationType", typeof(string)));
            dt.Columns.Add(new DataColumn("Amount", typeof(string)));
            dr = dt.NewRow();
            dr["RowNumber"] = 1;
            dr["Size"] = string.Empty;
            dr["Description"] = string.Empty;
            dr["Quantity"] = string.Empty;
            dr["Unit"] = string.Empty;
            dr["Duration"] = string.Empty;
            dr["DurationType"] = string.Empty;
            dr["Amount"] = string.Empty;
            dt.Rows.Add(dr);
            return dt;
        }
Vasil
Telerik team
 answered on 24 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?