Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
398 views
Dear friends,

I tried to use 2 column radcombobox with "product name" and "product code". data filed is ID column. For 50 or 100 records its fine. but 1000 entries and 2 column are killing people on local computer and also on server. I tried to implement  "google like" search, as you type web service would list available products, I succeeded but its also slow and some client computers says:

Windows Internet Explorer
---------------------------
Stop running this script?

A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become
unresponsive.


I dont know why this message appears but, at the moment I dont care. All I need to solve is 2 column searchable fast combobox. I also tried to use regular radcombo with 1 column only (productname) its also slow, even while dropping down.

Can someone confirms this situation is normal ? What kind of searchable THING should I use. Is the radcombobox wrong component for this ?

best regards.

heres the code:

                <telerik:RadComboBox ID="cboProducts" runat="server"
                    DataSourceID="SqlDataSourceProducts" DataTextField="productname"
                    DataValueField="guidid" Filter="StartsWith">
                </telerik:RadComboBox>
    <asp:SqlDataSource ID="SqlDataSourceProducts" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringNET %>"
        ProviderName="<%$ ConnectionStrings:ConnectionStringNET.ProviderName %>" DataSourceMode="Dataset"
        EnableCaching="true"
        SelectCommand="SELECT guidid, [productname], productcode FROM productsORDER BY [productname]">
        <SelectParameters>
        </SelectParameters>
    </asp:SqlDataSource>

Dimitar Terziev
Telerik team
 answered on 20 Oct 2011
1 answer
107 views
Basically, I want the type of animation featured in "Buttons" or "ButtonsOver", and I want to be able to scroll one index at a time.  I have 4 items displayed out of 6 possible, with wrap frames on.  Due to the nature of the web page that I'm displaying, that's exactly what I want.

When I have 'buttons' turned on, and I click one of my image buttons, the control scrolls 6 indexes in that direction.  The result is something that looks very awkward and strange.  


<telerik:RadRotator ID="RadRotator1" CssClass="bottom-Rotator" runat="server" Width="600px"
    ItemWidth="150" WrapFrames="true" ScrollDuration="500" PauseOnMouseOver="true" RotatorType="Buttons"
    ControlButtons-LeftButtonID="img_left" ControlButtons-RightButtonID="img_right">
</telerik:RadRotator>

In conclusion, that's the animation style I want, and I do want to be able to click the control buttons to have to move the items in the control.  But I want to scroll 1 index at a time, and not 6.

Moving onto ButtonsOver....

This lets me scroll one index at a time.  Cool, exactly what I want.  However, this happens when I mouse-over the buttons, and not when I click.  This makes it awkward if I want to visit this site using a smartphone, because, in order to scroll, I have to touch the arrow buttons, then touch off the buttons in order to stop the scrolling.

Basically what I would like is the ability to scroll one index at a time as if using buttonsOver, but only when I click the arrow keys, as in using buttons.  But there seems to be no way to do that, unless I am wrong, and I hope I am.  It seems weird to me that there is no way to control how many indexes I bypass when I click an arrow image.

I could select "FromCode", and use javascript/vb.net functions to manually change the index, but wouldn't I lose my animation then?

In conclusion, I'm looking for a solution that scrolls the items one at a time, when I click one of the set images, and still gives me the scrolling animation that's like "ButtonsOver".  Is that possible with this control?
Slav
Telerik team
 answered on 20 Oct 2011
1 answer
148 views
I want to create interface similar to this example http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectedvalue/defaultcs.aspx

How can i add following thing in above example
1. Multiple row selection on master grid 
example.. if i select customer ALFKI and ANATR on master grid
detail grid display order belong to above two customer
2. display multiple selected order ID in label or textbox  

 Thanks
Shinu
Top achievements
Rank 2
 answered on 20 Oct 2011
1 answer
216 views

Hello,

Is there a way to select the GridHyperLinkColumn row via the designer when clicking the particular link in the designer for the grid?  If not, how would I accomplish this task via server-side code?

I have attached the designer code for my grid.

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="GridStyle">
<tr>
    <td>
        <telerik:RadGrid ID="RadGridDrillDown" runat="server" 
            AutoGenerateColumns="false" AllowSorting="True" AllowPaging="true" Skin="Simple" ClientSettings-Resizing-AllowColumnResize="true"
            ItemStyle-Wrap="false" Width="95%" HeaderStyle-Wrap="false" PageSize="10"
            OnNeedDataSource="RadGridDrillDown_NeedDataSource" OnItemDataBound="RadGridDrillDown_ItemDataBound">
            <PagerStyle Mode="NumericPages" />
            <ClientSettings>
                <Scrolling AllowScroll="true" UseStaticHeaders="true"  />
            </ClientSettings>
            <MasterTableView TableLayout="Fixed" AllowMultiColumnSorting="true" DataKeyNames="SampleDetailId" ShowFooter="false" PagerStyle-AlwaysVisible="false" >
                <NoRecordsTemplate>
                    <asp:Label ID="lblMsg" runat="server" Text="No Records found"></asp:Label>
                </NoRecordsTemplate>
                <Columns>
                    <telerik:GridHyperLinkColumn HeaderText="Order #" HeaderButtonType="TextButton" DataTextField="OrderNumber" DataTextFormatString="{0}" 
                        DataNavigateUrlFields="SampleDetailId" DataNavigateUrlFormatString="CustomerSearch.aspx?SampleDetailId={0}" HeaderStyle-Width="100" />
                    <telerik:GridBoundColumn HeaderText="Type" HeaderButtonType="TextButton" DataField="Category2" HeaderStyle-Width="100" />
                    <telerik:GridBoundColumn HeaderText="Status" HeaderButtonType="TextButton" DataField="OrderStatus" HeaderStyle-Width="200" />
                    <telerik:GridDateTimeColumn HeaderText="Ship Date" HeaderButtonType="TextButton" DataField="ShipDate" DataFormatString="{0:dd/MM/yyyy}" HeaderStyle-Width="200" />
                    <telerik:GridBoundColumn HeaderText="First Name" HeaderButtonType="TextButton" DataField="RequestorFirstName" HeaderStyle-Width="200" />
                    <telerik:GridBoundColumn HeaderText="Last Name" HeaderButtonType="TextButton" DataField="RequestorLastName" HeaderStyle-Width="200" />
                    <telerik:GridBoundColumn HeaderText="PD" HeaderButtonType="TextButton" DataField="RequestorPd" HeaderStyle-Width="50" />
                    <telerik:GridBoundColumn HeaderText="Facility Name" HeaderButtonType="TextButton" DataField="InstitutionName" HeaderStyle-Width="200" />
                    <telerik:GridBoundColumn HeaderText="State" HeaderButtonType="TextButton" DataField="RequestorState" HeaderStyle-Width="100" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </td>
</tr>
</table>


Thanks,

Princy
Top achievements
Rank 2
 answered on 20 Oct 2011
1 answer
87 views
Hi,

I'm using RadScheduler in Month view, but when creating a new appointment, I'd like the "All Day" checkbox to default to unchecked.

How can I do this?

Thanks,
Jason
Jason
Top achievements
Rank 1
 answered on 20 Oct 2011
2 answers
131 views
Hi,
i am using the default out of the box Advanced form template, i am not sure how to debug this issue?
can someone please guide me?
[NullReferenceException: Object reference not set to an instance of an object.] Telerik.Web.UI.AdvancedTemplate.GetResources(String resType) +135 Telerik.Web.UI.AdvancedTemplate.PopulateResourceControl(RadComboBox resourceControl, String resType, Boolean addNullValue) +212 Telerik.Web.UI.AdvancedTemplate.CreateResourceControls(Control container) +918 Telerik.Web.UI.AdvancedTemplate.CreateAppointmentAdvancedControls() +949 Telerik.Web.UI.AdvancedTemplate.CreateControls(Control container) +80 Telerik.Web.UI.AdvancedTemplate.InstantiateIn(Control container) +138 Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +1981 Telerik.Web.UI.RadScheduler.CreateChildControls() +42 System.Web.UI.Control.EnsureChildControls() +145 System.Web.UI.Control.PreRenderRecursiveInternal() +60 System.Web.UI.Control.PreRenderRecursiveInternal() +223 System.Web.UI.Control.PreRenderRecursiveInternal() +223 System.Web.UI.Control.PreRenderRecursiveInternal() +223 System.Web.UI.Control.PreRenderRecursiveInternal() +223 System.Web.UI.Control.PreRenderRecursiveInternal() +223 System.Web.UI.Control.PreRenderRecursiveInternal() +223 System.Web.UI.Control.PreRenderRecursiveInternal() +223 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3393
CH
Top achievements
Rank 1
 answered on 20 Oct 2011
4 answers
365 views
I have a RadGrid whose skeleton is defined in the aspx page but the columns are defined at runtime.

<telerik:RadGrid ID="rgResult" runat="server" CellPadding="2" CellSpacing="2" AutoGenerateColumns="false" EnableViewState="false"
    AllowPaging="true" PageSize="25" AllowSorting="true" AllowMultiRowSelection="true"
    OnItemDataBound="rgResult_ItemDataBound" OnSortCommand="rgResult_SortCommand">
 
    <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="Bottom"></PagerStyle>
 
    <ClientSettings EnableRowHoverStyle="true">
        <Selecting AllowRowSelect="true"></Selecting>
        <ClientEvents OnRowSelected="RowSelected" OnRowDeselected="RowDeselected" />
    </ClientSettings>
 
</telerik:RadGrid>


The columns are added when the user hits filter button, which shows only the columns that the user wants to see.

private void DesignRadGrid()
{
    rgResult.MasterTableView.Columns.Clear();
 
    var arrColumns = GetSelectedColumns();
    var arrPropertyInfo = typeof(MyObject).GetProperties(BindingFlags.Public | BindingFlags.Instance);
     
    var vColumns = from col in arrColumns.AsParallel().AsOrdered()
                    join pi in arrPropertyInfo.AsParallel() on col.Name equals pi.Name
                    select new
                            {
                                col.ColumnId,
                                col.DisplayName,
                                col.Name
                            };
     
    foreach (var oColumn in vColumns)
    {
        var boundColumn = new GridBoundColumn
                                {
                                    HeaderText = oColumn.DisplayName,
                                    DataField = oColumn.Name,
                                    SortExpression = oColumn.Name
                                };
         
        ... (format field according to datatype) ...
         
        rgResult.MasterTableView.Columns.Add(boundColumn);
    }
}


Now when I change the value in PageSize textbox in the pager section and click the button, the page size does not change. However, if I define the columns manually in the design page itself and not dynamically then it works fine.

So I added a OnPageSizeChanged event but it doesn't get fired. I haven't tried this with undynamic columns.

Thanks.
Baal
Top achievements
Rank 1
 answered on 19 Oct 2011
2 answers
154 views
OnRowDblClick doesnt fire Radgrid in Edit Mode.
I read a lot of post but i didnt found the solution.

I attach image of grid!
This is My code:

File.Cs
public partial class Communities : System.Web.UI.Page
  {

    #region Properties&Variables

    private Organization _organization;
    private string _culture;
    private ResourceManager _recources;

    #endregion

    #region Events

   
    protected void Page_Load(object sender, EventArgs e)
    {
        GetInfo();

        if (!Page.IsPostBack)
        {
            LoadSettings();
        }
    }

    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        LoadData();
    }
      
    protected void RadGrid1_DeleteCommand(object sender, GridCommandEventArgs e)
    {
      var communityId = ((GridDataItem) e.Item).GetDataKeyValue("Id").ToString();

      _organization = new Organization
      {
        Community = new Community { Id = Convert.ToInt16(communityId) }
      };


      if (_organization.CommunityHasUser())
      {
        RadWindowManager1.RadConfirm("The Community has associated users. <br> If you delete Community, then users associated will deleted too. <br> Delete this Community?", null, 330, 100, null, "Community and Users");

      }

      _organization.RemoveCommunity();
    }

    protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
    {
        if (!Page.IsValid) return;

        GridEditableItem item = e.Item as GridEditableItem;
        if (item != null)
        {
           
            Hashtable values = new Hashtable();
            item.ExtractValues(values);

            _organization = new Organization();

            _organization.Community = new Community
            {
               
                Name = values["Name"] == null ? null : values["Name"].ToString(),
                Description = values["Description"] == null ? null : values["Description"].ToString()

            };
        }
        _organization.CreateCommunity();

    }

    protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
    {
      if (!Page.IsValid) return;

      GridEditableItem item = e.Item as GridEditableItem;
      if (item != null)
      {
        var communityId = item.GetDataKeyValue("Id");
        Hashtable values = new Hashtable();
        item.ExtractValues(values);

          _organization = new Organization
                              {
                                  Community = new Community
                                                  {
                                                      Id = Convert.ToInt16(communityId),
                                                      Name = values["Name"] == null ? null : values["Name"].ToString(),
                                                      Description =
                                                          values["Description"] == null
                                                              ? null
                                                              : values["Description"].ToString()
                                                  }
                              };
      }
      _organization.UpdateCommunity();
    }

    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {

      this.RadGrid1.MasterTableView.GetColumnSafe("RowIndicator").Display = false;

    }

    protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)
    {
        GridEditableItem item = (GridEditableItem)e.Item;
        String id = item.GetDataKeyValue("Id").ToString();

        if (e.Exception != null)
        {
            e.KeepInEditMode = true;
            e.ExceptionHandled = true;
           
        }
      
    }

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
      if (_recources == null || _culture == null) GetInfo();

      if (e.Item is GridDataItem )
      {
          if (e.EventInfo is GridItemCreated) return;
          if (e.Item.ItemIndex < 0) return;

          ImageButton editLink = (ImageButton)e.Item.FindControl("EditLink");
          editLink.AlternateText = _recources.GetString(editLink.ID, new CultureInfo(_culture));
          editLink.Attributes["href"] = "#";

          editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"], e.Item.ItemIndex);
      }

        GridCommandItem item = e.Item as GridCommandItem;
       if(item != null)
       {
           Label lblQuickAdd = ((Label)item.FindControl("lblQuickAdd"));
           lblQuickAdd.Text = _recources.GetString(lblQuickAdd.ID, new CultureInfo(_culture));

           Label lblFullAdd = ((Label)item.FindControl("lblFullAdd"));
           lblFullAdd.Text = _recources.GetString(lblFullAdd.ID, new CultureInfo(_culture));
       }
       


        /*validations*/

        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            for (int i = 2; i < RadGrid1.MasterTableView.Columns.Count; i++)
            {
                if (RadGrid1.MasterTableView.Columns[i].IsEditable && RadGrid1.MasterTableView.Columns[i].UniqueName.ToLower() == "name" )
                { AddRequiredValidator(RadGrid1.MasterTableView.Columns[i].UniqueName, e);
                AddCustomValidator(RadGrid1.MasterTableView.Columns[i].UniqueName, e);
                }
              
            }

        }
    }

    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
      if (e.Argument == "Rebind")
      {
        RadGrid1.MasterTableView.SortExpressions.Clear();
        RadGrid1.MasterTableView.GroupByExpressions.Clear();
        RadGrid1.Rebind();
      }
      else if (e.Argument == "RebindAndNavigate")
      {
        RadGrid1.MasterTableView.SortExpressions.Clear();
        RadGrid1.MasterTableView.GroupByExpressions.Clear();
        RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;
        RadGrid1.Rebind();
      }
    }

    protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.EditCommandName)
        {
            Session["ID"] = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"];
        }

        if (e.CommandName == RadGrid.InitInsertCommandName) //"Quick add new" button clicked
        {
          
            GridTemplateColumn fulledit = (GridTemplateColumn)RadGrid1.MasterTableView.GetColumn("TemplateEditColumn");
            fulledit.Visible = false;
        }
        else if (e.CommandName == RadGrid.RebindGridCommandName && e.Item.OwnerTableView.IsItemInserted)
        {
            e.Canceled = true;
        }
        else
        {
          
            GridTemplateColumn fulledit = (GridTemplateColumn)RadGrid1.MasterTableView.GetColumn("TemplateEditColumn");
            if (!fulledit.Visible)
                fulledit.Visible = true;
            
        }
    }
    #endregion

    #region Methods


    private void AddCustomValidator(string colName, GridItemEventArgs e)
    {
        GridEditableItem itemEditable = e.Item as GridEditableItem;

        if (itemEditable != null)
        {
            GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)itemEditable.EditManager.GetColumnEditor(colName);
            TableCell cell = (TableCell)editor.TextBoxControl.Parent;

            CustomValidator validator = new CustomValidator();
            editor.TextBoxControl.ID = colName;
            validator.ControlToValidate = editor.TextBoxControl.ID;
            validator.CssClass = "validator";
            validator.Display = ValidatorDisplay.Dynamic;
            validator.ErrorMessage = _recources.GetString("cv" + colName, new CultureInfo(_culture));
            validator.ServerValidate += cvName_ServerValidate;
            cell.Controls.Add(validator);
        }
    }

    protected void cvName_ServerValidate(object sender, ServerValidateEventArgs e)
    {
        _organization = new Organization();
        e.IsValid = !_organization.ExistCommunityName(e.Value.ToString(), GetId());
    }

    private int GetId()
    {
        return Convert.ToInt16(Session["ID"] ?? 0);
    }

    private void AddRequiredValidator(string colName, GridItemEventArgs e)
    {
        GridEditableItem itemEditable = e.Item as GridEditableItem;
        if (itemEditable == null) return;

        GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)itemEditable.EditManager.GetColumnEditor(colName);
        TableCell cell = (TableCell)editor.TextBoxControl.Parent;

        RequiredFieldValidator validator = new RequiredFieldValidator();
        editor.TextBoxControl.ID = colName;
        validator.ControlToValidate = editor.TextBoxControl.ID;
        validator.CssClass = "validator";
        validator.Display = ValidatorDisplay.Dynamic;
        validator.ErrorMessage = "*";
        cell.Controls.Add(validator);
    }

    private void SetColumnHeader(string name)
    {
      RadGrid1.MasterTableView.GetColumnSafe(name).HeaderText = _recources.GetString( "lbl" + name , new CultureInfo(_culture));
    }

    private void LoadSettings()
    {
      var type = Request.QueryString["Type"];
      if (string.IsNullOrEmpty(type)) type = "List";

      SetSettings("lblTitileList");

      for (int i =2; i < RadGrid1.MasterTableView.Columns.Count; i++ )
      {
        if (RadGrid1.MasterTableView.Columns[i].IsEditable && RadGrid1.MasterTableView.Columns[i].UniqueName.ToLower() !="id")
          SetColumnHeader(RadGrid1.MasterTableView.Columns[i].UniqueName);
      }


     
         
      GridButtonColumn btndelete = (GridButtonColumn) RadGrid1.Columns.FindByUniqueName("btnDelete");
      btndelete.ConfirmText = _recources.GetString("confirmText", new CultureInfo(_culture));
      btndelete.ConfirmTitle = _recources.GetString("confirmTitle", new CultureInfo(_culture));

      GridSettings();

    
      switch (type)
      {
        case "New":
        
         Page page = HttpContext.Current.CurrentHandler as Page;
 
         if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
         {
           const string prueba = "javascript: window.radopen('CommunityForm.aspx', ''UserListDialog');";
           System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "scriptpop", prueba, true);
         }
          break;
      }
    
    }

    private void GridSettings()
    {
      RadGrid1.ClientSettings.EnablePostBackOnRowClick = true;
      RadGrid1.ClientSettings.AllowColumnsReorder = true;
      RadGrid1.ClientSettings.ReorderColumnsOnClient = true;
      RadGrid1.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Swap;
      RadGrid1.ClientSettings.AllowColumnHide = true;
      RadGrid1.ClientSettings.Resizing.AllowColumnResize = false;
      RadGrid1.ClientSettings.Resizing.AllowResizeToFit = true;
      RadGrid1.ClientSettings.Resizing.EnableRealTimeResize = true;
      RadGrid1.ClientSettings.Resizing.ResizeGridOnColumnResize = true;
      RadGrid1.ClientSettings.Resizing.AllowColumnResize = true;
      RadGrid1.ClientSettings.Resizing.ClipCellContentOnResize = true;
      RadGrid1.Culture = new CultureInfo(_culture);
    }

    private void SetSettings(string resx)
    {
      if (resx != null) lblTitle.Text = _recources.GetString(resx, new CultureInfo(_culture));
    }

    private void LoadData()
    {
      _organization = new Organization();

      try
      {
        RadGrid1.DataSource = _organization.GetCommunities();
      }
      catch (Exception ex)
      {
        WriterLog.WriterinlogFil(ex);
        throw new Exception(ex.ToString());
      }
     
    }
    
    private void GetInfo()
    {
      _culture = App.CurrentCulture();
       _recources = App.GetAdminResources("Communities");
    }
   


     #endregion
  }

File.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/UI/Doculex.Master" AutoEventWireup="true"
    CodeBehind="Communities.aspx.cs" Inherits="WebSearch.UI.Admin.Communities" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
     
           

       
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server" >

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">


            function ShowEditForm(id, rowIndex) {
                var grid = $find("<%= RadGrid1.ClientID %>");

                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);

                var oWindow = window.radopen("CommunityForm.aspx?ID=" + id, "UserListDialog");
                oWindow.SetTitle("Editing Community");

                return false;
            }

            function ShowInsertForm() {
                var oWindow = window.radopen("CommunityForm.aspx", "UserListDialog");
                oWindow.SetTitle("New Community - Full Add");
                return false;
            }


            function ShowQuickInsertForm() {
                var oWindow = window.radopen("CommunityForm.aspx?T=Q", "UserListDialog");
                oWindow.SetTitle("New Community - Quick Add");
                return false;
            }


            function refreshGrid(arg) {
                if (!arg) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
                else {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                }
            }
            function RowDblClick(sender, eventArgs) {
           
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
               

            }
           
            
              
        </script>

    </telerik:RadCodeBlock>   
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"  >
             <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>                            
                </AjaxSettings>
            </telerik:RadAjaxManager>
    <div class="headerPage">
        <asp:Label ID="lblTitle" runat="server"></asp:Label>
    </div>
    <div class="containerSub">
        
            <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
                AllowPaging="True" AllowSorting="True" OnDeleteCommand="RadGrid1_DeleteCommand"
                 AllowFilteringByColumn="True" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand"
                Width="99.8%" PageSize="10" Height="500px" AutoGenerateColumns="False" CellSpacing="0" OnItemCommand="RadGrid1_ItemCommand"
                          OnItemUpdated="RadGrid1_ItemUpdated"
                 GridLines="None" OnPreRender="RadGrid1_PreRender" OnItemCreated="RadGrid1_ItemCreated">

                  <MasterTableView DataKeyNames="Id" CommandItemDisplay="Top"
                    EditMode="InPlace" TableLayout="Fixed" >
                    
                    <Columns>
                         <telerik:GridTemplateColumn UniqueName="TemplateEditColumn"  HeaderStyle-Width="3%"  AllowFiltering="false">
                        <ItemTemplate>
                            <asp:ImageButton ID="EditLink" runat="server"   ImageUrl="~/UI/Images/pencil.png" ></asp:ImageButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                     <telerik:GridEditCommandColumn HeaderStyle-Width="3%" UniqueName="EditCommandColumn"  ButtonType="ImageButton" EditImageUrl="../Images/grid_edit.png">
                       
                    </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn UniqueName="btnDelete" ConfirmDialogType="RadWindow"
                            ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="300px"
                            HeaderStyle-Width="3%" />
                        <telerik:GridTemplateColumn DataField="Id" HeaderText="Id" UniqueName="Id" Visible="false">
                            <InsertItemTemplate>
                                <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("Id") %>' Width="150px"
                                    ReadOnly="true" Enabled="false" />
                            </InsertItemTemplate>
                            <EditItemTemplate>

                                <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Eval("Id") %>' ReadOnly="true"
                                    Width="150px" />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="Name" UniqueName="Name" ColumnEditorID="editorName" />
                        <telerik:GridBoundColumn DataField="Description" UniqueName="Description" ColumnEditorID="editorDescription"  />                       
                    </Columns>
                   
                      <CommandItemTemplate>
                        <div style="width: 100%">
                            <div style="width: 10%; margin-left: 12px; float: left">
                             <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" ><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/UI/Images/add.png" /> <asp:Label ID="lblQuickAdd" runat="server" /></asp:LinkButton>&nbsp;&nbsp; </div><div style="width: 10%; float: left">
                                <a href="#" onclick="return ShowInsertForm();">
                                    <asp:ImageButton ID="imgAddFull" runat="server" ImageUrl="~/UI/Images/add.png" />
                                    <asp:Label ID="lblFullAdd" runat="server" />
                                </a>
                            </div>
                        </div>
                    </CommandItemTemplate>
                         
                
                 
                         </MasterTableView>    
                                 <ClientSettings >
                        <ClientEvents OnRowDblClick="RowDblClick"   />
                    </ClientSettings>                                           
                             <PagerStyle Mode="NumericPages" />
            </telerik:RadGrid>
          <telerik:GridTextBoxColumnEditor ID="editorName" runat="server" TextBoxStyle-Width="200px" />             
            <telerik:GridTextBoxColumnEditor ID="editorDescription" runat="server" TextBoxStyle-Width="200px" />  
         <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow ID="UserListDialog" runat="server"  Height="600px"
                    Width="850px" Left="15%" ReloadOnShow="true" ShowContentDuringLoad="false"  
                    Modal="true" VisibleStatusbar="True" Behaviors="Close"   />


            </Windows>
        </telerik:RadWindowManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    </div>
</asp:Content>


I use master/details

I need fix this urgent!

Thanks

July
Top achievements
Rank 2
 answered on 19 Oct 2011
2 answers
110 views
Are the <asp:hidden> fields I have assigned to asp.net form inaccessible when I load that window as a child window with RadWindowManager?

When loaded on its own, my form can access the hidden fields using the getElementById() method.  However, when the form is launched as a Popup window with RadWindowsManager null is returned when the same script is executed.  Is this an ASP.Net issue, or do I need to do something differently clientside, such as obtain the RadWindow first via the API.  Thanks in advance.
Vinil Kumar
Top achievements
Rank 1
 answered on 19 Oct 2011
2 answers
316 views
Hi Telerik,

Could I please have an example where the 'OnFocus' and 'OnBlur' events are successfully called after being applied to a RadListBox? I've tried numerous different approaches and none of them seem to work.

Sean

EDIT: Had to set the TabIndex property per HTML5 documentation -- http://www.w3.org/TR/html5/editing.html#attr-tabindex

EDIT2: Okay, so after playing around with this for a bit, I'm still not quite where I would like to be. I would like to attach a blur event to a dynamically created RadListBoxItem.

var listboxItem = radListBox.get_selectedItem();
 
$(listboxItem.get_element()).blur(function () {
    console.log("Item blurred.");
});

doesn't fire anything. What's the proper procedure?

EDIT3: So I've got something that works (mostly) but I'm not happy with... I can already think of one scenario it won't work in, in fact, but I figured I'd update.

So, the RadListBox's OnClientSelectedIndexChanged event seemed like a good place to start. I came to the conclusion that there's proooobably not a good way to set the focus to a RadListBoxItem. So, I've got this:

function OnClientSelectedIndexChanged(sender, eventArgs) {
    console.log("ClientSelectedIndexChanged");
    $telerik.$(radListBox1._getGroupElement()).focus();

which will set focus to the radListBox responsible for the OnClientSelectedIndexChanged event. Unfortunately, this isn't quite sufficient for my purposes.

My goal is this:

I have a button on the page which has two states: 'Edit Text' or 'Add Item'. When a RadListBoxItem is focused I want the button to say 'Edit Text'. When the user clicks away from that item I want it to say 'Add Item.' The above code will work for some scenarios, but consider the following:

  • User has a RadListBox with room for 4 RadListBoxItems to be displayed.
  • The RadListBox contains only 2 RadListBoxItems.
  • The user selects the first RadListBoxItem. OnSelectedIndexChanged fires, and the jquery sets the RadListBox to focused.
  • The user then clicks on a blank area of the RadListBox. Since the object is focused -- this doesn't change anything, but it 'feels' like to the user like they've clicked away from the item. Hence, the button should say 'Add Item'.

Ideally in that scenario I would deselect the item after detecting the blur event, but without the RadListBox blurring this is impossible...

Any advice on how to improve this design would be appreciated. Thanks.


Sean
Top achievements
Rank 2
 answered on 19 Oct 2011
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?