Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
515 views
Hello,

I'm using the ASP.NET AJAX pageLoad()-method inside my javascript to attach e.g. a click event to a task of the gantt control. But it seems that this pageLoad()-method will not be invoked anymore if I collapse a task. And even if I expand that task again, the pageLoad()-method inside my javascript-code is not called anymore, too. The $(document).ready()-function is not working in my case because I add a special css-class as a bookmark to attach the click-event and this must happen on every page load. I hope you can help me.

Regards,
Felix
Felix
Top achievements
Rank 1
 answered on 26 Mar 2015
1 answer
98 views
Hello Team,

I am working on one web applicaiton, where we are using radgrid with linkbutton inside template column.

On click of link button we are opening radwindow with a radgrid inside.

On click of link button radwindow opens perfect with rebinding grid inside.

The issue is on click of linkbutton it refresh the grid before opening radwindow.

Can anyone help me out with this?

Thanks in Advance,
Ruchi Patel

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DemoPage.aspx.cs" Inherits="DemoApp.DemoPage" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
            <telerik:RadScriptBlock ID="scrCode_Outlier" runat="server">
                <script type="text/javascript">
                    function OpenRadWin(ID) {
                        debugger
                        <%--document.getElementById("<%=hdnValue.ClientID %>").setAttribute('value', ID);--%>
                        var wnd = $find("<%=rdRTOutlierWindow.ClientID %>");
                        wnd.show();
                    }
                </script>
            </telerik:RadScriptBlock>
            <telerik:RadAjaxManager ID="radmgr" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="rgRTOutlierView">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="rgRTOutlierView"></telerik:AjaxUpdatedControl>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadWindow ID="rdRTOutlierWindow" runat="server" Modal="true" ReloadOnShow="true" MinWidth="1000px" MinHeight="400px" EnableViewState="true">
                <ContentTemplate>
                    <telerik:RadAjaxPanel ID="rdpnl_RTDetail" runat="server">
                        <telerik:RadGrid ID="rgRTOutlierDetail" runat="server" AllowPaging="True" AllowSorting="true" AutoGenerateColumns="true" ClientSettings-EnablePostBackOnRowClick="false" OnNeedDataSource="rgRTOutlierDetail_NeedDataSource"
                            ExportSettings-IgnorePaging="true" ExportSettings-ExportOnlyData="true" ExportSettings-Excel-Format="Biff" MasterTableView-CommandItemSettings-ShowExportToExcelButton="true" MasterTableView-CommandItemSettings-ShowExportToCsvButton="true" MasterTableView-CommandItemSettings-ShowExportToPdfButton="true">
                            <MasterTableView DataKeyNames="ID">
                                <CommandItemSettings ShowAddNewRecordButton="false" />
                                <Columns></Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
                    </telerik:RadAjaxPanel>
                </ContentTemplate>
            </telerik:RadWindow>
 
            <telerik:RadAjaxPanel ID="rdpnl_RT" runat="server" LoadingPanelID="LoadingPanel1" Width="700px" Height="300px">
 
                <telerik:RadGrid ID="rgRTOutlierView" runat="server" AllowPaging="True" AllowSorting="true" AutoGenerateColumns="false" Width="100%"
                    OnNeedDataSource="rgRTOutlierView_NeedDataSource" OnItemCommand="rgRTOutlierView_ItemCommand"
                    PageSize="2" EnablePostBackOnRowClick="true" MasterTableView-CommandItemDisplay="Bottom">
                    <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="ID">
                        <CommandItemSettings ShowAddNewRecordButton="false" />
                        <Columns>
                            <telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Detail" DataField="ID" UniqueName="ID" HeaderStyle-Width="10%">
                                <ItemTemplate>
                                    <asp:LinkButton ID="hylnkAccn" runat="server" CommandName="Detail" CommandArgument='<%# Eval("ID") %>' Text="Detail" OnClientClick='<%# "OpenRadWin(" + Eval("ID") + ");" %>'></asp:LinkButton><%--OnClientClick='<%# "OpenRadWin(" + Eval("ID") + ");" %>'--%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" HeaderStyle-Width="10%"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" HeaderStyle-Width="20%"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Education" HeaderText="Education" HeaderStyle-Width="20%"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Education" HeaderText="Education" HeaderStyle-Width="30%"></telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                        <ClientEvents OnCommand="RadGridCommand" />
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                    </ClientSettings>
                </telerik:RadGrid>
                <telerik:RadCodeBlock runat="server" ID="radcode1">
                    <script type="text/javascript">
                        function RadGridCommand(sender, args) {
                            debugger
                            if (args.get_commandName() == "Detail") {
                                var itemIndex = args.get_commandArgument();
                                var rowID = (itemIndex != null && itemIndex != undefined && itemIndex != "") ? args.get_tableView()._dataSource[itemIndex].ID : 0;
                                OpenRadWin(rowID);
                            }
                            args.set_cancel(true);
                        }
 
                    </script>
                </telerik:RadCodeBlock>
            </telerik:RadAjaxPanel>
        </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace DemoApp
{
    public partial class DemoPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rgRTOutlierView.DataBind();
            }
        }
 
        protected void rgRTOutlierView_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            //(sender as RadGrid).DataSource = GetDataTable();
 
            rgRTOutlierView.DataSource = GetDataTable();
 
        }
        protected void rgRTOutlierView_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName.ToLower().Equals("detail"))
            {
                rgRTOutlierDetail.Rebind();
            }
        }
        public DataTable GetDataTable()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Id", typeof(string));
            dt.Columns.Add("UserName", typeof(string));
            dt.Columns.Add("Education", typeof(string));
            dt.Columns.Add("Location", typeof(string));
 
            DataRow dtrow = dt.NewRow();   
            dtrow["Id"] = 1;           
            dtrow["UserName"] = "SureshDasari";
            dtrow["Education"] = "B.Tech";
            dtrow["Location"] = "Chennai";
            dt.Rows.Add(dtrow);
 
            dtrow = dt.NewRow();       
            dtrow["Id"] = 2;           
            dtrow["UserName"] = "MadhavSai";
            dtrow["Education"] = "MBA";
            dtrow["Location"] = "Nagpur";
            dt.Rows.Add(dtrow);
 
            dtrow = dt.NewRow();       
            dtrow["Id"] = 3;           
            dtrow["UserName"] = "MaheshDasari";
            dtrow["Education"] = "B.Tech";
            dtrow["Location"] = "Nuzividu";
            dt.Rows.Add(dtrow);
 
            dtrow = dt.NewRow();       
            dtrow["Id"] = 4;           
            dtrow["UserName"] = "Mahendra";
            dtrow["Education"] = "CA";
            dtrow["Location"] = "Guntur";
            dt.Rows.Add(dtrow);
 
            return dt;
        }
 
        protected void rgRTOutlierDetail_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            rgRTOutlierDetail.DataSource = GetDataTable();
        }
 
    }
}

Marin Bratanov
Telerik team
 answered on 26 Mar 2015
1 answer
43 views
Hello

For several year that I'm using Load on Demand based on XML. I start notice some failures lately and I saw that the fastest way is using a Web Service. Can I build new nodes calling a Web Service and change the node image?
Peter Filipov
Telerik team
 answered on 26 Mar 2015
3 answers
142 views
When I am trying to brows Asp.netAjax live demo in my machine it displays error message: the error is like this
A network-related or instance-specific error occured while establishing a connection to SQL server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL server is configured to allow remote connections.  (Provider:SQL Network Interface, error: 26-Error locating server/Instance specified)

Is there any means to fix this problem?
Dimitar
Telerik team
 answered on 26 Mar 2015
6 answers
172 views
Hi
 How we can find control in DataFrom ASP.net from client side.

Thanks


 
Eyup
Telerik team
 answered on 26 Mar 2015
2 answers
582 views
Hi All,
Just wondering how can I update parent control from child user control?
Here's the structure of my Page
Master Page
    Parent Aspx with my radmenu
         User Control with button.

When I click on my button it updates my radmenu when theres postback,
but when its ajaxified my radmenu wont update.

Any code I could use to link child to update parent control with Ajax.

Thanks in advance,
RJ
RJ
Top achievements
Rank 1
 answered on 26 Mar 2015
1 answer
94 views
I have a radscheduler and the date that shows up in the header is very dark.  I have used other radschedulers in my application and did not have this problem, so I have to believe that it is something I did with this specific one.  I have attached a screenshot of the code for the radscheduler and a screenshot of the problem.  Any help is appreciated.
Kevin
Top achievements
Rank 1
 answered on 25 Mar 2015
1 answer
198 views
Hai, i got a problem using RadDateTimePicker.
I'm using a css class to apply style on button globally
The CSS style is like this:

button, input[type="button"], input[type="submit"]
 {
 border:2px solid #DFDFDF; -webkit-border-radius: 6px; -moz-border-radius: 6px;
 font-size:11px;font-family:tahoma, verdana, arial, sans-serif; padding: 4px 12px 4px 12px; text-decoration:none; display:inline-block;font-weight:bold; color: #141414;
 background-color: #E6E6E6; background-image: -webkit-gradient(linear, left top, left bottom, from(#E6E6E6), to(#CCCCCC));
 background-image: -webkit-linear-gradient(top, #E6E6E6, #CCCCCC);
 background-image: -moz-linear-gradient(top, #E6E6E6, #CCCCCC);
 background-image: -ms-linear-gradient(top, #E6E6E6, #CCCCCC);
 background-image: -o-linear-gradient(top, #E6E6E6, #CCCCCC);
 cursor: pointer;
  }
   
button, input[type="button"], input[type="submit"]:hover
{
    cursor: pointer;
    color: #414141;
    background-color: #cdcdcd; background-image: linear-gradient(to bottom, #cdcdcd, #b3b3b3);
 }
   
button, input[type="button"], input[type="submit"]:disabled
{
    opacity: 0.65;
    cursor: not-allowed;
}

and it makes the button ("Today", "OK", "Cancel") inside Calendar in RadDateTimePicker (On Calendar, Click on month, and it shows the button) is looks like disabled, and the cursor is "not-allowed" when i hover on it.

How to override the style on the button?

I have attach the image, it looks like disabled and the cursor is "not-allowed" (the screenshot in windows doesn't shows cursor, but believe me it's changed) 
Konstantin Dikov
Telerik team
 answered on 25 Mar 2015
1 answer
57 views
I have a webpage that has 2 user controls on it. In one user control i have a RadMenu. In the other user control, underneath the first user control, a flash movie object is placed, When I am developing and I run the application on my machine using either IE or Firefox as my default, the RadMenu displays over the flash movie. I then deploy the code to my development server. When I run the application (development server) using the Firefox browser on my machine the RadMenu displays over the flash movie.

When I run the application (development server) using IE browser on my machine the RadMenu displays behind the flash movie. This is the same IE (version 8) that my machine uses when running it locally on my machine.

I have tried everything but cannot see what is wrong. Attached is the code being generated using FireFox (embed) and IE(object). In both cases the wmode is set to opaque.Any thoughts on why it is displaying behind the flash movie when running IE using the development server only?
Ivan Danchev
Telerik team
 answered on 25 Mar 2015
1 answer
154 views
Hello,

I have a tree with node templates that are added programmatically in the code-behind. The tree is set up to display checkboxes (Checkboxes="true") and the template includes a label and checkbox.  I want to set up the tree so that when checking the node's checkbox will also set the template's checkbox to the opposite value and viceversa (checking the template's checkbox will set the node's checkbox).  I have tried different approaches but I just can't get this to work.  Can anybody point me in the right direction.  Here's the code for the .aspx page:

<style type="text/css">
    .RedBoldFont
    {
        color: red;
        font-weight:bold;
    }
    .RedBoldItalicFont
    {
        color: red;
        font-weight:bold;
        font-style:italic;
    }
</style>

<telerik:RadTreeView ID="attributesTree2" runat="server" OnNodeDataBound="attributesTree2_NodeDataBound" CheckBoxes="true" TriStateCheckBoxes="true" OnNodeCheck="attributesTree2_NodeCheck">

</telerik:RadTreeView>


 and for the code-behind:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace DDW
{
    public partial class TestingForDAR : System.Web.UI.UserControl
    {


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                
                ///////////////////////////////

                attributesTree2.DataSource = GetAttributes();

                attributesTree2.DataFieldID = "ID";
                attributesTree2.DataFieldParentID = "ParentID";
                attributesTree2.DataBind();


            }

            TreeNodeTemplate template = new TreeNodeTemplate();

            foreach (RadTreeNode node in attributesTree2.GetAllNodes())
            {                
                template.InstantiateIn(node);
            }

            //attributesTree2.DataBind();


        }

        public List<Attribute> GetAttributes()
        {
            List<Attribute> attributesList = new List<Attribute>();

            attributesList.Add(new Attribute(1, null, "Attribute A", "Description for Attribute A", true, false, false));
            attributesList.Add(new Attribute(2, 1, "Attribute A1", "Description for Attribute A1", true, false, false));
            attributesList.Add(new Attribute(3, 1, "Attribute A2", "Description for Attribute A2", false, false, false));
            attributesList.Add(new Attribute(4, 1, "Attribute A3", "Description for Attribute A3", false, false, false));
            attributesList.Add(new Attribute(5, null, "Attribute B", "Description for Attribute B", true, false, true));
            attributesList.Add(new Attribute(6, 5, "Attribute B1", "Description for Attribute B1", true, false, true));
            attributesList.Add(new Attribute(7, 5, "Attribute B2", "Description for Attribute B2", false, false, false));
            attributesList.Add(new Attribute(8, null, "Attribute C", "Description for Attribute C", false, false, false));
            attributesList.Add(new Attribute(9, 8, "Attribute C1", "Description for Attribute C1", false, false, false));
            attributesList.Add(new Attribute(10, 8, "Attribute C2", "Description for Attribute C2", false, false, false));

            //attributesList.Add(new Attribute(11, 10, "Attribute C21", "Description for Attribute C21", false, false, false));
            //attributesList.Add(new Attribute(12, 10, "Attribute C22", "Description for Attribute C22", false, false, false));
            //attributesList.Add(new Attribute(13, 12, "Attribute C22a", "Description for Attribute C22a", false, false, false));
            //attributesList.Add(new Attribute(14, 12, "Attribute C22b", "Description for Attribute C22b", false, false, false));
            //attributesList.Add(new Attribute(15, 12, "Attribute C22b", "Description for Attribute C22c", false, false, false));



            return attributesList;

        }

        protected void attributesTree2_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
        {
            Attribute nodeData = (Attribute)e.Node.DataItem;

            if (nodeData.Default)
            {
                //e.Node.ForeColor = Color.Red;
                e.Node.CssClass = "RedBoldFont";
                if (nodeData.Exclude)
                {
                    e.Node.CssClass = "RedBoldItalicFont";
                }

            }

            e.Node.Attributes.Add("Name", nodeData.Name);
            string exclude = nodeData.Exclude ? "true" : "false";
            e.Node.Attributes.Add("Exclude", exclude);
            e.Node.Attributes.Add("Description", nodeData.Description);


        }

        protected void attributesTree2_NodeCheck(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
        {
            e.Node.Attributes["Exclude"] = e.Node.Checked ? "false" : "true";

            attributesTree2.DataBind();
        }

    }


    public class Attribute
    {
        public int ID { get; set; }
        public int? ParentID { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public bool Include { get; set; }
        public bool Exclude { get; set; }
        public bool Default { get; set; }

        public Attribute()
        {

        }

        public Attribute(int id, int? parentID, string name, string description, bool def, bool include, bool exclude)
        {
            ID = id;
            ParentID = parentID;
            Name = name;
            Description = description;
            Default = def;
            Include = include;
            Exclude = exclude;
        }

    }

    ////////////////////////////////////////////////////////////////////////////////////////////////

    class TreeNodeTemplate : ITemplate
    {

        public event CommandEventHandler Command;

        private void OnCommand(CommandEventArgs e)
        {

            if (Command != null)
            {
                Command(this, e);
            }
        }

        public void InstantiateIn(Control container)
        {
            //...  

            Label lblAttrName = new Label();
            lblAttrName.ID = "lblAttrName";
            lblAttrName.DataBinding += new EventHandler(lblAttrName_DataBinding);
            container.Controls.Add(lblAttrName);

            CheckBox chkExclude = new CheckBox();
            chkExclude.ID = "ckExclude";
            chkExclude.AutoPostBack = true;
            chkExclude.DataBinding += new EventHandler(chkExclude_DataBinding);
            chkExclude.CheckedChanged += new EventHandler(chkExclude_CheckedChanged);
            container.Controls.Add(chkExclude);

            //Button saveButton = new Button();
            //saveButton.ID = "saveButton1";
            //saveButton.Text = "save";

            ////set properties  
            //saveButton.Command += saveButton_Command;
            ////data binding event handler  
            ////add to controls collection  
            //container.Controls.Add(saveButton);
            //...  
        }

        private void lblAttrName_DataBinding(object sender, EventArgs e)
        {
            Label target = (Label)sender;
            RadTreeNode node = (RadTreeNode)target.BindingContainer;

            target.Text = node.Attributes["Name"];
            target.ToolTip = node.Attributes["Description"];
        }

        private void chkExclude_DataBinding(object sender, EventArgs e)
        {
            CheckBox chkExclude = (CheckBox)sender; 
            RadTreeNode node = (RadTreeNode)chkExclude.BindingContainer;

            chkExclude.Checked = Convert.ToBoolean(node.Attributes["Exclude"]);
            node.Checked = !chkExclude.Checked;


        }

        private void chkExclude_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox target = (CheckBox)sender;
            RadTreeNode node = (RadTreeNode)target.Parent;

            Attribute data = (Attribute)node.DataItem;
            node.Checked = !data.Exclude;

        }

    }




}


 
Plamen
Telerik team
 answered on 25 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?