Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
123 views
I have downloaded and tested the demo from here:

http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/addremovedisable/defaultcs.aspx

This allows click events for adding and deleting nodes in a treeview, and for the treeview to be updated without screen flicker.

However, the demo code doesn't work for me.

For example, if I try to delete a node by clicking on the Delete Node button it doesn't even fire the DeleteButton_Click event.  If I remove the reference to the DeleteButton in the RadAjaxManager, then the event fires, but I then get the screen flicker when the tree is redrawn.

The code is below:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.User.master" EnableViewState="true" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
 
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
 
<asp:Content ID="Content2" EnableViewState="true" ContentPlaceHolderID="MainContent" Runat="Server">
 
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
     <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
          <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="DisableButton">
                    <UpdatedControls>
                         <telerik:AjaxUpdatedControl ControlID="RadTreeView1" LoadingPanelID="RadAjaxLoadingPanel1">
                         </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="EnableAllButton">
                    <UpdatedControls>
                         <telerik:AjaxUpdatedControl ControlID="RadTreeView1" LoadingPanelID="RadAjaxLoadingPanel1">
                         </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="DeleteButton">
                    <UpdatedControls>
                         <telerik:AjaxUpdatedControl ControlID="RadTreeView1" LoadingPanelID="RadAjaxLoadingPanel1">
                         </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="AddButton">
                    <UpdatedControls>
                         <telerik:AjaxUpdatedControl ControlID="RadTreeView1" LoadingPanelID="RadAjaxLoadingPanel1">
                         </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
               </telerik:AjaxSetting>
          </AjaxSettings>
     </telerik:RadAjaxManager>
     <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
     </telerik:RadAjaxLoadingPanel>
 
          <ul class="qsfexAvailableActions">
               <li>
                    <asp:Button ID="DisableButton" runat="server" OnClick="DisableButton_Click"
                         ValidationGroup="DisableRequiresSelection" Text="Disable selected node"></asp:Button>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Select a node first."
                         ControlToValidate="RadTreeView1" Display="Dynamic" ValidationGroup="DisableRequiresSelection"
                         CssClass="validator"></asp:RequiredFieldValidator>
               </li>
               <li>
                    <asp:Button ID="EnableAllButton" runat="server" CausesValidation="False"
                         OnClick="EnableAll_Button" Text="Enable all nodes"></asp:Button>
               </li>
               <li>
                    <asp:Button ID="DeleteButton" runat="server" OnClick="DeleteButton_Click"
                         ValidationGroup="DeleteRequiresSelection" Text="Delete selected node"></asp:Button>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Select a node first."
                         Display="Dynamic" ControlToValidate="RadTreeView1" ValidationGroup="DeleteRequiresSelection"
                         CssClass="validator"></asp:RequiredFieldValidator>
               </li>
               <li>
                    <telerik:RadTextBox runat="Server" ID="NodeTextBox" EmptyMessage="Enter node text">
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Text is required"
                         Display="Dynamic" ControlToValidate="NodeTextBox" ValidationGroup="TextRequired"
                         CssClass="validator"></asp:RequiredFieldValidator>
               </li>
               <li>
                    <asp:Button ID="AddButton" runat="server" OnClick="AddButton_Click" Text="Add new node"></asp:Button>
               </li>
          </ul>
 
     <telerik:RadTreeView ID="RadTreeView1" runat="server" Height="280px" Width="300px">
     </telerik:RadTreeView>
 
</asp:Content>

 

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class Test : System.Web.UI.Page
{
    private void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RadTreeView1.LoadContentFile("tree.xml");
        }
    }
 
    protected void DisableButton_Click(object sender, EventArgs e)
    {
        Page.Validate("DisableRequiresSelection");
        if (Page.IsValid)
        {
            RadTreeView1.SelectedNode.Enabled = false;
            RadTreeView1.SelectedNode.Selected = false;
        }
    }
 
    protected void EnableAll_Button(object sender, EventArgs e)
    {
        foreach (RadTreeNode node in RadTreeView1.GetAllNodes())
        {
            node.Enabled = true;
        }
    }
 
    protected void DeleteButton_Click(object sender, EventArgs e)
    {
        Page.Validate("DeleteRequiresSelection");
        if (Page.IsValid)
        {
            RadTreeView1.SelectedNode.Remove();
        }
    }
 
    protected void AddButton_Click(object sender, EventArgs e)
    {
        Page.Validate("TextRequired");
        if (Page.IsValid)
        {
            IRadTreeNodeContainer target = RadTreeView1;
            if (RadTreeView1.SelectedNode != null)
            {
                RadTreeView1.SelectedNode.Expanded = true;
                target = RadTreeView1.SelectedNode;
            }
 
 
            RadTreeNode addedNode = new RadTreeNode(NodeTextBox.Text);
            addedNode.Selected = true;
            target.Nodes.Add(addedNode);
        }
    }
 
}
Kate
Telerik team
 answered on 24 Jun 2013
8 answers
167 views
Hi Telerik team,

I'm using RadGridView and I'm facing a strange problem now. I've:
  • 1 default.aspx that have an asp:panel
  • 1 usercontrol uc1 that have a RadGridView with Custom Paging using ObjectDataSource

In default.aspx page_load event I load uc1 into the panel:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim uc As UserControl = Page.LoadControl("~/uc1.ascx")
        pnlGrid.Controls.Add(uc)
End Sub


Everything work fine except paging next page, it can't next to page 3 because SelectMethod of ObjectDataSource always run twice with startRowIndex = 0 at the first time run:

<asp:ObjectDataSource runat="server" ID="odsTest" TypeName="WebApplication2.BL" EnablePaging="true" SelectMethod="GetAllTest" SelectCountMethod="GetTestCount" MaximumRowsParameterName="maximumRows" StartRowIndexParameterName="startRowIndex"></asp:ObjectDataSource>


After debug I found this problem cause of loading usercontrol to panel if panel markup like this:
<asp:Panel ID="pnlGrid" runat="server">
</asp:Panel>

(There are a <asp:Literal> control auto-generated here)

But if panel markup like:

<asp:Panel ID="pnlGrid" runat="server"></asp:Panel>
  or
<asp:Panel ID="pnlGrid" runat="server"/>
problem not occur.

So what is exactly problem here? It's my fault or it is by design?

Thanks so much.


Andrey
Telerik team
 answered on 24 Jun 2013
11 answers
591 views
Hi,

My data source is dataset, And I am not use the DataSourceControl.
How can I implement the edit and update after I click the row.

Please help me and I really appreciate it.

Thank you.
Jayesh Goyani
Top achievements
Rank 2
 answered on 24 Jun 2013
7 answers
406 views
Hi,

I created an usercontrol in SharePoint 2010

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="grdPublishingRequests">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdPublishingRequests" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista" />

<telerik:RadGrid AutoGenerateColumns="False" ID="grdPublishingRequests" EnableViewState="true" 
                AllowFilteringByColumn="True" AllowPaging="True" PageSize="15"  
                AllowSorting="True" Width="100%" Skin="Vista" runat="server">
                <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
                <GroupingSettings CaseSensitive="false" />
                <MasterTableView TableLayout="fixed" />
                <SelectedItemStyle CssClass="ms-selectednav" Font-Bold="true" />
                <AlternatingItemStyle CssClass="ms-alternating" />
</telerik:RadGrid>

and I use this usercontrol into a custom webpart
First time everything is ok if I changed the "Page size" after postback I can't access "Page Size"

This issue is only on SharePoint 2010, on SharePoint 2007 is ok.

Thanks for help
Ovidiu
Maria Ilieva
Telerik team
 answered on 24 Jun 2013
3 answers
246 views

Hello Guys,

I have a Rad Tree controls and there are hundreds of nodes and sub nodes bound to it. 

Is there anyway from client side that i can select a node which start with "W"(For ex)  by pressing W key on my keyboard? And the tree should be scroll down automatically to selected node.

Thanks in Advance.
Kate
Telerik team
 answered on 24 Jun 2013
1 answer
236 views
Hi,

          I want to upload multiple  files using asyncupload rad control to database.Please give me a solution to get multiple file name of  uploaded files to store in database & store files in project folder.

Thanks,
Arun.
Shinu
Top achievements
Rank 2
 answered on 24 Jun 2013
8 answers
676 views
          protected void RadButtonSave_Click(object sender, EventArgs e)
        {
            foreach (GridItem item in RadGrid1.Items)
            {
                item.DataItem // this is null
            }

            foreach (GridItem item in this.RadGrid1.SelectedItems) //get SelectedItems successfully
            {
                 but item.DataItem is null
            }
        }

can not get the DataItem of SelectedItems.

PPRINC
Top achievements
Rank 1
 answered on 24 Jun 2013
5 answers
95 views
I dynamically create tabs which then have pageviews attached to them which use a ContentURL.  When the user clicks on the submit button on the main page I want to be able to save user input in textboxes in the various pageviews.  I have seen examples which demonstrate tabs being filled with usercontrols and then using the FindControl function to get to textboxes.  How can I find textboxes in PageViews created with ContentURL? 

This is how I load my pageviews.
Private Sub AddPageView(ByVal pageViewID As String, oTab As RadTab, sURLNav As String)
 
    Try
 
        Dim pageView As RadPageView = New RadPageView
        pageView.ID = "PV" + pageViewID
        oTab.PageViewID = "PV" + pageViewID
        pageView.Height = 520
        pageView.ContentUrl = sURLNav
        MainMultiPage.PageViews.Add(pageView)
 
    Catch ex As Exception
 
    End Try
 
End Sub

 

Kate
Telerik team
 answered on 24 Jun 2013
1 answer
68 views
In demo page:

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandcombo/defaultvb.aspx?product=grid#qsf-demo-source

where you say:

    e.Column = New MyCustomFilteringColumnCS()

should be:

    e.Column = New MyCustomFilteringColumnVB()

sorry, I don't know if this is the right place to post it.

regards.
Maria Ilieva
Telerik team
 answered on 24 Jun 2013
3 answers
216 views
I am trying to use a Custom edit template with 2 Checkboxes and a textbox however when I try to edit a record I get the following error.

"Automatic Updates,Inserts are supported only when the template is IBindable Template"
 
I am not sure what is happening as I have bound all the controls below is the Radgrid code.

<telerik:RadGrid ID="RadGrid4" runat="server" AllowAutomaticUpdates="True"   
                        AllowPaging="True" AutoGenerateEditColumn="True" DataSourceID="SqlDataPending"   
                        GridLines="None" Skin="Sunset" AllowSorting="True">  
                        <MasterTableView AutoGenerateColumns="False" CellSpacing="-1"   
                            DataKeyNames="JobNumber" DataSourceID="SqlDataPending">  
                            <RowIndicatorColumn> 
                                <HeaderStyle Width="20px" /> 
                            </RowIndicatorColumn> 
                            <ExpandCollapseColumn> 
                                <HeaderStyle Width="20px" /> 
                            </ExpandCollapseColumn> 
                            <EditItemTemplate> 
                                <div style="height: 236px">  
                                    <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Approved") %>' /> 
                                    <br /> 
                                    <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("Rejected") %>' /> 
                                    <br /> 
                                    <br /> 
                                    Notes:<br /> 
                                    <asp:TextBox ID="TextBox2" runat="server" Height="72px"   
                                        Text='<%# Bind("Notes") %>' Width="348px"></asp:TextBox> 
                                    <br /> 
                                    <asp:Button ID="Update" runat="server" Text="Update" /> 
                                    <asp:Button ID="Cancel" runat="server" Text="Cancel" /> 
                                    <br /> 
                                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("JobNumber") %>'></asp:Label> 
                                </div> 
                            </EditItemTemplate> 
                            <Columns> 
                                <telerik:GridEditCommandColumn> 
                                </telerik:GridEditCommandColumn> 
                                <telerik:GridCheckBoxColumn DataField="Approved" DataType="System.Boolean"   
                                    HeaderText="Approved" SortExpression="Approved" UniqueName="Approved"   
                                    Visible="False">  
                                </telerik:GridCheckBoxColumn> 
                                <telerik:GridCheckBoxColumn DataField="Rejected" DataType="System.Boolean"   
                                    HeaderText="Rejected" SortExpression="Rejected" UniqueName="Rejected"   
                                    Visible="False">  
                                </telerik:GridCheckBoxColumn> 
                                <telerik:GridBoundColumn DataField="Notes" HeaderText="Notes"   
                                    SortExpression="Notes" UniqueName="Notes" Visible="False">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="DictatorID" HeaderText="DictatorID"   
                                    ReadOnly="True" SortExpression="DictatorID" UniqueName="DictatorID">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="JobNumber" DataType="System.Int32"   
                                    HeaderText="JobNumber" ReadOnly="True" SortExpression="JobNumber"   
                                    UniqueName="JobNumber">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Juvenile" DataType="System.Double"   
                                    HeaderText="Juvenile" ReadOnly="True" SortExpression="Juvenile"   
                                    UniqueName="Juvenile">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Stat" DataType="System.Int16"   
                                    HeaderText="Stat" ReadOnly="True" SortExpression="Stat" UniqueName="Stat">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Case #" HeaderText="Case #" ReadOnly="True"   
                                    SortExpression="Case #" UniqueName="Case #">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Date Dictated" DataType="System.DateTime"   
                                    HeaderText="Date Dictated" ReadOnly="True" SortExpression="Date Dictated"   
                                    UniqueName="Date Dictated">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Dictating Officer"   
                                    HeaderText="Dictating Officer" ReadOnly="True"   
                                    SortExpression="Dictating Officer" UniqueName="Dictating Officer">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="Date Typed" DataType="System.DateTime"   
                                    HeaderText="Date Typed" ReadOnly="True" SortExpression="Date Typed"   
                                    UniqueName="Date Typed">  
                                </telerik:GridBoundColumn> 
                            </Columns> 
                            <EditFormSettings EditFormType="Template">  
                                <EditColumn UniqueName="EditCommandColumn1">  
                                </EditColumn> 
                            </EditFormSettings> 
                        </MasterTableView> 
                        <ClientSettings> 
                            <Selecting AllowRowSelect="True" /> 
                        </ClientSettings> 
                    </telerik:RadGrid> 
Princy
Top achievements
Rank 2
 answered on 24 Jun 2013
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?