Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
59 views
Hi I am working on a project which has a user control containing a Telerik Tree View on a page, with an information panel on the main page. The user can traverse the tree in the usercontrol which contains folders and items, and if they click an item it loads the information for that item into the main page.

This is handled by using delegates in the user control, and subscribing to that bubbled event in the master page.

I have wrapped this up with a RadAjaxManager, and I want the information panel to have a LoadingPanel displayed over it ONLY when an item is selected, but not a folder. In the user control we do not raise the event if the item is a folder.

I haven't had any luck with this.

I have created a project which displays this behaviour. You can see that when the folders are clicked they also display the loading panel over the main panel, which is what I want to prevent. This is because in production environment, clicking a folder expands the folder but does not reload the main information, but having the loading panel put over it gives the user the impression that it is reloaded.

Can you please help me get this working?

My project contains two files, Default.aspx and FolderView.ascx

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="testlab" TagName="treeview" Src="~/FolderView.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
 
    <telerik:RadScriptManager id="RadScriptManager1" runat="server" />
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="pnlTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlTreeView1" />
                    <telerik:AjaxUpdatedControl ControlID="pnl1" LoadingPanelID="LoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Skin="Windows7" />
 
    <div>
    <table>
        <tr>
        <td valign="top">
            <asp:Panel ID="pnlTreeView1" runat="server">
                <testlab:treeview runat="server" id="treeview1" OnItemSelected="treeview1_ItemSelected">
                </testlab:treeview>
            </asp:Panel>
        </td>
        <td valign="top">
            <asp:Panel ID="pnl1" runat="server" Width="450" Height="450">
                Select a node.<br />
                <asp:Label ID="lbl1" runat="server" />
            </asp:Panel>
        </td>
        </tr>
    </table>
    </div>
    </form>
</body>
</html>

Default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void treeview1_ItemSelected(object sender, LAB_FolderView.ItemSelectedEventArgs e)
    {
        lbl1.Text += e.SeletedItemText + " clicked, category = " + e.StorageItemType + "<br/>";
    }
}

FolderView.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FolderView.ascx.cs" Inherits="LAB_FolderView" %>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server" />
<div style="border:solid 1px black;">
<telerik:RadTreeView
    ID="RadTreeView1"
    runat="server"
    OnNodeExpand="RadTreeView1_NodeExpand"                     
    OnNodeClick="RadTreeView1_NodeClick"
    Width="300" Height="300"
>
    <Nodes>
        <telerik:RadTreeNode Value="FRUIT" Text="Fruit" Expanded="false" Category="FOLDER" ImageUrl="folder.gif" ExpandedImageUrl="FolderOpen.gif">
            <Nodes>
                <telerik:RadTreeNode Value="ORANGE" Text="Orange" Category="ITEM"/>
                <telerik:RadTreeNode Value="BANANA" Text="Banana" Category="ITEM"/>
                <telerik:RadTreeNode Value="APPLE" Text="Apple" Category="ITEM"/>
                <telerik:RadTreeNode Value="TAMARILLO" Text="Tamarillo" Category="ITEM"/>
            </Nodes>
        </telerik:RadTreeNode>
        <telerik:RadTreeNode Value="VEGETABLE" Text="Vegetable" Expanded="false" Category="FOLDER" ImageUrl="folder.gif" ExpandedImageUrl="FolderOpen.gif">
            <Nodes>
                <telerik:RadTreeNode Value="LETTUCE" Text="Lettuce" Category="ITEM"/>
                <telerik:RadTreeNode Value="POTATO" Text="Potato" Category="ITEM"/>
                <telerik:RadTreeNode Value="BROCCOLI" Text="Brocolli" Category="ITEM"/>
                <telerik:RadTreeNode Value="ONION" Text="Onion" Category="ITEM"/>
            </Nodes>
        </telerik:RadTreeNode>
    </Nodes>
</telerik:RadTreeView>
<div id="divDebug" runat="server" />
</div>

FolderView.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik;
using Telerik.Web.UI;
 
public partial class LAB_FolderView : System.Web.UI.UserControl
{
 
    #region Event Bubbling
 
    public enum StorageFolderItemType
    {
        FOLDER,
        ITEM
    }
 
    public class ItemSelectedEventArgs : EventArgs
    {
        public string SelectedItemsValue { get; set; }
        public string SeletedItemText { get; set; }
        public StorageFolderItemType StorageItemType { get; set; }
    }
    public class ItemDeletedEventArgs : EventArgs
    {
        public string SelectedItemsValue { get; set; }
        public string SeletedItemText { get; set; }
        public StorageFolderItemType StorageItemType { get; set; }
    }
     
//  Item Selected
    public delegate void ItemSelectedEventHandler(object sender, ItemSelectedEventArgs e);
    public event ItemSelectedEventHandler ItemSelected;
    protected virtual void OnItemSelected(RadTreeNodeEventArgs e)
    {
         
        ItemSelectedEventArgs args = new ItemSelectedEventArgs();
        args.SelectedItemsValue = e.Node.Value;
        args.SeletedItemText = e.Node.Text;
        args.StorageItemType = e.Node.Category == "FOLDER" ? StorageFolderItemType.FOLDER : StorageFolderItemType.ITEM;
        ItemSelected(this, args);
    }
 
    #endregion
 
 
 
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        Debug(e.Node.Text + " clicked, category = " + e.Node.Category);
        if (e.Node.Category == "ITEM")
        {  
        //  LoadIDPDevelopmentNeedItem(Int32.Parse(e.Node.Value.TrimStart("I".ToCharArray())), VIEW_MODE.VIEW);
            OnItemSelected(e);
        }
    }
    protected void RadTreeView1_NodeExpand(object sender, RadTreeNodeEventArgs e)
    {
        Debug("NodeExpand called on " + e.Node.ID);
    }
 
    protected void Debug(object o)
    {
        divDebug.InnerHtml += o.ToString() + "<br/>";
    }
 
}

 

Iana Tsolova
Telerik team
 answered on 24 Oct 2011
1 answer
33 views
On Clicking 'F11' page moves up and does not readjust to complete page height.
This problem comes when we update to latest version of telerik Q2.

Please suggest to remove this issues..


Dobromir
Telerik team
 answered on 24 Oct 2011
3 answers
104 views
Greetings,

I studied this :

http://www.telerik.com/support/kb/aspnet-ajax/grid/using-radwindow-for-editing-inserting-radgrid-records.aspx

This is working perfectly but i need to send the row ID to a radwindow not to edit data but to display informations from another table using this ID.

Thanks in advance for your help

Adigard
Top achievements
Rank 1
 answered on 24 Oct 2011
0 answers
24 views
Hello,
 
       (I have AjaxPanel placed inside ContentPlaceHolder under some page which includes AjaxLoadingPanel  targetting by AjaxPanel.
 I placed many control inside AjaxPanel during postback event AjaxLoadingPanel will be loaded).


       Now I have two ContentPlaceHolder under Master-Page. One ContentPlaceHolder as Menu with MenuItem say delete, Add, Save  and another ContentPlaceHolder will hold all the controls associated with some page with whom this Masterpage is referenced.
     Whenever I click menu-Item say delete button, under respective page which is active and with whom this Masterpage  is associated should show AjaxLoadingPanel.

  Briefly: I have to fire AjaxLoadingPanel under some page, using control placed under MasterPage whenever I required.

(We are evaluating asp.net ajax)
Please help me on this Regards,
Gautham

     

 




gautham
Top achievements
Rank 1
 asked on 24 Oct 2011
3 answers
290 views
hi

Im facing here some dilema , I am using the radupload control to push some files to the server , they will be dropped in some folder i defined in the control with  TargetFolder , i have subscribed the FileExists event handler to check if some file with the same name exists on target everything is fine till here, the thing is that when a file is renamed to not overwrite another in the destination folder i cannot update its new name on the radupload control let me explain
void RadUpload1_FileExists(object sender, Telerik.Web.UI.Upload.UploadedFileEventArgs e)
       {
           int counter = 1;
           UploadedFile file = e.UploadedFile;
           string targetFolder = Server.MapPath(this.RadUpload1.TargetFolder);
           string targetFileName = System.IO.Path.Combine(targetFolder,
               file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
           while (System.IO.File.Exists(targetFileName))
           {
               counter++;
               targetFileName = System.IO.Path.Combine(targetFolder,
                   file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
           }
           file.SaveAs(targetFileName);
           file.FileName = System.IO.Path.GetFileName(targetFileName); // <---- this line here
            }

i need this because later i loop through uploaded files , and do some more processing on them ... i can think on several ways to go arround this but isnt conceptually wrong not beeing able to update the filename ???

thanks for your time , and i hope im not missing something obvious
Dimitar Terziev
Telerik team
 answered on 24 Oct 2011
1 answer
60 views

I’ve tried the following to clear all selection from a TreeList:

tlConfig.SelectedItems.Clear()

 

Nothing was removed from the selected collection. I then used the brute force method and it works:

For Each selectedItem As TreeListDataItem In tlConfig.SelectedItems

    selectedItem.Selected = False

Next

 

Am I missing something with the Clear() method?

Thanks,
Paul

Marin
Telerik team
 answered on 24 Oct 2011
1 answer
261 views
I'm not sure if anyone's asked about this specific issue before but I wasn't able to find it when I searched.  I'm trying to use a combobox as an autocomplete textbox using EnableLoadOnDemand but when I type into it it keeps giving me the javascript error: "There is no assigned data source.  Unable to complete callback request."  I was working when I first put it in but I can't seem to get it back to the way it was when it worked.  Is there anything anyone can think of that I can look at as to why it wouldn't be working.  These are the settings that I am setting in the codebehind.

combo.EnableAutomaticLoadOnDemand = true
combo.ItemsPerRequest = 15
combo.EnableVirtualScrolling = true
combo.ShowMoreResultsBox = true
combo.ShowDropDownOnTextboxClick = true
Princy
Top achievements
Rank 2
 answered on 24 Oct 2011
1 answer
103 views
Hi

I am trying the RadScheduler for ASP.NET AJAX.

Scheduler displays the appointments correctly, however, I am receiving an 404 error from a WebResource request.

I managed to decrypt the request parameters and found that it says:

pTelerik.Web.UI.Skins|Telerik.Web.UI.Skins.Office2010Blue.Scheduler.rsAppointmentBg.png

Anybody has a clue how can this 404 error be corrected?

Regards
Arian
Shinu
Top achievements
Rank 2
 answered on 24 Oct 2011
1 answer
69 views
I'm getting an error: get_postBackElement().id' is null or not an object. This only occurs when I add in the RadAjaxManager, so I'm fairly sure it has something to do with that. This doesn't seem all that complicated. Am I missing something?

ASPX 

    <telerik:RadAjaxManager ID="RadAjaxManager222" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Timer1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="improvementRadGrid" LoadingPanelID="improvementLoading" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
 
 
<h1> Improvement Day Inventory </h1>
<br />
 
<telerik:RadAjaxLoadingPanel ID="improvementLoading" runat="server" />
<telerik:RadGrid ID="improvementRadGrid" runat="server" AutoGenerateColumns="false" DataSourceID="inventoryDataSource">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" />
            <telerik:GridBoundColumn DataField="Count" HeaderText="Quanitity" HeaderStyle-Font-Bold="true" ItemStyle-Font-Bold="true" />
            <telerik:GridBoundColumn DataField="MinimumQuantity" HeaderText="Min" />
            <telerik:GridBoundColumn DataField="MaximumQuantity" HeaderText="Max" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
 
<asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick" />
 
<asp:SqlDataSource ID="inventoryDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AssetWhereConnectionString %>"
SelectCommand="ImprovementDay" SelectCommandType="StoredProcedure"></asp:SqlDataSource>


C#

public void Timer1_Tick(object sender, EventArgs e)
{
    improvementRadGrid.Rebind();
}
Iana Tsolova
Telerik team
 answered on 24 Oct 2011
1 answer
309 views
Hi telerik team,

This is my code here Delete command is not working. any body please help me,

aspx page:

<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"  CodeBehind="WebLunchMenu.aspx.cs"   Inherits="FSSAdminUI.WebLunchMenu" Title="Untitled Page" EnableEventValidation="false" %> this is page directive i have used

<telerik:RadGrid ID="gvWeblunchMenuItems" runat="server" Width="100%" CssClass="RadGrid"
                                GridLines="None" AllowPaging="True" PageSize="10" AllowSorting="True" AutoGenerateColumns="False"
                                ShowStatusBar="false" AllowAutomaticDeletes="false" AllowAutomaticInserts="false"
                                AllowAutomaticUpdates="false" HorizontalAlign="NotSet" OnItemDataBound="gvWeblunchMenuItems_ItemDataBound"
                                OnItemCreated="gvWeblunchMenuItems_ItemCreated" Style="margin-top: 0px" >
                                <PagerStyle HorizontalAlign="Center" Mode="NumericPages"></PagerStyle>
                                <MasterTableView CommandItemDisplay="Top" EditMode="PopUp">
                                    <HeaderStyle Font-Bold="true" Font-Names="Arial" />
                                    <Columns>
                                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ConfirmDialogType="RadWindow"
                                            ConfirmText="Do you want to delete the Calander" UniqueName="DeleteColumn" ButtonType="ImageButton"
                                            ImageUrl="~/image/Delete_Grd.png">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="25px"></ItemStyle>
                                        </telerik:GridButtonColumn>
                                        <telerik:GridBoundColumn UniqueName="WebCalID" HeaderText="Web CalID" DataField="WebCalID"
                                            Visible="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="False" ShowFilterIcon="False" HeaderText=" Calendar Name"
                                            UniqueName="TemplateColumn" FilterControlWidth="30px">
                                            <ItemTemplate>
                                                <asp:HiddenField ID="hdWebCalID" runat="server" Value='<%#Eval("WebCalID") %>'></asp:HiddenField>
                                                <asp:LinkButton ID="lbCalendarname" CommandName="Details" runat="server" Text='<%#Eval("Calendarname")%>'></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="150px"></ItemStyle>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="False" ShowFilterIcon="False" HeaderText=" Calendar Type"
                                            UniqueName="TemplateColumn" FilterControlWidth="30px">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCalendarType" runat="server" Text='<%#Eval("calendarType")%>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="150px"></ItemStyle>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn DataField="SchoolNames" AllowSorting="False" ShowFilterIcon="False"
                                            HeaderText=" Assigned Schools" UniqueName="catagoryname" FilterControlWidth="50px">
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="300px"></ItemStyle>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="False" ShowFilterIcon="False" HeaderText="Edit Assigned Schools"
                                            UniqueName="TemplateColumn1" FilterControlWidth="30px">
                                            <ItemTemplate>
                                                <telerik:RadComboBox ID="rcschools" runat="server" Height="150px" Width="110px" DropDownWidth="200px"
                                                    Text="       -  Select  - " HighlightTemplatedItems="true" MarkFirstMatch="true"
                                                    EnableLoadOnDemand="true" Visible="true" OnClientFocus="OnFocus" EnableViewState="true"
                                                    ToolTip="Create" EmptyMessage="select" OnClientDropDownClosing="">
                                                    <ItemTemplate>
                                                        <table width="150px" border="0" cellspacing="1" cellpadding="0">
                                                            <tr>
                                                                <td align="left" width="50px">
                                                                    <asp:CheckBox runat="server" ID="chk1" Checked="false" />
                                                                </td>
                                                                <td align="left" width="150px">
                                                                    <asp:Label ID="lblSchoolname" runat="server" Text='<%#Eval("SchoolName")%>'></asp:Label>
                                                                    <asp:HiddenField ID="hdAvailableSchoolID" runat="server" Value='<%#Eval("Id") %>' />
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        <center>
                                                            <asp:ImageButton ID="imgbtnAssign" ImageUrl="~/image/save_btn.gif" OnClientClick="showdisplaylayer();"
                                                                runat="server" OnClick="imgbtnAssign_click" /></center>
                                                    </FooterTemplate>
                                                </telerik:RadComboBox>
                                                <center>
                                                    <asp:ImageButton ID="imgbtnAS" ToollTip="Click here to Assign schools" BorderWidth="50px"
                                                        ImageUrl="~/image/Picked-Up.gif" runat="server" Visible="false" /></center>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="150px"></ItemStyle>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                    <CommandItemTemplate>
                                        <img src="~/image/AddRecordRad.gif" runat="server" style="cursor: hand;" id="imgShow"
                                            onclick="return ShowInsertForm();" alt="" />
                                        <a href="#" onclick="return ShowInsertForm();">Add new Calander</a>
                                    </CommandItemTemplate>
                                    <CommandItemStyle Height="30px" VerticalAlign="Middle" />
                                </MasterTableView>
                            </telerik:RadGrid>


cs page:


  protected void Page_Load(object sender, EventArgs e)
        {                     
         
            int pPageIndex = Convert.ToInt32(hdPageIndex.Value);
            int pPageSize = Convert.ToInt32(hdPageSize.Value);

            if (Request.QueryString["DistrictID"] != null)
            {
                Session["DistrictID"] = Request.QueryString["DistrictID"].ToString();// 33;
                hdDistrictID.Value = Request.QueryString["DistrictID"].ToString();
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }

           
                getWeblunchMenuItemsByKeyword(txtSearch.Text, pPageIndex, pPageSize);
                hdPopupResult.Value = "False";                      

           
            gvWeblunchMenuItems .DeleteCommand +=new GridCommandEventHandler(gvWeblunchMenuItems_DeleteCommand);
                       
        }

 void gvWeblunchMenuItems_DeleteCommand(object source, GridCommandEventArgs e)
        {
            int pPageIndex = Convert.ToInt32(hdPageIndex.Value);
            int pPageSize = Convert.ToInt32(hdPageSize.Value);
            string pKeyword = txtSearch.Text;

            int webcalID = Convert.ToInt32(((Telerik.Web.UI.GridTableRow)e.Item).Cells[3].Text);
            FSSAdmin.MenuLogic.WebLunchCalendar.DelWebLunchCalendarData(webcalID);
            FSSAdmin.MenuLogic.Cal.DelWebLunchSchedule(webcalID);
                
            getWeblunchMenuItemsByKeyword(txtSearch.Text, pPageIndex, pPageSize);
        }


gvWeblunchMenuItems_DeleteCommand event is not firing.
Shinu
Top achievements
Rank 2
 answered on 24 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?