Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
133 views
See title.
Nencho
Telerik team
 answered on 03 Mar 2015
1 answer
101 views


Hi,



I’m after some advice please.  My aim is to setup a dynamic sort of roadmap.  Visually this would need to be a grid comprising of twelve columns (represents the next 12 months) and then each activity would exists as a row.

So far I’ve got the grid displaying with the dynamic columns using this simple code:

   DataTable table = new
DataTable();

 

            var startDate = new DateTime(2015, 3, 1);

            var months = Enumerable.Range(0,
11)

                      
.Select(startDate.AddMonths)

                       .Select(m =>
m.ToString("yyyy MMMM"))

                       .ToList();

 

            foreach (string month
in months)

            {

               
table.Columns.Add(month);

            }

 

The next chahlenge was get the rows to appear correctly.  To enable this I created a simple test database table.

I then loop through each row of the tasking table and attempt to match the target_date value with the column date value, if I get a match I insert the data at the correct position

Here is the code I use:

     foreach (DataRow
row in dtroadmapdata.Rows)

            {

               
foreach (DataColumn
col in table.Columns)

               
{

                   
if ((string)row["target_date"] == col.ColumnName)

                   
{

                        DataRow dr = table.NewRow();

                        dr[col.Ordinal] = row["task"];

                        table.Rows.Add(dr);

                   
}

               
}

            }

 

So far so good. However instead of just displaying text I need to insert an image (ideally with an embedded hyperlink)

How can I accomplish this please, tricky because I have no template fields because the columns are creating on the fly.

Any suggestions greatly appreciated.

Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
63 views
In my tree, the leaves are the data carriers, but I want a click on a particular node to (visually) select itself and all its descending nodes. I am then using the list of selected nodes in an Ajax request.

But I haven't been able to figure out how to accomplish this.

I started out by selecting all the node's children:

var toSelect = !node.get_selected();

if (toSelect)
                node.select();
            else
                node.unselect();

 children.forEach(function(child) {
                if (toSelect )
                    child.select();                    
                else
                    child.unselect();
            });

This does indeed select all the nodes. The problem though, is that it does not show (they don't turn blue). So I was looking for a way to do this through the Telerik client side API, but failed. So I turned to Jquery:

var tree = $find("rtCustomerGroups");
var nodes = tree.get_nodes();

nodes.forEach(function(node) {
if (node.get_selected())
node.addClass("rtSelected");
else
node.removeClass("rtSelected");

The problem with this approach is that, while it works visually, the browser does not seem to like it - as it's complaining (sometimes) with a typeError saying addClass/removeClass aren't functions.

This also breaks the javascript as the next line, calling the Ajax function, never gets run.

This really bugs me, as the selection really works the way I want, including multi selection with ctrl click.

Bozhidar
Telerik team
 answered on 03 Mar 2015
1 answer
36 views
In my tree, the leaves are the data carriers, but I want a click on a particular node to (visually) select itself and all its descending nodes. I am then using the list of selected nodes in an Ajax request.

But I haven't been able to figure out how to accomplish this.

I started out by selecting all the node's children:

var toSelect = !node.get_selected();

if (toSelect)
                node.select();
            else
                node.unselect();

 children.forEach(function(child) {
                if (toSelect )
                    child.select();                    
                else
                    child.unselect();
            });

This does indeed select all the nodes. The problem though, is that it does not show (they don't turn blue). So I was looking for a way to do this through the Telerik client side API, but failed. So I turned to Jquery:

var tree = $find("rtCustomerGroups");
var nodes = tree.get_nodes();

nodes.forEach(function(node) {
if (node.get_selected())
node.addClass("rtSelected");
else
node.removeClass("rtSelected");

The problem with this approach is that, while it works visually, the browser does not seem to like it - as it's complaining (sometimes) with a typeError saying addClass/removeClass aren't functions.

This also breaks the javascript as the next line, calling the Ajax function, never gets run.

This really bugs me, as the selection really works the way I want, including multi selection with ctrl click.

Bozhidar
Telerik team
 answered on 03 Mar 2015
1 answer
91 views
Hi there,

We have a problem with the strong password check of the radTextBox.
In our changepassword screen the strong password indicator isn't working. This means of course that new users of our product cannot change their initial password since we require at least a strong password.

Next our administrator goes to her usermanagement screen (which also contains a radTextBox with Passwordstrength settings enabled) and changes the password of this user.  The indicator ís working here. (Note: she does this on her own machine, not the user's).

The user now tries to change her password again. Now, all of a sudden the user does see the passwordstrength indicator. What's more, so does everyone else who tries to change his of her password.

It feels as if sometimes the server doesn't load javascripts to the browser, but once it has loaded the script, it keeps doing it.

We see this behaviour since we upgraded to the Telerik 2014 Q3 controls, version 2014.3.1024.45.

We don't have a clue what is going on here, but we do get a lot of support questions now. Anyone any idea what's going on here?







Dimitar
Telerik team
 answered on 03 Mar 2015
1 answer
133 views
for example:
<!DOCTYPE html">
<head runat="server">
<script type="text/javascript">
function pageLoad()
{
    $find("DropDownList").get_items().removeAt(0);
}
</script>
</head>
<body>
<form runat="server">
<Telerik:RadScriptManager runat=server />
<Telerik:RadDropDownList runat=server ID=DropDownList>
    <Items>
        <Telerik:DropDownListItem Text=1 />
        <Telerik:DropDownListItem Text=2 Selected />
        <Telerik:DropDownListItem Text=3 />
    </Items>
</Telerik:RadDropDownList>
</form>
</body>
</html>
Open the page above, then select the item "3", It will cause that the item "2" will not able to select.
The Version of my RadControl is "2014 Q1"
Bozhidar
Telerik team
 answered on 03 Mar 2015
1 answer
69 views
Hi

I have a problem with AJAX.
AJAX update field that not specified in configuration. Can you tell me why ajax updated "textbox2" after I change the RadComboBox index?
(here is a simplified code of my application)


<telerik:RadAjaxLoadingPanel ID="rlpLoadingPanel" runat="server" Skin="Default" />
    <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
        <AjaxSettings>

            <telerik:AjaxSetting AjaxControlID="cmbTest">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="textBox1" LoadingPanelID="rlpLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>


            <telerik:AjaxSetting AjaxControlID="tButton">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="myPanel1" LoadingPanelID="rlpLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>

        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

    <asp:Panel runat="server" ID="myPanel1">

        <telerik:RadComboBox ID="cmbTest" runat="server" AutoPostBack="true" OnSelectedIndexChanged="cmbTest_SelectedIndexChanged">
            <Items>
                <telerik:RadComboBoxItem runat="server" Text="test 1" />
                <telerik:RadComboBoxItem runat="server" Text="test 2" />
                <telerik:RadComboBoxItem runat="server" Text="test 3" />
                <telerik:RadComboBoxItem runat="server" Text="test 4" />
                <telerik:RadComboBoxItem runat="server" Text="test 5" />
                <telerik:RadComboBoxItem runat="server" Text="test 6" />
                <telerik:RadComboBoxItem runat="server" Text="test 7" />
            </Items>
        </telerik:RadComboBox>
        <br />
        <br />
        <telerik:RadTextBox runat="server" ID="textBox1"></telerik:RadTextBox>
        <br />
        <telerik:RadTextBox runat="server" ID="textBox2"></telerik:RadTextBox>
    </asp:Panel>

    <asp:Panel runat="server" ID="myPanel2">
        <telerik:RadButton runat="server" ID="tButton" OnClick="tButton_Click" Text="Button"></telerik:RadButton>
    </asp:Panel>




This is code on server side

        protected void cmbTest_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {            
            textBox1.Text = "textValue1";
            textBox2.Text = "textValue2";
        }


Whne I move

<telerik:AjaxSetting AjaxControlID="tButton">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="myPanel1" LoadingPanelID="rlpLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>

from my ajax configuration everythis is work normal. I dont understand the link between this and changing the RadComboBox index. Why "myPanel1" have inbluence on this?
Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
52 views
Hello

how we can change animation , i want to load each image , to leave by the left , right to left , each one.

Like this site in : "Notre agence vous propose" :

http://www.sextantfrance.fr/
Daniel
Telerik team
 answered on 03 Mar 2015
4 answers
340 views
Hello,

Here is my situation:

I have a RadGrid with a List<MyObject> as the datasource. The MyObject class has a property of Deleted on it which is a boolean.

My requirement is to filter to show only MyObjects in the RadGrid that have a Deleted propery of false. Hiding MyObjects that have a Deleted value of true.

For some reason I cannot figure out how to filter my RadGrid on the Deleted property.

Here are some of my attempts:

RadGrid1.MasterTableView.FilterExpression = "Deleted = false";
RadGrid1.MasterTableView.FilterExpression = "Deleted = 'false'";
RadGrid1.MasterTableView.FilterExpression = "Deleted is false";
RadGrid1.MasterTableView.FilterExpression = "NOT Deleted";

If anyone knows what I am doing wrong, please point me in the right direction.

Thanks,

TMP




 

Kamal
Top achievements
Rank 1
 answered on 03 Mar 2015
14 answers
699 views
I am trying to implement a custom filter using the DropDownList control as documented in
http://www.telerik.com/help/aspnet-ajax/grid-filtering-with-dropdownlist.html

However, I am generating the RadGrid columns at runtime in the Page_Load event.

I receive the error "Exception of type 'System.Web.HttpUnhandledException' was thrown. when I try to filter the data. The grid and data load correctly. I receive the error only when I try to filter the data. The exception is trapped in the GLobal.asax. I cannot determine what is throwing the exception.

The RadGrid filtering works fine if I do not use the MyCustomFilteringColumn and simply use the GridBoundColumn for all columns that are created.

The project uses the Adventure Works 2008R2 database. I am displaying all records from the DimCustomer table. The "FirstName" column implements the custom control  "MyCustomFilteringColumn : GridBoundColumn". All other columns are "GridBoundColumn".

I'm not sure what I'm missing. Any help would be greatly appreciated.

Thanks,
Mike

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewMemberDetails.aspx.cs" Inherits="BillingPortal.ViewMemberDetails" %>
<!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>
    <link href="Styles/VisualIdentity.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">
    function PopupClose(button)
    {
        window.close();
    }
</script>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
                    <%--Needed for JavaScript IntelliSense in VS2010--%>
                    <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                </Scripts>
            </telerik:RadScriptManager>
    <div>
   <center> <h1><font color="#00458a"> Test RadGrid Custom Filter </font></h1>
     <telerik:RadGrid ID="RadGrid1" OnNeedDataSource="RadGrid2_NeedDataSource"
                     AllowPaging="True" runat="server" GridLines="None"  Width="1199px"
                      CellSpacing="0" AllowFilteringByColumn="True"
                     AutoGenerateColumns="False" Skin="Windows7" >
    <MasterTableView Width="99%" CommandItemDisplay="Top" >
    <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="false" ShowExportToWordButton="false" ShowExportToCsvButton="false" />
    <Columns>
    </Columns>
    </MasterTableView>
   </telerik:RadGrid>
   <h3 />
   <h3><asp:Label ID="lblError" runat="server" ForeColor="Red" Visible="False"></asp:Label>
   </h3>
   <h3 />
   <telerik:RadButton ID="btnClose" runat="server" OnClientClicked="PopupClose" Text="Close"></telerik:RadButton>
   </center>
    </div>
    </form>
</body>
</html>
 
 
 
 
 
 
 
 
    public partial class ViewMemberDetails : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Visible = false;
 
            if (!IsPostBack)
            {
                DataTable dt;
 
                dt = GetData();
 
                // build RadGrid columns
 
                RadGrid1.MasterTableView.Columns.Clear();
 
                foreach (DataColumn dataColumn in dt.Columns)
                {
                    if (dataColumn.ColumnName == "FirstName")
                    {
                        MyCustomFilteringColumn gridColumn = new MyCustomFilteringColumn();
                        RadGrid1.MasterTableView.Columns.Add(gridColumn);
 
                        gridColumn.DataField = dataColumn.ColumnName;
                        gridColumn.HeaderText = dataColumn.ColumnName;
                        gridColumn.UniqueName = dataColumn.ColumnName;
                    }
                    else
                    {
                        GridBoundColumn boundColumn = new GridBoundColumn();
                        RadGrid1.MasterTableView.Columns.Add(boundColumn);
 
                        boundColumn.DataField = dataColumn.ColumnName;
                        boundColumn.HeaderText = dataColumn.ColumnName;
                        boundColumn.UniqueName = dataColumn.ColumnName;
                    }
                }
            }
        }
 
        protected void RadGrid2_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = GetData();
        }
 
        public DataTable GetData()
        {
            string sConnectionString;
 
            sConnectionString = "Server=.;Database=AdventureWorksDW2008R2;Trusted_Connection=Yes;";
 
            SqlConnection conn = new SqlConnection(sConnectionString);
            SqlCommand cmd = new SqlCommand();
            SqlDataAdapter adapter = new SqlDataAdapter();
            DataSet dsSummary = new DataSet();
            DataTable dtSummary;
 
            try
            {
                conn.Open();
                cmd = new SqlCommand("SELECT * FROM [AdventureWorksDW2008R2].[dbo].[DimCustomer]", conn);
                cmd.CommandType = CommandType.Text;
                adapter.SelectCommand = cmd;
                adapter.Fill(dsSummary);
            }
            catch (Exception ex)
            {
                this.lblError.Visible = true;
                this.lblError.Text = ex.Message;
 
            }
            finally
            {
                conn.Close();
            }
 
            dtSummary = dsSummary.Tables[0];
 
            return dtSummary;
        }
 
        public class MyCustomFilteringColumn : GridBoundColumn
        {
            private object listDataSource = null;
            //RadGrid calls this method when it initializes the controls inside the filtering item cells
 
            protected override void SetupFilterControls(TableCell cell)
            {
                base.SetupFilterControls(cell);
                cell.Controls.RemoveAt(0);
                DropDownList list = new DropDownList();
                list.ID = "list" + this.DataField;
                list.AutoPostBack = true;
                list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);
                cell.Controls.AddAt(0, list);
                cell.Controls.RemoveAt(1);
                list.DataTextField = this.DataField;
                list.DataValueField = this.DataField;
 
                //list.DataSource = this.ListDataSource;
                list.DataSource = this.ListDataSource2;
 
                //string[] s1 = new string[3] { "John", "Paul", "Mary" };
                //ListDataSource = s1;
            }
            void list_SelectedIndexChanged(object sender, EventArgs e)
            {
                GridFilteringItem filterItem = (sender as DropDownList).NamingContainer as GridFilteringItem;
                if (this.DataType == System.Type.GetType("System.Int32") || this.DataType == System.Type.GetType("System.Int16") || this.DataType == System.Type.GetType("System.Int64"))
                {
                    filterItem.FireCommandEvent("Filter", new Pair("EqualTo", this.UniqueName));
                }
                else
                    // treat everything else like a string  
                    filterItem.FireCommandEvent("Filter", new Pair("Contains", this.UniqueName));
            }
            public object ListDataSource
            {
                get
                {
                    return this.listDataSource;
                }
                set
                {
                    listDataSource = value;
                }
            }
 
            public DataTable ListDataSource2
            {
                get
                {
                    // Build list values
                    DataTable dtDropDownValues = new DataTable();
                    dtDropDownValues.Columns.Add(this.DataField);
 
                    DataRow _dr = dtDropDownValues.NewRow();
                    _dr[this.DataField] = "Mike";
                    dtDropDownValues.Rows.Add(_dr);
 
                    DataRow _dr2 = dtDropDownValues.NewRow();
                    _dr2[this.DataField] = "Rob";
                    dtDropDownValues.Rows.Add(_dr2);
 
                    DataRow _dr3 = dtDropDownValues.NewRow();
                    _dr3[this.DataField] = "Jim";
                    dtDropDownValues.Rows.Add(_dr3);
 
                    return dtDropDownValues;
                }
            }
 
            //RadGrid calls this method when the value should be set to the filtering input control(s) 
            protected override void SetCurrentFilterValueToControl(TableCell cell)
            {
                base.SetCurrentFilterValueToControl(cell);
                DropDownList list = (DropDownList)cell.Controls[0];
                if (this.CurrentFilterValue != string.Empty)
                {
                    list.SelectedValue = this.CurrentFilterValue;
                }
            }
            //RadGrid calls this method to extract the filtering value from the filtering input control(s) 
            protected override string GetCurrentFilterValueFromControl(TableCell cell)
            {
                DropDownList list = (DropDownList)cell.Controls[0];
                return list.SelectedValue;
            }
            protected override string GetFilterDataField()
            {
                return this.DataField;
            }
        }
Kamal
Top achievements
Rank 1
 answered on 03 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?