Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
125 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
158 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
119 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
284 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
225 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
224 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
7 answers
257 views
Hi, I seem to have bumped into a bug with the RibbonBar control.

When setting SelectedTabIndex having 4 tabs, all of the visible, everything works normally:

Ribbon.SelectedTabIndex = Ribbon.Tabs.IndexOf(Ribbon 
.FindTabByValue("tabName"))

However when I make some tabs invisible (index 0 and 2 in my case), it completely messes up the SelectedTabIndex property:

It defaults to 1, and it seems to be impossible to change. Even having this value it is still inconsistent, showing either tab 1 or 3:

When tab 1 is selected client side and a postback occurs, the selected tab will switch to 3 on the client side after postback and vice versa. 

To make the tabs invisible I use: 
Menu.Tabs(0).Visible = False
Menu.Tabs(2).Visible  = False

Am I making a mistake or is this really a bug? 

Update:  It works when programatically removing the tabs before setting the index. This works for me as I won't need the invisible tabs on the client side or serverside anyway, but I imagine this might cause problems for other people.
Bozhidar
Telerik team
 answered on 24 Sep 2013
2 answers
209 views
Hi, I have a radiobutton outside a Radgrid and checkbox inside a radgrid what I want here is when I click on radiobutton all rows inside radgrid should be selected(checkbox should be selected). Please share if you have sample code.

Thanks,
Naresh
Princy
Top achievements
Rank 2
 answered on 24 Sep 2013
1 answer
308 views
Hi,
  I am using a clientside binding radgrid. i have assigned a button column with a command name. when i click on it i get the following error.
'JavaScript runtime error: Unable to get property 'fireCommand' of undefined or null reference'






Thanks





Angel Petrov
Telerik team
 answered on 24 Sep 2013
1 answer
125 views
Good morning,
In my aspx page I have created in RadGrid(gridboundcolumn) RadToolTip control:
<telerik:GridTemplateColumn HeaderText="Job" DataField="JOB" UniqueName="JOB" ReadOnly="True" SortExpression="JOB" >
                                    <HeaderStyle Width="50px" />
                                    <ItemStyle Width="50px" />
                                    <ItemTemplate>
                                     <asp:Label ID="lblJob" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.JOB") %>'> </asp:Label>
                                     <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="lblJob"
                                      Width="180px" RelativeTo="Element" Position="MiddleRight" RenderInPageRoot="true" Animation="Fade"  HideEvent="LeaveToolTip">
                                      JOB EFFECTIVE DATE:
                                      <%# DataBinder.Eval(Container, "DataItem.EFF_DATE")%>
                                      JOB END DATE:
                                      <%# DataBinder.Eval(Container, "DataItem.END_DATE")%>
                                      JOB RESTRICTION FLAG:
                                      <%# DataBinder.Eval(Container, "DataItem.DATE_RESTRICT")%>

                                     </telerik:RadToolTip>
                                    </ItemTemplate>
                                    </telerik:GridTemplateColumn>
When I run application and point mouse over Job Field the date showing like this:06/08/2009 12:00:00am.How to remove time?I need just a date.

Thank you very much for your help
Princy
Top achievements
Rank 2
 answered on 24 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?