Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
208 views
Basically it appears that WebKit browsers like Chrome and Safari are triggering requests when they shouldn't (IE and Firefox appear unaffected).This example has a simple RadTextBox with a button which calls an onclick event for a hidden button. Clicking the textbox's button works fine, calling the onlick of the hidden button works fine, but pressing ENTER inside the textbox to issue an ajax request via the hidden button fails to show the loading panel, in fact it does show it, but it immediately hides it due to a back to back requests and responses. After the first ENTER, subsequent ENTERS cause mulitple responses that do not match the number of requests, however the textbox's button will show the loading panel despite having an incorrect number of responses? Can anyone help explain/fix this?

Here is a very simple sample: (Q2-2009 RadAjax.NET Controls)
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebKitTest.aspx.cs" Inherits="WebKitTest" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
  <head runat="server">  
    <title>WebKitTest</title> 
    <telerik:RadStyleSheetManager id="RadStyleSheetManager" runat="server" /> 
  </head> 
  <body> 
    <form id="frmWebKit" runat="server">  
      
        <telerik:RadScriptManager ID="RadScriptManager" runat="server">  
            <Scripts> 
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
            </Scripts> 
        </telerik:RadScriptManager> 
          
        <telerik:RadAjaxManager ID="RadAjaxManager" runat="server" ClientEvents-OnRequestStart="Ajax_OnRequestStart" ClientEvents-OnResponseEnd="Ajax_OnResponseEnd">  
        <AjaxSettings> 
          <telerik:AjaxSetting AjaxControlID="btnHidden">  
            <UpdatedControls> 
              <telerik:AjaxUpdatedControl ControlID="pnlWebKit" LoadingPanelID="RadAjaxLoadingPanel" UpdatePanelRenderMode="Inline" /> 
            </UpdatedControls> 
          </telerik:AjaxSetting> 
        </AjaxSettings> 
        </telerik:RadAjaxManager> 
 
      <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" Skin="Default">  
      </telerik:RadAjaxLoadingPanel>   
 
      <telerik:RadScriptBlock runat="server" ID="RadScriptBlock">  
        <script type="text/javascript">  
          function Ajax_OnRequestStart(sender, args) {  
            var log = document.getElementById('divLog');  
            loglog.innerHTML = log.innerHTML + '<br />Start Request; ID:' + args.get_eventTargetElement().id;  
          }  
 
          function Ajax_OnResponseEnd(sender, args) {  
            var log = document.getElementById('divLog');  
            loglog.innerHTML = log.innerHTML + '<br />End Request; ID:' + args.get_eventTargetElement().id;  
          }  
 
          function txtWebKit_OnKeyDown(event) {  
            if (event.keyCode == 13) {  
              txtWebKit_OnClick();  
            }  
          }  
 
          function txtWebKit_OnClick(sender, args) {  
            var log = document.getElementById('divLog');  
            loglog.innerHTML = log.innerHTML + '<br />';            
            $get('<%= btnHidden.ClientID%>').click();  
          }  
       </script> 
      </telerik:RadScriptBlock> 
              
        <asp:Panel ID="pnlWebKit" runat="server" Width="190px" Height="25px" BorderStyle="Solid" BorderWidth="1px">  
          &nbsp;  
          <telerik:RadTextBox ID="txtWebKit" runat="server" Width="180px" ShowButton="true" onkeydown="txtWebKit_OnKeyDown(event);" > 
          <ClientEvents OnButtonClick="txtWebKit_OnClick" /> 
        </telerik:RadTextBox> 
        </asp:Panel> 
 
      <div style="display:none;">  
        <asp:Button ID="btnHidden" runat="server" Text="HiddenButton" OnClick="btnHidden_Click" /> 
      </div> 
 
      <div id="divLog" runat="server" style="display:block" >    
      </div> 
    
      </form> 
  </body> 
</html> 
 

C#
using System;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
using System.Data;  
using System.Configuration;  
using System.Web.Security;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using Telerik.Web.UI;  
 
public partial class WebKitTest : System.Web.UI.Page  {  
 
  protected void Page_Load(object sender, EventArgs e) {  
  }  
 
  protected void btnHidden_Click(object sender, EventArgs e) {  
    System.Threading.Thread.Sleep(5000);  
    txtWebKit.Text = "Response Complete";  
  }  
 
}  
 
Iana Tsolova
Telerik team
 answered on 06 Apr 2010
10 answers
579 views

Hi there,

Is it possible to localize this control?

Thank you.

EDIT: Never mind ... I thougt that there will be some .resx called FileExplorer. I found what I needed.

Hamdy
Top achievements
Rank 1
 answered on 06 Apr 2010
9 answers
259 views
Hi,

I need to know how to make it possible to reorder the rows in a single rad data grid using grid drag and drop functionality.

I went through live examples as well as few posts in here, yet, couldn't find the solution. all what I'm looking for is to allow users to drag and drop rows to perform reordering and to show the new ordering as well.

It's highly appreciated if you can provide code sample that demonstrate the above scenario, and please don't ask me to view live examples because I already did and couldn't find the solution!

Thanks for your help and assistance in advance :-)

Regards,
Yavor
Telerik team
 answered on 06 Apr 2010
3 answers
297 views
Hi,
     guys i am creating a web control and in this web control,  i am creating a dynamic rad grid But Update command event  is not fire.
    and neither any other command is not working in edit row.
 
     i want to tell you ,  i  am create a object of rad grid and add template fields in a grid on Init event of this webcontrol. edit command is working  fine but update command is not working . and choose  EditMode = InPlace , i am Binding this grid in !Page.Ispostback
and i am also use NeedDataSource event handler.

     Please help me this is urgent .
     Thanks

 override protected void OnInit(EventArgs e)
        {
            radGrid = new RadGrid();

            radGrid.EditCommand += new GridCommandEventHandler(radGrid_EditCommand);
            radGrid.UpdateCommand += new GridCommandEventHandler(radGrid_UpdateCommand);
            radGrid.CancelCommand += new GridCommandEventHandler(radGrid_CancelCommand);
            radGrid.NeedDataSource += new GridNeedDataSourceEventHandler(radGrid_NeedDataSource);
            radGrid.ItemDataBound += new GridItemEventHandler(radGrid_ItemDataBound);
            radGrid.ItemCommand += new GridCommandEventHandler(radGrid_ItemCommand);

            populatePropertyOfGrid();
        }
          public void  populatePropertyOfGrid()
        {
            radGrid.ID = "radGrid";
            radGrid.Skin = this.Skin;
            radGrid.EnableEmbeddedSkins = this.EnableEmbeddedSkins;
            radGrid.Width = Unit.Percentage(100);
            radGrid.AutoGenerateColumns = false;
            radGrid.MasterTableView.EditMode = GridEditMode.InPlace;

            string[] DataKeys = new string[5];
            DataKeys[0] = "PageConfigId";
            DataKeys[1] = "IdDetailSearch";
            DataKeys[2] = "IdSearchSearch";
            DataKeys[3] = "DataflowId";
            DataKeys[4] = "IsMandatoryForExport";

            radGrid.MasterTableView.DataKeyNames = DataKeys;

            GridTemplateColumn gridTemplateEditLink = new GridTemplateColumn();
            gridTemplateEditLink.ItemTemplate = new FeildsGridTemplate(ListItemType.Item, "LinkButton", "linkEdit", Skin, "edit", "Edit", null);
            gridTemplateEditLink.EditItemTemplate = new FeildsGridTemplate(ListItemType.EditItem, "LinkButton", "linkUpdate", Skin, "update", "Update", null);
            gridTemplateEditLink.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateEditLink.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
            gridTemplateEditLink.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            gridTemplateEditLink.ItemStyle.VerticalAlign = VerticalAlign.Middle;
            radGrid.MasterTableView.Columns.Add(gridTemplateEditLink);

            GridTemplateColumn gridTemplateDataElement = new GridTemplateColumn();

            gridTemplateDataElement.ItemTemplate=new FeildsGridTemplate(ListItemType.Item, "Label", "lblDataElement", Skin, "DataElement", "", null);
            gridTemplateDataElement.EditItemTemplate = new FeildsGridTemplate(ListItemType.EditItem , "Label", "lblEditDataElement", Skin, "DataElement", "", null);
            gridTemplateDataElement.HeaderText = "Data Element";
           // gridTemplateDataElement.SortExpression = "DataElement";
            gridTemplateDataElement.DataField = "DataElement";
            gridTemplateDataElement.HeaderStyle.Width = Unit.Pixel(120);
            gridTemplateDataElement.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateDataElement.HeaderStyle.VerticalAlign = VerticalAlign.Middle;

            gridTemplateDataElement.ItemStyle.Width = Unit.Pixel(120);
            gridTemplateDataElement.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            gridTemplateDataElement.ItemStyle.VerticalAlign = VerticalAlign.Middle;

            radGrid.MasterTableView.Columns.Add(gridTemplateDataElement);



            GridTemplateColumn gridTemplateAvail = new GridTemplateColumn();

            gridTemplateAvail.ItemTemplate = new FeildsGridTemplate(ListItemType.Item, "CheckBox", "chkItemAvailable", Skin, "IsAvailable", "", null);
            gridTemplateAvail.EditItemTemplate = new FeildsGridTemplate(ListItemType.EditItem, "CheckBox", "chkEditAvailable", Skin, "IsAvailable", "", null);

            gridTemplateAvail.HeaderText = "Avail.";
           // gridTemplateAvail.SortExpression = "IsAvailable";
            gridTemplateAvail.DataField = "IsAvailable";
            gridTemplateAvail.HeaderStyle.Width = Unit.Pixel(20);
            gridTemplateAvail.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateAvail.HeaderStyle.VerticalAlign = VerticalAlign.Middle;

            gridTemplateAvail.ItemStyle.Width = Unit.Pixel(20);
            gridTemplateAvail.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateAvail.ItemStyle.VerticalAlign = VerticalAlign.Middle;

            radGrid.MasterTableView.Columns.Add(gridTemplateAvail);


}



   public class FeildsGridTemplate : IBindableTemplate    // IBindableTemplate
    {
        ListItemType templateType;
        string addedControlType;
        string controlId;
        string commandName;
        string Skin;
        string columnName;

        object ControlInput;

        public System.Collections.Specialized.IOrderedDictionary ExtractValues(System.Web.UI.Control container)
        {
            OrderedDictionary od = new OrderedDictionary();
            // od.Add("ProviderName", ((TextBox)(((GridEditFormItem)(container)).FindControl("MyTextBox"))).Text);
            return od;
        }



        /// <summary>
        /// This Contructor for populate Item,Footer,Edit Property
        /// </summary>
        /// <param name="type"></param>
        /// <param name="pr_ControlType"></param>
        /// <param name="pr_controlId"></param>
        /// <param name="pr_GridId"></param>
        /// <param name="pr_columnName"></param>
        public FeildsGridTemplate(ListItemType type, string pr_ControlType, string pr_controlId, string pr_Skin, string pr_columnName, string pr_commandName, object pr_ControlInput)
        {
            templateType = type;
            addedControlType = pr_ControlType;
            controlId = pr_controlId;
            Skin = pr_Skin;
            columnName = pr_columnName;
            commandName = pr_commandName;
            ControlInput = pr_ControlInput;
        }


        public void InstantiateIn(System.Web.UI.Control container)
        {
            CheckBox chkBox = new CheckBox();
            LinkButton lnkBtn = new LinkButton();
            //CustomizeTextBox txtBox = new CustomizeTextBox();
            TextBox txtBox = new TextBox();
            Label lbl = new Label();
           // DropDownControl dropDownControl = new DropDownControl();
            System.Web.UI.WebControls.DropDownList dropDownControl = new System.Web.UI.WebControls.DropDownList();


            switch (templateType)
            {
                case ListItemType.EditItem:
                    #region EditItem
                    if (addedControlType == "CheckBox")
                    {
                        chkBox.ID = controlId;
                        chkBox.Text = columnName;
                        container.Controls.Add(chkBox);
                        chkBox.DataBinding += new EventHandler(boolValueEdit_DataBinding); // This Event for bind this object

                    }
                    else if (addedControlType == "TextBox")
                    {
                        txtBox.Width = 150;
                      //  txtBox.Connectionstring = Skin; // This is connection string for dataBase connection
                        txtBox.ID = controlId;
                        txtBox.Text = columnName;
                      
                        txtBox.DataBinding += new EventHandler(txtBoxEditDataBinding);
                        container.Controls.Add(txtBox);
                    }
                    else if (addedControlType == "LinkButton")
                    {
                        HtmlTable table = new HtmlTable();
                        table.Attributes.Add("class", "select_bdr");
                      
                        table.CellPadding = 3;
                        table.CellSpacing = 3;

                        HtmlTableRow tr = new HtmlTableRow();
                        HtmlTableCell td1 = new HtmlTableCell();
                        td1.Style.Value = "border-style:none !important;";

                        HtmlTableCell td2 = new HtmlTableCell();
                        td2.Style.Value = "border-style:none !important;";

                        Label td1GapLeft = new Label();
                        Label td1GapRight = new Label();
                        Label td2GapLeft = new Label();
                        Label td2GapRight = new Label();

                        td1GapLeft.Text = "[";
                        td1GapLeft.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td1GapRight.Text = "]";
                        td1GapRight.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td2GapLeft.Text = "[";
                        td2GapLeft.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td2GapRight.Text = "]";
                        td2GapRight.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        lnkBtn.ID = controlId;
                        lnkBtn.Text = columnName;
                        lnkBtn.Style.Value = "font-size: 10px ! important;color:#0000EE; margin-left:3px; margin-right:3px;";
                        lnkBtn.CommandName = "Update";

                        td1.Controls.Add(td1GapLeft);
                        td1.Controls.Add(lnkBtn);
                        td1.Controls.Add(td1GapRight);
                        tr.Controls.Add(td1);
                       

                        LinkButton linkCancel = new LinkButton();
                        linkCancel.ID = "linkCancel";
                        linkCancel.Text = "cancel";
                        linkCancel.Style.Value = "font-size: 10px ! important;color:#0000EE; margin-left:3px; margin-right:3px;";
                        linkCancel.CommandName = "Cancel";

                        td2.Controls.Add(td2GapLeft);
                        td2.Controls.Add(linkCancel);
                        td2.Controls.Add(td2GapRight);
                        tr.Controls.Add(td2);
                       
                      

                        table.Controls.Add(tr);
                        container.Controls.Add(table);
                    }
                    else if (addedControlType == "Label")
                    {
                        lbl.ID = controlId;
                        lbl.Text = columnName;
                        lbl.DataBinding += new EventHandler(lblEdit_DataBinding);
                        container.Controls.Add(lbl);
                    }
                   else if (addedControlType == "Dropdown")
                    {
                        dropDownControl.ID = controlId;
                        dropDownControl.SkinID = columnName;
                        DropdownPropertyClass dropdownPropertyClass = (DropdownPropertyClass)ControlInput;
                        if (Skin != "")
                        {
                          //  dropDownControl.DropDownListSkin = dropdownPropertyClass.Skin;
                          //  dropDownControl.EnableEmbeddedSkins = dropdownPropertyClass.EnableEmbeddedSkins;
                        }

                      //  dropDownControl.ConnectionString = dropdownPropertyClass.ConnectionString;

                     //  dropDownControl.MainTableCssClass = "select_bdr";

                       dropDownControl.DataTextField= dropdownPropertyClass.DataTextField;
                       dropDownControl.DataValueField = dropdownPropertyClass.DataValueField;

                    //  if (dropdownPropertyClass.DataSource != null)
                    //  {
                          //dropDownControl.DataSource = dropdownPropertyClass.DataSource;
                         // dropDownControl.DataBind();
                      
                    //  }


                     //   dropDownControl.DataBinding += new EventHandler(dropDownControlEdit_DataBinding);
                        container.Controls.Add(dropDownControl);
                    }
                    break;
                    #endregion
                case ListItemType.Item:
                    #region Item
                    if (addedControlType == "CheckBox")
                    {
                        chkBox.ID = controlId;
                        chkBox.Enabled = false;
                        chkBox.Text = columnName;
                        container.Controls.Add(chkBox);
                        chkBox.DataBinding += new EventHandler(boolValue_DataBinding); // This Event for bind this object

                    }
                    else if (addedControlType == "LinkButton")
                    {
                        HtmlTable table = new HtmlTable();
                        table.Attributes.Add("class","select_bdr");
                        
                        table.CellPadding =0;
                        table.CellSpacing =0;

                        HtmlTableRow tr = new HtmlTableRow();
                        HtmlTableCell td1 = new HtmlTableCell();
                        td1.Style.Value = "border-style:none !important;";
                        Label td1GapLeft = new Label();
                        Label td1GapRight = new Label();
                      

                        td1GapLeft.Text = "[";
                        td1GapLeft.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td1GapRight.Text = "]";
                        td1GapRight.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                      
                        lnkBtn.ID = controlId;
                        lnkBtn.Text = columnName;
                        lnkBtn.Style.Value = "font-size: 10px ! important;color:#0000EE; margin-left:3px; margin-right:3px;";
                        lnkBtn.CommandName = "Edit";

                        td1.Controls.Add(td1GapLeft);
                        td1.Controls.Add(lnkBtn);
                        td1.Controls.Add(td1GapRight);
                        tr.Controls.Add(td1);
                      

                     
                        table.Controls.Add(tr);
                        container.Controls.Add(table);

                    }
                    else if (addedControlType == "Label")
                    {
                        lbl.ID = controlId;
                        lbl.Text = columnName;
                        lbl.DataBinding += new EventHandler(lbl_DataBinding);
                        container.Controls.Add(lbl);
                    }
                 
                    #endregion
                    break;
            }

        }


        /// <summary>
        /// This Event for populating Label Text Template Item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbl_DataBinding(object sender, EventArgs e)
        {
            Label lbl = (Label)sender;
            string id = lbl.ID;
            GridDataItem container = (GridDataItem)lbl.NamingContainer;
            if (lbl != null && lbl.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    lbl.Text = Convert.ToString(((DataRowView)container.DataItem)[lbl.Text]);
                }
                catch (Exception ex)
                {

                }
            }
        }


        /// <summary>
        /// This checkbox event of item template
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void boolValue_DataBinding(object sender, EventArgs e)
        {
            CheckBox cBox = (CheckBox)sender;
            GridDataItem container = (GridDataItem)cBox.NamingContainer;
            if (cBox.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    cBox.Checked = (bool)((DataRowView)container.DataItem)[cBox.Text];
                }
                catch (Exception ex)
                {

                }
                cBox.Text = "";
            }

            // cBox.Text = "";
        }

        /// <summary>
        /// This Event to Populate Template Edit Dropdown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void dropDownControlEdit_DataBinding(object sender, EventArgs e)
        {
            RadComboBox dropDownControl = (RadComboBox)sender;
            GridEditableItem container = (GridEditableItem)dropDownControl.NamingContainer;
            if (dropDownControl != null && dropDownControl.SkinID != "")
            {
                try
                {
                    dropDownControl.SelectedItem.Text = Convert.ToString(((DataRowView)container.DataItem)[dropDownControl.SkinID]);
                }
                catch (Exception ex)
                {

                }
            }
        }

        /// <summary>
        /// This checkbox event of Edit template
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void boolValueEdit_DataBinding(object sender, EventArgs e)
        {
            CheckBox cBox = (CheckBox)sender;
            GridEditableItem container = (GridEditableItem)cBox.NamingContainer;
            if (cBox.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    cBox.Checked = (bool)((DataRowView)container.DataItem)[cBox.Text];
                }
                catch (Exception ex)
                {

                }
                cBox.Text = "";
            }

            // cBox.Text = "";
        }


        /// <summary>
        /// This Event for populating Label Text Template Edit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblEdit_DataBinding(object sender, EventArgs e)
        {
            Label lbl = (Label)sender;
            GridEditableItem container = (GridEditableItem)lbl.NamingContainer;
            if (lbl != null && lbl.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    lbl.Text = Convert.ToString(((DataRowView)container.DataItem)[lbl.Text]);
                }
                catch (Exception ex)
                {

                }
            }
        }


        /// <summary>
        /// This event For Binding edit TextBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void txtBoxEditDataBinding(object sender, EventArgs e)
        {
            //CustomizeTextBox txtBoxItem = (CustomizeTextBox)sender;
            TextBox txtBoxItem = (TextBox)sender;
            GridEditableItem container = (GridEditableItem)txtBoxItem.NamingContainer;
            if (txtBoxItem != null && txtBoxItem.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    txtBoxItem.Text = Convert.ToString(((DataRowView)container.DataItem)[txtBoxItem.Text]);
                }
                catch (Exception ex)
                {

                }
            }

        }

    }

    [Serializable()]
    public class DropdownDataSource
    {
        public string PageConfigId = "";
        public DataTable DataSource = null;
   

    }

}



Iana Tsolova
Telerik team
 answered on 06 Apr 2010
3 answers
138 views
Can someone tell me Is it a bug or something else? In the picture, the top value is just output by response.write(radtextbox.ClientID) which is different to ie rendered clientid
Dimo
Telerik team
 answered on 06 Apr 2010
5 answers
158 views
I am trying to add a couple styles to the [Sitefinity] RadEditor "content area" so my anchor tags are highlighted (via background-color css). I'm using the <cssFiles> section of EditorToolsFile.xml to do this and it works great in Firefox/Chrome - but isn't working at all in IE8 or IE7. I've tried deleting my cache, restarting IIS etc but no matter what I try, it seems nothing my external CSS file declares is being rendered/obeyed by IE.

Can anyone help/advise on this?
Rumen
Telerik team
 answered on 06 Apr 2010
1 answer
105 views
Hi,
I have problem with paging in ASP.NET AJAX RadGrid (2009.1). When radgrid is not on first page and I call Rebind() with some narrowing query (result is only one page of records), RadGrid will stuck on non-existent page (eg. Page 11 of 1, Items 110 of 1, Total records 1) and shows NoMasterRecords message.

I must press "go to first page" and then RadGrid starts work correctly. I tried to set RadGrid1.MasterTableView.CurrentPageIndex = 0 after Rebind, but with no luck.

Can you help me? Thank you.

Zdenek

Protected Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick 
 
            Case "search"                     
                    RadGrid1.Rebind() 
                    RadGrid1.MasterTableView.CurrentPageIndex = 0 
 End Select 
 
End Sub 
 
Protected Sub ldsLocality_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles ldsLocality.Selecting 
 
 
            Dim myLocalities = From loc In dc.Localities Order By loc.Customer.Name, loc.Name Select loc 
 
            'Search 
            Dim serachString As String = String.Empty 
            Dim searchTextBox As RadTextBox = CType(CType(RadToolBar1.FindButtonByCommandName("searchText"), RadToolBarButton).FindControl("txtSearch"), RadTextBox) 
            If searchTextBox IsNot Nothing AndAlso searchTextBox.Text <> String.Empty Then 
                myLocalities = myLocalities.Where(Function(q) _ 
                                                q.CustomerID.ToString.Contains(searchTextBox.Text.Trim) Or _ 
                                                q.Comment.Contains(searchTextBox.Text.Trim) Or _ 
                                                q.Comment2.Contains(searchTextBox.Text.Trim) Or _ 
                                                q.Name.Contains(searchTextBox.Text.Trim)) 
            End If 
 
            e.Result = myLocalities 
        End Sub 
Tsvetoslav
Telerik team
 answered on 06 Apr 2010
2 answers
234 views
Hi:

I need to solve this issues on the combobox:

1) When I first load my page, the radcombobox doesnt load any item, it loads them just after the first callback on the page, a callback fired by another control different to the radcombobox. In the first try it shows just the "loading" message but it doesnt return any item.

2) How can I use the onselectindexchanged in the radcombobox using the loadondemand funcionality? I need to load a labels and textboxes after the selectedvalued is changed on the radcombobox, but this event is never fired.

3) I have a master page, in which I have defined a RadScriptManager, RadAjaxLoadingPanel, RadAjaxPanel

4) Inside the RadAjaxPanel, I have a contentplaceholder.

5) In my content pages I have defined a radcombobox like this:
<telerik:RadComboBox ID="cmbUC" runat="server" Height="230px" Width="230px" 
                                                            DropDownWidth="215px" EmptyMessage="Select an UC" HighlightTemplatedItems="true"  
                                                            EnableLoadOnDemand="true" OnItemsRequested="cmbUC_ItemsRequested" ShowWhileLoading="true"> 
                                                            <HeaderTemplate> 
                                                                <table style="width: 200px" cellspacing="0" cellpadding="0"> 
                                                                    <tr> 
                                                                        <td style="width: 40px;"> 
                                                                            Plates</td> 
                                                                        <td style="width: 160px;"> 
                                                                            UC</td> 
                                                                    </tr> 
                                                                </table> 
                                                            </HeaderTemplate> 
                                                            <ItemTemplate> 
                                                                <table style="width: 200px" cellspacing="0" cellpadding="0"> 
                                                                    <tr> 
                                                                        <td style="width: 40px;"> 
                                                                            <%# DataBinder.Eval(Container, "Text")%> 
                                                                        </td> 
                                                                        <td style="width: 160px;"> 
                                                                            <%# DataBinder.Eval(Container, "Attributes['uc']")%> 
                                                                        </td> 
                                                                    </tr> 
                                                                </table> 
                                                            </ItemTemplate> 
                                                        </telerik:RadComboBox> 
                                                        <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="cmbUC" 
                                                            ErrorMessage="!" CssClass="validator"> 
                                                        </asp:RequiredFieldValidator>   

In the server side:
    protected void cmbUC_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) 
    { 
        Tbl01UCCollection _uccollection = new Tbl01UCCollection(); 
 
        _uccollection = cTbl01UC.UnidadCargaCollectionLoadFilter(Convert.ToInt32(Session["sesCompany"]), e.Text); 
 
        foreach (Tbl01UC _uc in _uccollection) 
        { 
            RadComboBoxItem item = new RadComboBoxItem(); 
 
            item.Text = _uc.Plates; 
            item.Value = _uc.Rowid.ToString(); 
 
            item.Attributes.Add("uc", _uc.Descripcion); 
 
            cmbUCItems.Add(item); 
 
            item.DataBind(); 
        } 
    } 
Simon
Telerik team
 answered on 06 Apr 2010
2 answers
134 views
Hey!

I have a question to the binding mechanism and what is better for the performance of my site. I created a website with currently about 6 RadGrids and I bound these grids with different ObjectDataSources. Now the performance is not very well, it takes about 7 seconds until the whole page is loaded and in the database there are only a few rows.

Is there a way to improve this performance and is it a better choice to bind the RadGrids manually in the code behind class?

Thanks for any help!

Simon
Top achievements
Rank 1
 answered on 06 Apr 2010
1 answer
115 views

I am using a RadWindow to show a wizard style dialog.  On the page I have a RadMultiPage and on each pageview I have the controls  and navigation buttons.

The first pageview contains two RadListBoxes.  The first one has autopostback set to true and on the Check event I populate the second listbox.  I have these ajaxified as follows:

<telerik:AjaxSetting AjaxControlID="rlbList1">  
    <UpdatedControls> 
        <telerik:AjaxUpdatedControl ControlID="rlbList1" /> 
        <telerik:AjaxUpdatedControl ControlID="rlbList2" /> 
        <telerik:AjaxUpdatedControl ControlID="lblErrorText" /> 
    </UpdatedControls> 
</telerik:AjaxSetting> 

This works fine, when I click an item in the first list the second list is updated correctly through the callback.

The issues come in when I press the "Next" button on this pageview.  I have it ajaxified as follows:
<telerik:AjaxSetting AjaxControlID="btnNext">  
    <UpdatedControls> 
        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="rlpDisable" /> 
        <telerik:AjaxUpdatedControl ControlID="btnCancel" LoadingPanelID="rlpDisable" /> 
        <telerik:AjaxUpdatedControl ControlID="rlbList1" /> 
        <telerik:AjaxUpdatedControl ControlID="rlbList2" />                          
        <telerik:AjaxUpdatedControl ControlID="rmpMain" /> 
        <telerik:AjaxUpdatedControl ControlID="lblPage1ErrorText" /> 
        <telerik:AjaxUpdatedControl ControlID="lblPage2ErrorText" /> 
    </UpdatedControls> 
</telerik:AjaxSetting> 


This is the code I have in the Next click event method, Page_Load and Init only have code that runs on the initial load.

if (rlbList2.CheckedItems.Count == 0)  
{  
    lblErrorText.Text = "At least one item must be selected.";  
}  
else 
{  
    //Populate items on the second page using selected items on first page  
    _PopulateListOnPage2(rlbList2.CheckedItems.Select(p => p.Value).ToArray());  
    rmpMain.SelectedIndex = 1;  
} 


This causes two "a is undefined" errors in javascript.  If I remove the rlbList# controls from the ajax this stops the javascript errors. 

The other issue is that if an error occurrs and I don't change the mulpage selectedindex, then the buttons disappear.  I've tried it without the loading panel showing over the buttons and the same thing occurs.  Also, if I leave the listboxes in the updated controls collection these will also disappear if the selected pageview doesn't change (I receive the 'a is undefined' errors though). 

But if I switch to the next pageview and come back to this one then everything shows correctly. 

If I remove the Ajax manager then everything works correctly through the postbacks.  So to get around this I removed the Ajax manager and wrapped the MultipPage with a RadAjaxPanel and now everything seems to work correctly.  I would rather not do this though because the loading panel shows over the whole ajax panel control instead of just the controls I want to disable.  Is there something I'm missing with how the ajax manager works with the RadMultiPage or why would my controls be disappearing?


Yavor
Telerik team
 answered on 06 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?