Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
154 views
I've used a SQL CTE to build a table that represents my hierarchy and now I'm trying to loop through those records to find the parent node, create a new node object and then append that new node object as a child of the parent node I found.

I've got a radtreeview with a parent node with a value of 0.  I've tried accomplishing this two ways - neither works.

The following compiles without error, but doesn't add the newly created CurrentNode to the node I found in objMyTreeView.  
objMyTreeView.FindNodeByValue("0").Nodes.Add(CurrentNode);

The following will find the parent node, but when I add the CurrentNode to it - I'm adding it to the ParentNode object - not the actual parent node in objMyTreeView.  
RadTreeNode ParentNode = objMyTreeView.FindNodeByValue("0");
ParentNode.Nodes.Add(CurrentNode);

This seems like it should be simple - find the node with the value of the current node's parent, then add my current node as a child of the found node.  Any advice offered would be appreciated.  I must be overlooking something obvious.

~ Greg



Plamen
Telerik team
 answered on 05 Jul 2012
2 answers
119 views
I am getting a very strange error when i try to run the below code on IPAD. 

<%@ 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 id="Head1" runat="server">
    <script type="text/javascript">
        window.onerror = WindowError;


        //error handler for showing error on the main page in the bottom of the page
        function WindowError(errorMsg, url, linenumber) {
            alert(errorMsg);
            $("#errorDiv").show("Slow");
            $("#errorMsgDiv").html(errorMsg);
        }
    </script>
</head>
<body>
    <form id="frmSrchClient" runat="server" enableviewstate="false">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true">
    </telerik:RadScriptManager>
    <telerik:RadSplitter ID="RadSplitter1" Runat="server" SplitBarsSize="">
        <telerik:RadPane Scrolling="None" ID="treeViewPane" runat="server">
            <telerik:RadSplitter SplitBarsSize="3" ID="ContentSplitter"
                BorderSize="0" PanesBorderSize="0" runat="server" Height="100%" Width="100%">
                <telerik:RadPane Scrolling="Both" ID="NavigationPane" runat="server" Width="200"
                    MinWidth="90" Height="100%">
                        <telerik:RadPanelBar ID="NavigationPanelBar" Width="100%" Height="100%"
                            Style="overflow: hidden" EnableEmbeddedSkins="false" Skin="Metro" runat="server"
                            AccessKey="A" ExpandMode="MultipleExpandedItems">
                            <ExpandAnimation Duration="0" />
                            <CollapseAnimation Duration="0" />
                            <Items>
                                <telerik:RadPanelItem Text="First" Height="21" TabIndex="1" Expanded="true">
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                Text
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                                <telerik:RadPanelItem Text="Second" Height="21" TabIndex="2" Expanded="true">
                                    <Items>
                                        <telerik:RadPanelItem>
                                            <ItemTemplate>
                                                    Text1
                                            </ItemTemplate>
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                            </Items>
                        </telerik:RadPanelBar>
                </telerik:RadPane>
            </telerik:RadSplitter>
        </telerik:RadPane>
    </telerik:RadSplitter>
    </form>
</body>
</html>

In the above code if you click on "Text1" you will see that error. This error comes only when i try to run this on IPAD for all other OS's it is working fine. Can you please let me know where I am going wrong. The error only comes when i include the RadPanelBar within the RadSplitter. If if run it alone this error does not come. Can you please let me know the reason behind this I am unable to debug this issue.
Kate
Telerik team
 answered on 05 Jul 2012
1 answer
132 views
Hi,

I'm trying to Dynamically generate the RadContextMenu based on the contents of the Cell in RadGrid on which the user clicks. The menu items are stored in the SQL Sever database. Below is my client side code :

function RowContextMenu(sender, eventArgs) {
                var evt = eventArgs.get_domEvent();
  
                if (evt.target.tagName == "INPUT" || evt.target.tagName == "A") {
                    return;
                }
  
                var index = eventArgs.get_itemIndexHierarchical();
                var row = sender.get_masterTableView().get_dataItems()[index];
  
                var current_status = sender.get_masterTableView().getCellByColumnUniqueName(row, "Current_Status").innerHTML;
                var process_status = sender.get_masterTableView().getCellByColumnUniqueName(row, sender.get_masterTableView().get_columns()[evt.target.cellIndex].get_uniqueName()).innerHTML;
                var process_area = //write code to get the column header of the selected cell
  
                document.getElementById("radGridClickedRowIndex").value = index;
                sender.get_masterTableView().selectItem(row.get_element(), true);
  
                var menu = $find("<%=RadMenu1.ClientID %>");
                menu.show(evt);
  
                evt.cancelBubble = true;
                evt.returnValue = false;
  
                if (evt.stopPropagation) {
                    evt.stopPropagation();
                    evt.preventDefault();
                }
            }

Now i want to pass the values current_Status, process_status and process_area to SQL server and get the list of actions to populate in the context menu.

Below are some snippets of the ASPX code:
<asp:SqlDataSource ID="ActionsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MetadataCS %>"
    ProviderName="<%$ ConnectionStrings:MetadataCS.ProviderName %>" SelectCommand="SELECT [Action] FROM [FileStatusActions] WHERE (([Process_Area] = @Process_Area) AND ([Current_Status] = @Current_Status) AND ([Process_Status] = @Process_Status))">
    <SelectParameters>
        <asp:Parameter Name="Process_Area" Type="String" />
        <asp:Parameter Name="Current_Status" Type="String" />
        <asp:Parameter Name="Process_Status" Type="String" />
    </SelectParameters>
</asp:SqlDataSource>
<telerik:RadContextMenu ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick" OnClientShowing="showContextMenu"
    DataSourceID="ActionsDataSource" DataTextField="Action" DataValueField="Action" AppendDataBoundItems="true"
    EnableRoundedCorners="true" EnableShadows="true">
    <Items>
        <telerik:RadMenuItem Text="Dynamic Menu" />
    </Items>
</telerik:RadContextMenu>

Please help me achieve the desired functionality using either client side/server side code ? I am also willing to use XML files to load menu instead of database if feasible/possible.

Thanks,
Nishant
Tsvetina
Telerik team
 answered on 05 Jul 2012
9 answers
209 views
Hi

I am using a Telerik Rad Grid with Drag and drop functionality for rows. but when I select multiple rows and drag out of the grid, it shows a large empty box dragging additionally to the selected rows.

Anybody came across this issue before? Any solution to overcome this issue would be very helpful.

Thanks
Malinda
Tsvetina
Telerik team
 answered on 05 Jul 2012
2 answers
203 views
I was wondering is someone could give me hand converting this GridView code to work with the RadGrid control.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
  
<!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">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Get Values" OnClick="Button1_Click" />
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
    </div>
    </form>
</body>
</html>

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 override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        TemplateField templateField = new TemplateField();
        GridView1.Columns.Add(templateField);
        templateField.ItemTemplate = new MyCheckBoxTemplate();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GridView1.DataSource = new string[] { "a", "b", "c" };
            GridView1.DataBind();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
            bool isChecked = ((CheckBox)row.FindControl("CheckBox1")).Checked;
            Response.Write("RowIndex " + row.RowIndex + ": " + isChecked + "<br />");
        }
    }  
}
  
public class MyCheckBoxTemplate : ITemplate
{
    void ITemplate.InstantiateIn(Control parent)
    {
        CheckBox cb = new CheckBox();
        cb.ID = "CheckBox1";
        parent.Controls.Add(cb);
    }
}
Sizo
Top achievements
Rank 1
 answered on 05 Jul 2012
1 answer
136 views
 *sigh* It's embarrassing enough that I discover I was putting the PageSize on the wrong element but there does not seem to be a way of deleteing this post.
Tsvetoslav
Telerik team
 answered on 05 Jul 2012
5 answers
215 views
I am attempting to use the RadSocialShare control to allow users of my web site to tell others about the link. I have used the following code:

<telerik:RadSocialShare ID="RadSocialShare1" runat="server" CssClass="emailwrapper" Skin="Sitefinity" EnableEmbeddedSkins="true" >
<MainButtons>
<telerik:RadSocialButton SocialNetType="SendEmail" ToolTip="Email" CustomIconUrl="Images2/product/emailtofriend.png"/>
</MainButtons>
</telerik:RadSocialShare>

I am getting the following message when I attempt to send an email:

"Ooops!:( An error has occurred!"

I have got a section in my web.config for

  <system.net>
    <mailSettings>
      <smtp from="customerservices@mywebaddress.com" deliveryMethod="Network">
        <network host="myisprelayserver.net" port="25" defaultCredentials="true" />
      </smtp>
    </mailSettings>
  </system.net>

These settings work when I send mail in code using SmtpClient.Send() in another part of my application

Does anyone have any ideas why I might be getting this error?
Zbysek
Top achievements
Rank 1
 answered on 05 Jul 2012
3 answers
128 views
I'm working with a RadSlider, is it possible to have the maximum value as a LONG instead of an INT?
Slav
Telerik team
 answered on 05 Jul 2012
1 answer
139 views
Hello,

I have a button outside of the Grid which should close any opened insert and edit forms. For insert forms this works without any problem:

if (m_grid.MasterTableView.IsItemInserted)
{
    GridEditFormInsertItem insertItem = (GridEditFormInsertItem)m_grid.MasterTableView.GetInsertItem();
    insertItem.FireCommandEvent("PerformInsert", String.Empty);
}

But for the edit item it doesn't work correctly:

if (m_grid.EditItems.Count > 0)
{
     m_grid.EditItems[0].FireCommandEvent("Update", String.Empty);
}

The GridSaveCommand event is called, but when I try to access my EditForm, it doesn't get found when updating (control will be null). When inserting, it works perfectly. What am I doing wrong when updating?

MyControl control = (MyControl )e.Item.FindControl("MyControl");

Thanks!
Shinu
Top achievements
Rank 2
 answered on 05 Jul 2012
0 answers
274 views
Hi,

I have an error when clicking on any of the buttons in a pop up.

Here is the scenario:

I have a pop up (JQuery pop up) wuich contains a Repeater.
The Repeater has a column which contains Edit buttons.
When  click on Edit button, another pop up opens.

In this pop up we have some buttons and a RadComboobx.

When we click on any of the buttons or change the combo value. I am getting the bellow error:

******************************************
<error errorId="bf74c476-13ac-4da5-bf5c-95d79e24b04a" application="/" host="AIA3D050IBA" type="System.ArgumentException" message="Invalid JSON primitive: {"enabled":true,"emptyMessage":"","minValue":1,"maxValue":70368744177664}." source="System.Web.Extensions" detail="System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: Invalid JSON primitive: {"enabled":true,"emptyMessage":"","minValue":1,"maxValue":70368744177664}. at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject(String input) at Telerik.Web.UI.RadWebControl.LoadPostData(String postDataKey, NameValueCollection postCollection) at Telerik.Web.UI.RadInputControl.LoadPostData(String postDataKey, NameValueCollection postCollection) at Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.queue_request_aspx.ProcessRequest(HttpContext context) in c:\Documents and Settings\sradavelli\Local Settings\Temp\Temporary ASP.NET Files\root\b1d35cf8\b00004d1\App_Web_z0cnhrqi.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)" 

******************************************

Note: I have placed the pop up DIV in an UpdatePanel control.

Any one have any Ideas why this is happening.

Sri
Top achievements
Rank 1
 asked on 05 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
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
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?