Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
132 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
371 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
157 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
112 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
321 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
3 answers
170 views
I have no idea really what I did to cause this. The popup RadWindow has strange visual glitches in the title bar area. I just wanted to make a basic, normal RadWindow as a popup from clicking a button in the parent page.

Here's the code for the popup window BatchAccounts.aspx:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title>Add Batch Accounts</title>
    <link href="/Styles/mainLight.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }
 
        function CloseAndRebind(args) {
            GetRadWindow().BrowserWindow.refreshGrid(args);
            GetRadWindow().close();
        }
 
        function returnToParent() {
            var oArg = new Object();
            //get a reference to the current RadWindow
            var oWnd = GetRadWindow();
            oWnd.close();
        }
 
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="mainArea">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1" IsSticky="true" />
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="LoadingPanel1">
            Add Batch Accounts TEST
        </telerik:RadAjaxPanel>
    </div>
    </form>
</body>
</html>
Phil
Top achievements
Rank 1
 answered on 19 Oct 2011
2 answers
177 views

I get this error when I try to filter on the first column in my grid:

is neither a DataColumn nor a DataRelation for table DefaultView.

<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderText="PO #" Visible="true">
 <ItemTemplate>
<asp:Label ID="lblPONumber" Text='<%# Eval("_PONumber") %>' runat="server">
</
asp:Label>
</
ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>

I am not sure what to give you so I am giving you the ASPX for the first column. 
Any ideas on why this error is occurring?

Thanks,
Chuck

Jayesh Goyani
Top achievements
Rank 2
 answered on 19 Oct 2011
2 answers
146 views
I'm using this demo http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx?product=upload&RadUrid=bc55435e-4358-4e8f-9b36-bc35d69be555 as my model.  Of course, I have to switch it up a bit to use data from my back-end, and we're trying to create a library of many doc types, not just images, so my EditForm is created and handled a bit differenly.

It seems as if it's working pretty well, but I'm having a problem:  On either update or insert, the EditForm doesn't disappear after the ajax postback is through. The grid does re-display with the new data, so things are working.  I've just munged something up where the EditForm doesn't go away.

Anyway, can someone point me in the right direction, please?  I don't see in the demo what makes the EditForm go away which I've (apparently) lost.

Thank you,

Scott
golddog
Top achievements
Rank 1
 answered on 19 Oct 2011
4 answers
191 views
Hello,

I have a situation where users are creating a single never ending recurrence on the scheduler then editing the appointment each week to account for small variances in attributes or resources. This is not a problem except that the "exception" string continues to grow with each change. Currently I have the length of the recurrencerule at 2048 bytes and I don't think the correct solution is to keep extending that columns size.

My preferred solution would be to do something like count the number of exceptions created. I think there are some examples demonstrating a way to do this using parsing and something like "parsedrule.Occurrences". If the count is higher than 50 then I would like to create a new appointment which is a copy of the appointment being modified "newappt = e.appointment" then remove all exceptions from the new appointment and set it with a start date one day past the last exception in the old appointment. Then I would like to change the old appointment from a never ending recurrence to have an end date on the date of its last exception.

Does that make sense?

I've pretty much got it worked out except the copy, creation and modification steps. Is there any easier way to do this? If not, can you give me some pointers to proceed with my concept above?

Thanks!
Plamen
Telerik team
 answered on 19 Oct 2011
1 answer
159 views
Hi,

for those who would like to have custom context menu trigger element this post might be helpful:
http://weblogs.asp.net/evovision/archive/2011/10/14/customizing-radtreeview-adding-custom-context-menu-trigger.aspx

I've attached a file with 3 screenshots.

To Telerik support:
in that post I write:Note that when you click on "gear" highlighting of node item may disappear. This will happen if EnableDragAndDrop is not set or false. I haven't though how to solve that because in my use case I have EnableDragAndDrop="true", but I will ask Telerik support about possible solution.

Could you please provide missing adjustments so that no matter what value is set to EnableDragAndDrop property highlighting doesn't go away. I guess it's because when it's not set control thinks that it should remove highlight after click event, but when value is set control assumes that drag'n'drop operation may happen and preserves highlighting. I have it enabled in my project (not because of this :), so currently can't spend more time on it.

Thank you!
Plamen
Telerik team
 answered on 19 Oct 2011
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?