Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
212 views

I've written a client-side javascript method to handle the OnClientProgressUpdating event for my ProgressArea.  The signature looks as follows:

 

 

    function progressUpdating(progressArea, args) {

 

 

          alert(args.get_progressData().RadUpload.RequestSize);

 

 

However, I can't seem to get any information for the "RadUpload" object.  When I inspect the "args" object using the debugger, here is what it contains:

 

     ? args.get_progressData()

     {...}

     CurrentOperationText: "Uploaded SendACHFile.txt"

     InProgress: true

     PrimaryPercent: "1"

     PrimaryTotal: "588480"

     PrimaryValue: "8192"

     ProgressCounters: true

     SecondaryPercent: "1"

     SecondaryTotal: "588480"

     SecondaryValue: "8192"

     TimeElapsed: "00:00:01s"

 

Where is the RadUpload object?  This does not match the documentation.  There are supposed to be additional properties.  How can I get access to the "RadUpload" object?

The above code throws the following exception:
    Microsoft JScript runtime error: 'get_progressData().RadUpload.RequestSize' is null or not an object

Genady Sergeev
Telerik team
 answered on 16 Nov 2009
4 answers
101 views

Environment: ASP.NET AJAX 2009 Q2 SP1, FF 3.5

Hi, I need to have the copy/paste work just same as in IE within RadEditor toolbars. Thought to check whether the below issue is resolved in the newer version?

Previous thread on Cut/Copy issue

http://www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-cut-copy-paste.aspx




Or is there a workaround to handle this in the new version? Basically, I don't want to popup a message to the user to use
Ctrl + C or Ctrl + V

Thanks
Vijay

Vijay
Top achievements
Rank 1
 answered on 16 Nov 2009
9 answers
177 views
I have a rad tree within a rad panel you can see here http://alpha.clickablecommunity.com/. If you expand enough nodes, it will run out of sight. I don't really know where the height is coming from. Here is the control page that contains the left panel.

<%@ Control Language="vb" AutoEventWireup="false" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Sql" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="Telerik.Web.UI" %>

<script runat="server">
    Dim connection As String = ConfigurationManager.ConnectionStrings("connectionString").ConnectionString.ToString
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim tree As RadTreeView = DirectCast(RadPanelBar1.FindItemByText("Events").Items(0).FindControl("RadTreeView1"), RadTreeView)
            tree.DataSource = CreateTable()
            tree.DataFieldID = "ID"
            tree.DataFieldParentID = "ParentID"
            tree.DataTextField = "Text"
            tree.DataValueField = "Value"
            tree.DataBind()
                        
            Dim attractionsTree As RadTreeView = DirectCast(RadPanelBar1.FindItemByText("Attractions").Items(0).FindControl("attractionsTree"), RadTreeView)
            attractionsTree.DataSource = CreateAttractionsTable()
            attractionsTree.DataFieldID = "ID"
            attractionsTree.DataFieldParentID = "ParentID"
            attractionsTree.DataTextField = "Text"
            attractionsTree.DataValueField = "Value"
            attractionsTree.DataBind()
        End If
    End Sub 'page load
    
    'this function creates a datatable for the rad
    'tree that is in the events panel
    Private Function CreateTable() As DataTable
        'set up my connection to the database
        Dim conn As New SqlConnection
        conn.ConnectionString = ConfigurationManager.ConnectionStrings("connectionString").ConnectionString
        Dim table As DataTable = New DataTable()
        table.Columns.Add("ID")
        table.Columns.Add("ParentID")
        table.Columns.Add("Text")
        table.Columns.Add("Value")

        'this is a counter for the id fields
        'of the data table
        Dim count As Integer = 1

        'this adds the parent categories to the
        'datatable
        Dim categoryQuery As New SqlCommand
        conn.Open()
        categoryQuery.Connection = conn
        categoryQuery.CommandText = "select CategoryId, Name, ParentId from categories where type='event' order by name"
        Dim cdr As SqlDataReader = categoryQuery.ExecuteReader()
        While cdr.Read()

            If (cdr.Item(2) = 0) Then
                    
                table.Rows.Add(New String() {cdr.Item(0).ToString(), Nothing, cdr.Item(1).ToString, _
                          ("Category;;;" & cdr.Item(0).ToString())})
                    
            Else
                
                table.Rows.Add(New String() {cdr.Item(0).ToString(), cdr.Item(2).ToString, cdr.Item(1).ToString, _
                          ("Category;;;" & cdr.Item(0).ToString())})
                    
            End If


        End While 'while cdr.Read()
        conn.Close()

        'this adds the events with their parent category
        'id to the datatable
        Dim eventQuery As SqlCommand = New SqlCommand("returnAllEvents", conn)
        eventQuery.CommandType = CommandType.StoredProcedure
        
        conn.Open()
        eventQuery.Connection = conn
        eventQuery.CommandType = CommandType.StoredProcedure
        Dim edr As SqlDataReader = eventQuery.ExecuteReader()
        
        While edr.Read()

            If (edr.Item(0).ToString <> "") Then
                
                Dim stopTime As String
                
                'we have to check if the stop time is null because that
                'changes how we will add it in the description.
                If (edr.Item(8).ToString = "") Then
                    
                    stopTime = ""
                    
                Else
                    
                    stopTime = "<br>End Time: " & edr.Item(8)
                    
                End If 'if edr.Item(8)

                
                '0 eventid, 1 FK_CategoryID, 2 latitude, 3 longitude, 4 events.name, 5 description, 6 businesses.name,
                '7 starttime, 8 stoptime, 9 locations.street, 10 locations.city, 11 locations.state, 12 locations.zip
                
                table.Rows.Add(New String() {"child" & edr.Item(0).ToString, edr.Item(1).ToString, edr.Item(4).ToString, _
                                            edr.Item(2).ToString & ";;;" & edr.Item(3).ToString & ";;;" & _
                                            "<span class='mapPopupText'>Event: " & edr.Item(4) & "<br />Details: " & _
                                            edr.Item(5) & "<br />When: " & edr.Item(7) & "<br />At: " & _
                                            "<a href = '" & edr.Item(14) & "' target='_blank'> " & _
                                            edr.Item(6) & "</a>. " & edr.Item(9) & " " & edr.Item(10) & ", " & _
                                            edr.Item(11) & " " & edr.Item(12) & "<br />Contact: " & _
                                            edr.Item(13) & " - <a href = '" & edr.Item(14) & "' target='_blank'>" & _
                                            edr.Item(14) & "</a></span>" & ";;;event"})

            End If

        End While 'while edr.Read()

        Return table

    End Function 'CreateTable
    
    'this function creates a datatable for the rad
    'tree that is in the attractions panel
    Private Function CreateAttractionsTable() As DataTable
        'set up my connection to the database
        Dim conn As New SqlConnection
        conn.ConnectionString = ConfigurationManager.ConnectionStrings("connectionString").ConnectionString
        Dim table As DataTable = New DataTable()
        table.Columns.Add("ID")
        table.Columns.Add("ParentID")
        table.Columns.Add("Text")
        table.Columns.Add("Value")

        'this is a counter for the id fields
        'of the data table
        Dim count As Integer = 1

        'this adds the parent categories to the
        'datatable
        Dim categoryQuery As New SqlCommand
        conn.Open()
        categoryQuery.Connection = conn
        categoryQuery.CommandText = "select categoryid, Name from categories where type='attraction' order by name"
        Dim cdr As SqlDataReader = categoryQuery.ExecuteReader()
        While cdr.Read()

            If (cdr.Item(0).ToString <> "") Then
                
                
                table.Rows.Add(New String() {cdr.Item(0).ToString(), Nothing, cdr.Item(1).ToString, _
                              ("Attraction;,;" & cdr.Item(0).ToString())})
                'we have to increment count to keep an id for the data table
                count = count + 1

            End If

        End While 'while cdr.Read()
        conn.Close()

        'this adds the events with their parent category
        'id to the datatable
        Dim eventQuery As SqlCommand = New SqlCommand("getAttractionInfo", conn)
        eventQuery.CommandType = CommandType.StoredProcedure
        
        conn.Open()
        eventQuery.Connection = conn
        eventQuery.CommandType = CommandType.StoredProcedure
        Dim edr As SqlDataReader = eventQuery.ExecuteReader()
        
        
        
        While edr.Read()

            If (edr.Item(0).ToString <> "") Then

                
                '0 id 1fk catid     2 name 3 lat 4 lon     5 website 6 phone 7 street 8 city 9 state 10 zip 11 catname 12 desc
                
                table.Rows.Add(New String() {"attChild" & edr.Item(0).ToString, edr.Item(1).ToString, edr.Item(2).ToString, _
                                            edr.Item(3).ToString & ";;;" & edr.Item(4).ToString & ";;;" & _
                                            "<span class='mapPopupText'>Name: " & edr.Item(2) & "<br />Type: " & _
                                            edr.Item(11) & "<br />Description: " & edr.Item(12) & "<br />" & _
                                            "Address:" & edr.Item(7) & " " & edr.Item(8) & _
                                            ", " & edr.Item(9) & " " & edr.Item(10) & "<br />Phone: " & edr.Item(6) & _
                                            "<br /><a href = '" & edr.Item(5) & "' target='_blank'> " & _
                                            edr.Item(5) & "</a></span>" & ";;;attraction"})

            End If

        End While 'while edr.Read()

        Return table

    End Function 'CreateAttractionsTable

    'this function is activated on the search button click
    'it calls two data table create functions one for
    'the results of an events search
    'and one for the results of the attractions search
    Protected Sub searchButtonClick(ByVal sender As Object, ByVal e As System.EventArgs)
        'the panel bar instance
        Dim panelBar As New RadPanelItem
        panelBar = RadPanelBar1.FindItemByText("Search")
        
        'call the function to create the data table
        Dim resultsTable As DataTable = CreateEventsTable()
        
        If (resultsTable.Rows.Count > 0) Then
            For Each row As DataRow In resultsTable.Rows
                            
                Dim tempItem As New RadPanelItem()
                tempItem.CssClass = "searchResultsText"
                tempItem.Text = row.Item(0)
                tempItem.Value = row.Item(1)
                panelBar.Items.Add(tempItem)
                
            Next
            
        Else
            
            Dim tempItem As New RadPanelItem()
            tempItem.CssClass = "searchResultsText"
            tempItem.Text = "Sorry you search did not return any <br>results." & _
                      " Please try again."
            tempItem.Value = "no results"
            panelBar.Items.Add(tempItem)
                        
        End If 'if resultsTalbe.Rows.count
            
                        
    End Sub 'searchbutton click
    
    Private Function CreateEventsTable() As DataTable

        
        'create the table
        Dim table As DataTable = New DataTable()
        table.Columns.Add("text")
        table.Columns.Add("value")
        
        'set the output css class
        Dim output As String = ""
        
        'the panel bar instance
        Dim panelBar As New RadPanelItem
        panelBar = RadPanelBar1.FindItemByText("Search")
        
        'the textbox input
        Dim textbox As RadTextBox = DirectCast(RadPanelBar1.FindItemByText("Search").Items(0).FindControl("searchInputTextBox"), RadTextBox)
        
        'we need to remove any of the child items
        'so we go through all of the child items
        For Each childItem As RadPanelItem In RadPanelBar1.GetAllItems

            'if this has some sort of value
            'then we remove it because it was
            'a child that was added by the search
            'function
        
            If (childItem.Value <> "") Then

                childItem.Visible = False

            End If 'if childItem
            
        Next
        
        'my sql connection
        Dim myConn As New Data.SqlClient.SqlConnection(connection)

        'the name of the stored procedure
        Dim strSQL As String = "searchForEvents"

        Dim returnCommand As New Data.SqlClient.SqlCommand(strSQL, myConn)

        'add the parameters
        returnCommand.Parameters.AddWithValue("@searchString", "%" & textbox.Text.ToString & "%")

        'tell the system it is a stored procedure
        returnCommand.CommandType = CommandType.StoredProcedure

        Try
            myConn.Open()
            Dim dr As SqlDataReader = returnCommand.ExecuteReader()
            
            'if we have stuff to add
            If (dr.HasRows) Then
                                                
                While dr.Read()
                    
                    Dim stopTime As String
                
                    'we have to check if the stop time is null because that
                    'changes how we will add it in the description.
                    If (dr.Item(8).ToString = "") Then

                        stopTime = ""

                    Else

                        stopTime = "<br>End Time: " & dr.Item(8).ToString

                    End If 'if edr.Item(8)
                    
                    Dim tempValue As String = dr.Item(2).ToString & "***" & dr.Item(3).ToString & "***" & _
                                            "<span class='mapPopupText'>Event: " & dr.Item(4) & "<br />Details: " & _
                                            dr.Item(5) & "<br />When: " & dr.Item(7) & "<br />At: " & _
                                            dr.Item(6) & "<br />" & dr.Item(9) & " " & dr.Item(10) & ", " & _
                                            dr.Item(11) & " " & dr.Item(12) & "<br /></span>***event"
                    table.Rows.Add(New String() {dr.Item(13) & " - " & dr.Item(4), tempValue})
                    
                End While 'while dr.read()        
            
            End If
            
        Catch ex As Exception
            
            Dim tempItem As New RadPanelItem()
            tempItem.CssClass = "searchResultsText"
            tempItem.Text = "Oops, there was an error, please try <br>again."
            panelBar.Items.Add(tempItem)
                      
        End Try
        
        myConn.Close()
        
        '*****************************************************************************************************
        '*****************************************************************************************************
        'now we will search the attractions table
        'the name of the stored procedure
        Dim strAtt As String = "searchForAttractions"

        Dim attractionCommand As New Data.SqlClient.SqlCommand(strAtt, myConn)

        'add the parameters
        attractionCommand.Parameters.AddWithValue("@searchString", "%" & textbox.Text.ToString & "%")

        'tell the system it is a stored procedure
        attractionCommand.CommandType = CommandType.StoredProcedure

        Try
            myConn.Open()
            Dim dr As SqlDataReader = attractionCommand.ExecuteReader()
            
            'if we have stuff to add
            If (dr.HasRows) Then
                                                
                While dr.Read()
               
                    '0 name, 1 website, 2 phone, 3 desc, 4 street, 5 city, 6 state, 7 zip, 8 lat, 9 lon, 10 catname
                    Dim tempValue As String = dr.Item(8) & "***" & dr.Item(9) & "***" & _
                                            "<span class='mapPopupText'>Name: " & dr.Item(0) & "<br />Type: " & _
                                            dr.Item(10) & "<br />Description: " & dr.Item(3) & "<br />Address: " & _
                                            dr.Item(4) & " " & dr.Item(5) & ", " & dr.Item(6) & " " & _
                                            dr.Item(7) & "<br />Phone: " & dr.Item(2) & "<br /><a href = '" & _
                                            dr.Item(1) & "'>" & dr.Item(1) & "</a></span>***attraction"
                    table.Rows.Add(New String() {dr.Item(10) & " - " & dr.Item(0), tempValue})
                    
                End While 'while dr.read()        
            
            End If
            
        Catch ex As Exception
            
            Dim tempItem As New RadPanelItem()
            tempItem.CssClass = "searchResultsText"
            tempItem.Text = "Oops, there was an error, please try <br>again."
            panelBar.Items.Add(tempItem)
                      
        End Try
        
        myConn.Close()
        Return table
        
    End Function 'CreateEventsTable
    
</script>
<script type="text/javascript">

    //these two arrays are for the markers that
    //are added by the tree view (checkboxes)
    arrOfMarkers = new Array();
    arrOfDesc = new Array();

    //these two arrays are for the markers that are
    //added by the search
    arrOfLinkMarkers = new Array();
    arrOfLinkDesc = new Array();

    //this array keeps all of the markers
    //to set the zoom level
    arrOfAllMarkers = new Array();
    
    //this function is called when they click the link
    //and not when they click the checkbox
    //it determines whether or not they clicked a checked node
    //and also whether or not they clicked a parent or child node
    function OnClientNodeClicking(sender, eventArgs) {

        //this is the current checked state of the node
        var checked = eventArgs.get_node().get_checked();

        //this is the current node
        var node = eventArgs.get_node();
        
        //set the node to the state that it is not currently in
        //basically this will mirror the effect of checking the node
        node.set_checked(!checked);

        //since the node state has changed we have to
        //redefine checked
        checked = eventArgs.get_node().get_checked();
        
        //this is the child node
        var childNodes = eventArgs.get_node().get_nodes();

        //this is the node level
        var nodeLevel = node.get_level();

        //split the value
        var tempValue = node.get_value();

        //if they clicked the node
        if (checked) {

            //if they clicked a parent node
            if (nodeLevel == 0) {

                UpdateAllChildren(childNodes, checked);
        
            } //if tempValue
            
            //they clicked a child node
            else {
                UpdateAllChildren(childNodes, checked);
                //addMarker(tempValue);
            }//else

        } //if checked

        //they didn't check the node
        else {
            //if they clicked a parent node
            if (nodeLevel == 0) {

                UpdateAllChildren(childNodes, checked);

            } //if tempValue

            //they clicked a child node
            else {
                UpdateAllChildren(childNodes, checked);
                //removeMarker(tempValue);
            } //else
        } //else   
    }//OnclientnodeClicking

    //this function is called when they click the checkbox
    //and not when they click the link
    //it determines whether or not they checked a checked node
    //and also whether or not they checked a parent or child node
    function OnClientNodeChecked(sender, eventArgs) {

        //this is the current checked state of the node
        var checked = eventArgs.get_node().get_checked();   
        
        //this is the current node
        var node = eventArgs.get_node();
        
        //this is the child node
        var childNodes = eventArgs.get_node().get_nodes();

        //this is the node level
        var nodeLevel = node.get_level();
                
        //split the value
        var tempValue = node.get_value();
                
        //if they checked a node
        if (checked) {
            
            //if they checked a parent node
            if(nodeLevel == 0){

                UpdateAllChildren(childNodes, checked);
            
            }//if tempValue = category
            
            //they checked a child node
            else{
                UpdateAllChildren(childNodes, checked);
                //addMarker(tempValue);
                
            }//else
            
        } //if checked

        //they unchecked the node
        else {

            //if they unchecked a parent node
            if (node.get_level() == 0) {

                UpdateAllChildren(childNodes, checked);

            } //if tempValue
            
            else {
                UpdateAllChildren(childNodes, checked);
                //removeMarker(tempValue);

            } //else
            
        }//else

    } //OnClientNodeChecked
    function itemClicked(sender, eventArgs) {

        //the value from the click
        var passedVal = eventArgs.get_item().get_value();

        //if the passedVal is something
        //then we add the marker
        if (passedVal) {
            addOrRemoveMarker(passedVal);
        }
    }//itemClicked

    //this function adds or removes a marker
    //it is called when a client clicks the results
    //from a search we had to make this seperate
    //from the other add and remove because it uses
    //different marker arrays to keep the markers
    //from the checkboxes seperate from markers on searches
    function addOrRemoveMarker(value) {
a
        //make sure they didn't click the no results pane
        if (value != "no results") {
            var tempArr = value.split("***");
            var lat = tempArr[0];
            var lon = tempArr[1];
            var desc = tempArr[2];
            var type = tempArr[3];
            var inMap = false;
            var count = 0;

            if (lat != "Category") {

                var loc = new GLatLng(lat, lon);

                while (inMap == false && count < arrOfLinkMarkers.length) {

                    //if the lattitude and longitude are on the map
                    //and the descriptions match each other then it is an
                    //existing marker.

                    if ((loc.lat() == arrOfLinkMarkers[count].getLatLng().lat()) &&
                    (loc.lng() == arrOfLinkMarkers[count].getLatLng().lng()) &&
                    (arrOfLinkDesc[count] == desc)) {
                        inMap = true;
                        break;
                    } //if
                    count++;
                } //while

                //if it is in the map then we remove the marker
                if (inMap) {

                    map.removeOverlay(arrOfLinkMarkers[count]);
                    arrOfLinkMarkers.splice(count, 1);
                    arrOfAllMarkers.splice(count, 1);
                    arrOfLinkDesc.splice(count, 1);

                } //if

                //we will add the marker
                else {

                    //we need to check if this is an
                    //event or attractions to set
                    //the marker color
                    if (type == "attraction") {
                        var blueIcon = new GIcon(G_DEFAULT_ICON);
                        blueIcon.image = "http://clickablecommunity.com/images/Markers/markerGreen.png";

                        // Set up our GMarkerOptions object
                        markerOptions = { icon: blueIcon };

                        var marker = new GMarker(loc, blueIcon);
                    } //if

                    //else we just create the icon with the default
                    else {
                        var marker = new GMarker(loc);
                    } //else
                    arrOfLinkMarkers.push(marker);
                    arrOfAllMarkers.push(marker);
                    arrOfLinkDesc.push(desc);

                    GEvent.addListener(marker, "click", function() {
                        marker.openInfoWindowHtml(desc);
                    });

                    map.addOverlay(marker);
                    setZoomLevel(loc);
                } //else

            } //if value != no results

        } //if lat != "category"
        
    } //addOrRemoveMarker

    //this function removes a marker if it is in the map
    //it is called if a parent node is unchecked
    function removeMarker(value) {

        var tempArr = value.split(";;;");
        var lat = tempArr[0];
        var lon = tempArr[1];
        var desc = tempArr[2];
        var inMap = false;
        var count = 0;
        
        if (lat != "Category") {

            var loc = new GLatLng(lat, lon);

            while (inMap == false && count < arrOfMarkers.length) {

                //if the lattitude and longitude are on the map
                //and the descriptions match each other then it is an
                //existing marker.
                if ((loc.lat() == arrOfMarkers[count].getLatLng().lat()) &&
                (loc.lng() == arrOfMarkers[count].getLatLng().lng()) &&
                (arrOfDesc[count] == desc)) {
                    inMap = true;
                    break;
                } //if
                count++;
            } //while
            if (inMap) {

                map.removeOverlay(arrOfMarkers[count]);
                arrOfMarkers.splice(count, 1);
                arrOfAllMarkers.splice(count, 1);
                arrOfDesc.splice(count, 1);

            } //if
        
        } //if lat != "category"
        
    } //removeMarker

    //this function adds a marker if it is not in the map
    //it is called if a parent node is checked
    function addMarker(value) {

        var tempArr = value.split(";;;");
        var lat = tempArr[0];
        var lon = tempArr[1];
        var desc = tempArr[2];
        var type = tempArr[3];
        var inMap = false;
        var count = 0;

        //we only run the next code if lat is not a category
        //if it is a category then we do nothing.
        if (lat != "Category") {
            
            var loc = new GLatLng(lat, lon);

            while (inMap == false && count < arrOfMarkers.length) {

                //if the lattitude and longitude are on the map
                //and the descriptions match each other then it is an
                //existing marker.
                if ((loc.lat() == arrOfMarkers[count].getLatLng().lat()) &&
                (loc.lng() == arrOfMarkers[count].getLatLng().lng()) &&
                (arrOfDesc[count] == desc)) {
                    inMap = true;
                    break;
                } //if
                count++;
            }  //while
            if (!inMap) {

                //if this is an attraction then we chang the marker icon
                if (type == "attraction") {
                    var blueIcon = new GIcon(G_DEFAULT_ICON);
                    blueIcon.image = "http://clickablecommunity.com/images/Markers/markerGreen.png";

                    // Set up our GMarkerOptions object
                    markerOptions = { icon: blueIcon };

                    var marker = new GMarker(loc, blueIcon);
                } //if

                //else we just create the icon with the default
                else {
                    var marker = new GMarker(loc);
                } //else

                arrOfMarkers.push(marker);
                arrOfAllMarkers.push(marker);
                arrOfDesc.push(desc);

                GEvent.addListener(marker, "click", function() {
                    marker.openInfoWindowHtml(desc);
                });

                map.addOverlay(marker);
                setZoomLevel(loc);

            } //if

        }//if lat != "category"
    } //addMarker

    //this function gathers all of the markers
    //that are loaded on the map and then sets an appropriate
    //zoom level to show all of the markers
    function setZoomLevel(loc) {
        
        var bounds = new GLatLngBounds();
        
        //make sure there is more than 1 marker
        if (arrOfAllMarkers.length > 1) {

            //go through the array of markers
            //and add them to the bounds
            for (i = 0; i < arrOfAllMarkers.length; i++) {
                bounds.extend(arrOfAllMarkers[i].getLatLng());
            } //for
            
            //get the center of the bounds and then
            //set the zoom level
            
            map.setCenter(bounds.getCenter());
            map.setZoom(map.getBoundsZoomLevel(bounds));
        } //if arrOfMarkers.length > 1

        //there is only one marker on the map
        else {

            //set the zoom level
            map.setCenter(loc, map.getZoom());

        }
    } //setZoomLevel

    function UpdateAllChildren(nodes, checked) {
        var i;
        for (i = 0; i < nodes.get_count(); i++) {
            if (checked) {
                nodes.getNode(i).check();
                addMarker(nodes.getNode(i).get_value());
            }//if
            else {
                nodes.getNode(i).set_checked(false);
                removeMarker(nodes.getNode(i).get_value());
            }//else

            //these next three lines of code are if you have
            //child nodes within child nodes
            //i.e. Parent -> child 1 -> child1
            //     Parent -> child 1 -> child2
            //     Parent -> child 2 -> child1
            //     Parent -> child 2 -> child2
            //if you do and you want them also checked then
            //uncomment these three lines
            if (nodes.getNode(i).get_nodes().get_count() > 0) {
                UpdateAllChildren(nodes.getNode(i).get_nodes(), checked);
            }//if
                        
        } //for
        
    }//UpdateAllChildren

</script>  
<link href="../ClickableCommunity.css" rel="stylesheet" type="text/css" />
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" Width="220px">
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Web20" ExpandMode="SingleExpandedItem"
        AllowCollapseAllItems="false" Width="220px" BorderStyle="None" OnClientItemClicked="itemClicked" >
        <CollapseAnimation Type="None" Duration="100"></CollapseAnimation>
        <Items>
            <telerik:RadPanelItem runat="server" Text="Attractions" Font-Bold="true" Font-Size="Medium">
                <Items>
                    <telerik:RadPanelItem runat="server">
                        <ItemTemplate>
                            <telerik:RadTreeView ID="attractionsTree" runat="server" Skin="Web20" CssClass="leftPanelContent"
                                CheckBoxes="true" OnClientNodeClicking="OnClientNodeClicking" OnClientNodeChecked="OnClientNodeChecked" >
                            </telerik:RadTreeView>
                        </ItemTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelItem>
            <telerik:RadPanelItem runat="server" Text="Events" Font-Bold="true" Font-Size="Medium" Expanded="true">
                <Items>
                    <telerik:RadPanelItem runat="server">
                        <ItemTemplate>
                            <telerik:RadTreeView ID="RadTreeView1" runat="server" Skin="Web20" CssClass="leftPanelContent"
                                CheckBoxes="true" OnClientNodeClicking="OnClientNodeClicking" OnClientNodeChecked="OnClientNodeChecked" >
                            </telerik:RadTreeView>
                        </ItemTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelItem>
            <telerik:RadPanelItem runat="server" Text="Search" Font-Bold="true" Font-Size="Medium">
                <Items>
                    <telerik:RadPanelItem>
                        <ItemTemplate>
                            <center>
                                <table>
                                    <tr>
                                        <td class="searchTable">
                                            <telerik:RadTextBox ID="searchInputTextBox" runat="server" Skin="Web20"
                                                             EmptyMessage="Enter Keywords" CssClass="searchTextBox"
                                                             EmptyMessageStyle-CssClass="emptyTextboxText"/>
                                        </td>
                                        <td class="searchTable">
                                            <asp:Button runat="server" ID="searchButton" Text="Search"
                                                        OnClick="searchButtonClick" />        
                                        </td>
                                    </tr>
                                </table>
                            </center>
                        </ItemTemplate>
                    </telerik:RadPanelItem>
                </Items>
                <Items>
                    <telerik:RadPanelItem CssClass="searchResultsText">
                        <ItemTemplate>
                        </ItemTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelItem>
        </Items>
        <ExpandAnimation Type="None" Duration="100"></ExpandAnimation>
    </telerik:RadPanelBar>
    
</telerik:RadAjaxPanel>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" SkinID="Web20" Height="75px" Transparency="1">
    <img alt="Searching..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.LoadingProgressBar.gif") %>'
        style="border: 0px;" />
</telerik:RadAjaxLoadingPanel>

And here is my css
html, body, form  
{  
   height: 100%;
   width: 100%;
   margin: 0;  
   padding:0;  
}
#leftPanel{
    display:inline;
    width:220px;
    border-top-style: none;
    border-right-style: none;
    border-left-style: none;
    height: 100%;
        
}
.mapPopupText{
    font-family: Arial;
    font-size: 12px;
}
.panelTitle{
    font-size: 12px;
    font-weight: bolder;
}
.normalText{
    font-size:12px;
    font-family: Arial;
}
a:visited{
    border:none;
}
a{
    border:none;
}
.loginLabel{
    padding-right: 10px;
    padding-bottom: 10px;
}
.loginTextBox{
    width: 120px;
}
.leftPanelContent{
    padding-bottom: 30px;
}
#topDiv{
    height: 50px;
    border-bottom-width: 4px;
    border-bottom-color: Gray;
    border-bottom-style:groove;
        
}

.searchResultsText{
    width: 200px;
    font-size: 12px;
    font-family: Arial;
    text-align: left;

}
.searchTable{
    text-align: center;
}
.searchTextBox{
    font-size: 12px;
    color: Black;
}
.entityTable{
    
}
#entityMap{
    height: 400px;
    border: groove 3px gray;
    width: 550px;
       
}
.entityMapClass{
    padding-left: 10px;
    height: 500px;
    vertical-align: top;
    
}
.calendarView{
    width:auto !important;
}
.tableColumn{
    width:150px;
}
#loginDiv{
    position: absolute;
    display:inline;
    right: 10px;
    top: 5px;
}
#menuDiv{
    position: absolute;
    padding-top: 75px;
    margin-left: auto;
    margin-right:auto;
}
.AllContent{
    border-right: none;
}
.businessToolTip{
    position: absolute;
    z-index: 500;
    top:300px;
    left:300px;
}
.stateDropDownText{
    font-size: 11px;
    font-family: Arial;

}
.adminTableDiv{
    text-align: center;
    width: 200px;
    height:100%;
    padding-right:20px;
    display: inline;
}
.adminMainDiv{
    
}
.center{
    padding-left:auto;
    padding-right:auto;
}
.textRed{
    color: Red;
}
.successText{
    color:Green;
}
.addBusinessSpacing{
    padding-right: 20px;
    height: 70px;
}
.adminTableLabel{
    text-align: center;
    display: block;
}
.addBusinessTextBox{
    width:150px;
    text-align:center;
}
#MainContent{
    display:inline;

}
.displayInline{
    display: inline;
}
#divMap{
    height: 500px;
    margin-left: auto;
    margin-right: auto;
    padding-right: 10px;
    width: 98%;
    
}
#divCalendar{
    height: 500px;
    border: groove 4px #EEEEEE;
    margin-left: auto;
    margin-right: auto;
    width:auto;
    margin: 10px;
}
.RightPanelPadding
{
    position: relative;
    height:auto !important;
    padding-left: 10px;
    padding-top:10px;
    padding-right:10px;
    padding-bottom: 10px;
    margin-top: auto;
    margin-bottom: auto;
    width: auto;
    
    
}
.errorMessage{
    color: Red;
    font-size: 10px;
    font-family: Arial;
}
.topDivImage{
position: absolute;
top: 0;
left: 0;
display:inline;
width:220px;
}
.viewMenu{
padding-left:220px;
margin-right:auto;
margin-left:auto;
text-align:center;
width:800px;
vertical-align:bottom;
padding-top: 24px;
}
.emptyTextboxText{

    font-style:italic;
    font-size:10px;
    color: #D8D8D8;

}

Any idea what I need to change? Thanks,
Web Services
Top achievements
Rank 2
 answered on 16 Nov 2009
2 answers
154 views
Hi support,

I did a bunch of searches, but I can't find anything related to having multiple NestedViewTemplates in a hierachical grid.  I wonder if it is possible.  That is, I would like to show a tab at each level in the hierarchy.  That is, it should look like the below

    <telerik:RadGrid> 
        <PagerStyle   
            <MasterTableView "> 
                <Columns> 
                    <telerik:GridBoundColumn>   
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn>   
                    </telerik:GridBoundColumn> 
                </Columns> 
                <NestedViewTemplate> 
                </NestedViewTemplate>                                                  
                <DetailTables> 
                    <telerik:GridTableView> 
                        <Columns> 
                            <telerik:GridBoundColumn>   
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn>   
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn>   
                            </telerik:GridBoundColumn> 
                        </Columns> 
              <NestedViewTemplate> 
              </NestedViewTemplate>                                                                      
                        <DetailTables> 
                            <telerik:GridTableView> 
                                <Columns> 
                                    <telerik:GridBoundColumn> 
                                    </telerik:GridBoundColumn>                                  
                                    <telerik:GridBoundColumn> 
                                    </telerik:GridBoundColumn>                                  
                                    <telerik:GridBoundColumn> 
                                    </telerik:GridBoundColumn>                                  
                                </Columns> 
                                <NestedViewTemplate> 
                                </NestedViewTemplate>                                                  
                            </telerik:GridTableView> 
                        </DetailTables>                        
                    </telerik:GridTableView> 
                </DetailTables>               
            </MasterTableView> 
        </telerik:RadGrid> 
          
 
 
 
 
When, I attempt to do this everything gets hidden after the first nestedviewtemplate is shown.

Is it possible?  Am I doing something wrong?

Josh
Josh
Top achievements
Rank 1
 answered on 16 Nov 2009
1 answer
198 views
I'm having a problem where the NeedDataSource event of the grid is not firing on initial load when I load and add a user control containing a grid in a Place Holder control.  I don't experience the same problem when loading and adding the user control in a RadPageView.  The user control loads and runs through the normal lifecycle, but the grid's NeedDataSource Event doesn't fire when adding it to a place holder.  The NeedDataSource method is wired to the grid's event and works as expected when the user control is added to other controls.  Any ideas on why it doesn't fire would be appreciated. 

UserControlwGrid userControlwGrid = (UserControlwGrid)LoadControl("UserControlwGrid.ascx"); 
userControlwGrid.ID = "userControlwGrid";
//Set additional Properties of User Control
 
placeholder.Controls.Add(userControlwGrid); 
 
 
UserControlwGrid userControlwGrid = (UserControlwGrid)LoadControl("UserControlwGrid.ascx"); 
userControlwGrid.ID = "userControlwGrid"
//Set additional Properties of User Control
 
RadPageView.Controls.Add(userControlwGrid); 

Never gets called
protected void radGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    radGrid.DataSource = GetMyDataSource(); 

Tsvetoslav
Telerik team
 answered on 16 Nov 2009
2 answers
85 views
Hi,

I have disabled autogenerate columns on the grid and create them declaratively and in some other cases, programmatically.   Either case, I have autogenerate edit column set to true.  When the grid is rendered on screen, the Edit link button column aslways appear as the last column in the grid.  In many cases, I would like to have it displayed as the first column of the grid.  How can I accomplish this?
I don't see (or missed) any property on the grid that I can set for this purpose.

Babu.
Babu Mannaravalappil
Top achievements
Rank 1
 answered on 16 Nov 2009
2 answers
130 views
Hi,

I have a statically declared but dynamically created Grid.  The columns and their datatypes are not known until runtime.  So, I create regular GridBoundColumn at runtime.  Some columns are numeric and some columns need to be dropdowns, checkboxes etc.  I have all the code to create the boundcolumns and display it and edit it.  I guess I need to replace the auto-generated column editors in CreateColumnEditor event.  Is there a sample I can base my code upon?  Because the following code throws me an error "Object reference not set to an instance of an object".

Here is my code to create the columns.
    protected void DefineColumnsForGrid(RadGrid grid, DataTable tbl)  
    {  
        grid.Columns.Clear();  
        FormsIdentity user = (FormsIdentity)HttpContext.Current.User.Identity;  
        if (user == null)  
            return;  
        for (int i = 0; i < tbl.Columns.Count; i++)  
        {  
            GridBoundColumn col = new GridBoundColumn();  
            col.HeaderText = tbl.Columns[i].ColumnName;  
            col.DataField = tbl.Columns[i].ColumnName;  
            col.UniqueName = tbl.Columns[i].ColumnName;  
            col.DataType = tbl.Columns[i].DataType;  
            col.ReadOnly = true;    // isEditable  
            grid.Columns.Add(col);  
        }  
    }  
 


And here my code for CreateColumnEditor event:
    protected void rgForecast_CreateColumnEditor(object sender, GridCreateColumnEditorEventArgs e)  
    {  
        if (e.Column is GridBoundColumn)  
        {  
            if ((e.Column as GridBoundColumn).DataType == typeof(System.Decimal))  
            {  
                (e.Column as GridBoundColumn).ColumnEditorID = (e.Column as GridBoundColumn).UniqueName + "1";  
                e.ColumnEditor = new GridNumericColumnEditor(new GridNumericColumn());  
            }  
        }  
    }  
 

Please help.

Babu.
Babu Mannaravalappil
Top achievements
Rank 1
 answered on 16 Nov 2009
3 answers
464 views
Hi,
Im using the latest version of the prometheus controls. I've come across a problem where a radtextbox does not fire the textchanged event all the time.

I've managed to reproduce the problem on a simple page as follows:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadTextboxAutoPostbackBug.aspx.cs" Inherits="RadTextboxAutoPostbackBug" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        </asp:ScriptManager> 
    <div> 
        <telerik:radtextbox id="RadTextBox1" runat="server" autopostback="True" ontextchanged="RadTextBox1_TextChanged" 
            textmode="SingleLine" width="125px"></telerik:radtextbox> 
        <telerik:radtextbox id="RadTextBox2" runat="server" autopostback="True" ontextchanged="RadTextBox2_TextChanged"></telerik:radtextbox> 
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div
        <telerik:radajaxmanager id="RadAjaxManager1" runat="server" defaultloadingpanelid="RadAjaxLoadingPanel1"><AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadTextBox1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="Label1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="RadTextBox2"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="Label1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
</AjaxSettings> 
</telerik:radajaxmanager> 
        <telerik:radajaxloadingpanel id="RadAjaxLoadingPanel1" runat="server" height="75px" 
            width="75px"
        <img src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' alt="Loading..." style="border:0px;" /> 
    </telerik:radajaxloadingpanel> 
    </form> 
</body> 
</html> 
 

The code behind:

using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
 
public partial class RadTextboxAutoPostbackBug : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
    protected void RadTextBox1_TextChanged(object sender, EventArgs e) 
    { 
        Label1.Text = DateTime.Now.ToString() + ": TextBox1 Changed"
    } 
    protected void RadTextBox2_TextChanged(object sender, EventArgs e) 
    { 
        Label1.Text = DateTime.Now.ToString() + ": TextBox2 Changed"
    } 

The autopostback will work the first time you change the text for both text boxes. The next time you try to change it, it will not fire, and it will also revert back to the old text that existed in the textbox.

Thanks,
Andrew Watt
Top achievements
Rank 1
 answered on 16 Nov 2009
1 answer
97 views
I have a Grid:

     <telerik:RadGrid ID="pracownicy" AllowSorting="true" runat="server" GridLines="None" 
         ShowFooter="true" DataMember="employee"
         <MasterTableView> 
             <RowIndicatorColumn> 
                 <HeaderStyle Width="20px"></HeaderStyle> 
             </RowIndicatorColumn> 
             <ExpandCollapseColumn> 
                 <HeaderStyle Width="20px"></HeaderStyle> 
             </ExpandCollapseColumn> 
             <Columns> 
                 <telerik:GridTemplateColumn HeaderText="Gracz" SortExpression="employee_name"
                     <ItemTemplate> 
                         <href='<%# "http://www.erepublik.com/en/citizen/profile/" & Eval("employee_id") %>' 
                             target="_blank"
                             <%#Eval("employee_name")%></a
                     </ItemTemplate> 
                     <ItemStyle HorizontalAlign="Center" Width="200px" /> 
                     <HeaderStyle HorizontalAlign="Center" /> 
                 </telerik:GridTemplateColumn> 
                 <telerik:GridBoundColumn DataField="employee_skill" DataType="System.Double" HeaderText="UmiejÄ™tność" 
                     SortExpression="employee_skill" UniqueName="employee_skill"
                     <ItemStyle HorizontalAlign="Center" Width="100px" /> 
                     <HeaderStyle HorizontalAlign="Center" /> 
                 </telerik:GridBoundColumn> 
                 <telerik:GridBoundColumn DataField="employee_wellness" DataType="System.Double" HeaderText="Samopoczucie" 
                     SortExpression="employee_wellness" UniqueName="employee_wellness"
                     <ItemStyle HorizontalAlign="Center" Width="100px" /> 
                     <HeaderStyle HorizontalAlign="Center" /> 
                 </telerik:GridBoundColumn> 
                 <telerik:GridTemplateColumn DataField="employee_productivity" DataType="System.Double" 
                     HeaderText="Produktywność" SortExpression="employee_productivity" UniqueName="employee_productivity"
                     <ItemTemplate> 
                         <telerik:RadTextBox ID="productivity" Enabled="false" runat="server" Text='<%# Eval("employee_productivity") %>' 
                             Width="50px"
                             <DisabledStyle BorderColor="Transparent" ForeColor="Black" BackColor="Transparent" /> 
                         </telerik:RadTextBox></ItemTemplate
                     <ItemStyle HorizontalAlign="Center" Width="100px" /> 
                     <HeaderStyle HorizontalAlign="Center" /> 
                 </telerik:GridTemplateColumn> 
                 <telerik:GridTemplateColumn HeaderText="Pensja" UniqueName="salary"
                     <ItemTemplate> 
                         <telerik:RadNumericTextBox ID="salary" runat="server" NumberFormat-DecimalDigits="2" 
                             NumberFormat-GroupSeparator="" NumberFormat-DecimalSeparator="," Width="75px" 
                             Type="Currency" ShowSpinButtons="true" Text='<%# Eval("employee_salary") %>'
                             <ClientEvents OnKeyPress="recalculate" OnValueChanged="recalculate" /> 
                             <IncrementSettings Step="0.05" InterceptMouseWheel="true" /> 
                         </telerik:RadNumericTextBox> 
                     </ItemTemplate> 
                     <ItemStyle HorizontalAlign="Center" Width="100px" /> 
                     <HeaderStyle HorizontalAlign="Center" /> 
                 </telerik:GridTemplateColumn> 
                 <telerik:GridTemplateColumn HeaderText="Profit" UniqueName="profit"
                     <ItemTemplate> 
                         <telerik:RadTextBox ID="profit" runat="server" Width="50px"
                         </telerik:RadTextBox></ItemTemplate
                     <ItemStyle HorizontalAlign="Center" Width="100px" /> 
                     <HeaderStyle HorizontalAlign="Center" /> 
                     <FooterTemplate> 
                         <telerik:RadTextBox ID="total" Enabled="false" runat="server" Width="50px"
                             <DisabledStyle BorderColor="Transparent" ForeColor="Black" BackColor="Transparent" /> 
                         </telerik:RadTextBox> 
                     </FooterTemplate> 
                 </telerik:GridTemplateColumn> 
             </Columns> 
         </MasterTableView> 
     </telerik:RadGrid> 

The grid is in non-edit mode. I have NumericTextBoxes in normal, default view.

I enabled sorting through few columns.

The problem is that when I enter some value in NumericTextBox and press sort, the data is sorting ok, but I losing the value inserted before sorting.

How to prevent it?
Veli
Telerik team
 answered on 16 Nov 2009
1 answer
64 views
I am developing an extensive web application with many datagrids and am wanting to use the popup editor to make coding simpler.

But I need to do some extra data validation and manipulation on server-side. Is it possible to access the inputs from the modal pop up editor on the radgrid insert_command event?

This is how I build my grid asp-side:

<telerik:RadGrid ID="gvFTE2009" runat="server" Width="550px"
   <MasterTableView EditMode="PopUp" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add another category" 
                                                             ShowHeadersWhenNoRecords="true" ShowHeader="false" NoMasterRecordsText="No Other Categories exist. Click 'Add another category' to add a new category"
      <EditFormSettings InsertCaption="Add another category" CaptionDataField="" PopUpSettings-Modal="true"/> 
      <Columns>                                                    
         <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="columnDelete" ItemStyle-Width="55px"
         </telerik:GridButtonColumn> 
      </Columns>                                                                                           
   </MasterTableView> 
</telerik:RadGrid> 


And this is how I want to bind my table server-side:           
sqlString = "Select .... " 
ds = SqlHelper.ExecuteDataset(Conn, Data.CommandType.Text, sqlString, sqlparam) 
If ds.Tables(0).Rows.Count > 0 Then 
   gvFTE2009.DataSource = ds.Tables(0) 
   gvFTE2009.DataBind() 
End If 


Drew
Top achievements
Rank 2
 answered on 16 Nov 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?