Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
1.2K+ views
Dear support team,

i have this problem.
I'm trying to disable the Telerik button after the click.
When i use the ASP:Button it works. When i use Telerik button, is not working.
Can you please help me with this?
Below you will find my code.

Javascript:
        function disableBtn(btnID, newText) {

            var btn = document.getElementById(btnID);
            btn.disabled = true;
            btn.value = newText;
        }

Telerik Button:
                <asp:UpdatePanel runat="server" ID="Panel">
                    <ContentTemplate>
                        <telerik:RadButton ID="btnSave" runat="server" ButtonType="LinkButton" Text="Proccess"
                            Width="50px" BorderColor="#006699" BorderStyle="Solid" BorderWidth="1px" ForeColor="#003366"
                            Height="40px" CssClass="SmallRadButtonsTop corners-all" Font-Size="Small" ValidationGroup="SaveOrder"
                            Enabled="False" Skin="Windows7" HoveredCssClass="ShadowOver" PressedCssClass="ShadowClick"
                            OnClientClicked="disableBtn(this.id, 'Submitting...')">
                            <Icon PrimaryIconUrl="~/Images/Save2.gif" PrimaryIconHeight="30" PrimaryIconWidth="50" />
                        </telerik:RadButton>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdateProgress ID="progress1" runat="server" AssociatedUpdatePanelID="Panel">
                    <ProgressTemplate>
                        <div class="">
                            <asp:Image runat="server" ImageUrl="images/loading.gif" />
                            <br />
                            Your Request is in Proccess.
                            <br />
                            Please Wait...
                        </div>
                    </ProgressTemplate>
                </asp:UpdateProgress>

Thank you in advance for you help.

Best Regards,
George.
Technology Department.
Peter
Top achievements
Rank 1
 answered on 03 Mar 2015
0 answers
50 views
I created my own  "Template" column. Everything works ok. But when I add
a child hierarchy and expand any row, the values of that column in the
father grid are lost.

Any suggestions on this?

I added part of my code to show the situation.

Code:

public class MyGridTemplateColumn : GridTemplateColumn
{
    public override void Initialize()
    {
        base.Initialize();

        HeaderStyle.Width = Unit.Pixel(105);
        HeaderText = "State";
        UniqueName = "StateCol";

        DataField = "StateId";
        DataType = typeof(byte);

        var _dataSource = new List<KeyValuePair<int, string>>
        {
            new KeyValuePair<int, string>(1, "Active"),
            new KeyValuePair<int, string>(2, "Deleted"),
            new KeyValuePair<int, string>(3, "Inactive"),
            new KeyValuePair<int, string>(6, "Other")
        };

        ItemTemplate = new MyItemTemplate(this.DataField, _dataSource);
        EditItemTemplate = new MyEditItemTemplate(this.DataField, _dataSource);
    }

    public override GridColumn Clone()
    {
        var res = new MyGridTemplateColumn();
        res.CopyBaseProperties(this);

        return res;
    }

    private class MyItemTemplate : ITemplate
    {
        private readonly string _dataField;
       
private readonly List<KeyValuePair<int, string>>
_dataSource = new List<KeyValuePair<int, string>>();

        public MyItemTemplate(string dataField, List<KeyValuePair<int, string>> origenDatos)
        {
            _dataField = dataField;
            _dataSource = origenDatos;
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            var lControl = new LiteralControl { ID = _dataField + "_lControl" };
            lControl.DataBinding += lControl_DataBinding;
            container.Controls.Add(lControl);
        }

        private void lControl_DataBinding(object sender, EventArgs e)
        {
            var l = (LiteralControl)sender;
            var value = l.NamingContainer.GetFieldValue("DataItem." + _dataField);
            if (value != null)
                l.Text = _dataSource.FirstOrDefault(s=>s.Key == (int)value).Value;
        }
    }

    private class MyEditItemTemplate : IBindableTemplate
    {
        private readonly string _dataField;
       
private readonly List<KeyValuePair<int, string>>
_dataSource = new List<KeyValuePair<int, string>>();

        public MyEditItemTemplate(string dataField, List<KeyValuePair<int, string>> origenDatos)
        {
            _dataField = dataField;
            _dataSource = origenDatos;
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            var rcBox = new RadComboBox
            {
                ID = _dataField + "_RadComboBox",
                DataTextField = "Value",
                DataValueField = "Key",
                DataSource = _dataSource
            };

            rcBox.DataBinding += rcBox_DataBinding;
            container.Controls.Add(rcBox);
        }

        public IOrderedDictionary ExtractValues(Control container)
        {
            var dictionary = new OrderedDictionary
            {
                {_dataField, (container.FindControl(_dataField + "_RadComboBox") as RadComboBox).SelectedValue}
            };
            return dictionary;
        }

        private void rcBox_DataBinding(object sender, EventArgs e)
        {
            var rcBox = (RadComboBox)sender;
            var value = rcBox.NamingContainer.GetFieldValue("DataItem." + _dataField);
            rcBox.SelectedValue = value != null ? value.ToString() : string.Empty;
        }
    }
}

Usage:

<telerik:RadGrid
ID="RadGrid1" runat="server" DataSourceID="LinqDataSource1"
AllowPaging="True" AutoGenerateColumns="False" Width="50%">
    <MasterTableView DataKeyNames="ENTUserAccountId" DataSourceID="LinqDataSource1" PageSize="5">
        <Columns>
            <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" UniqueName="UserName"/>
            <telerik:GridBoundColumn DataField="Email" HeaderText="Email" UniqueName="Email"/>
            <a:MyGridTemplateColumn />
        </Columns>
        <DetailTables>
            <telerik:GridTableView runat="server" DataSourceID="LinqDataSource2" DataKeyNames="ENTUserAccountId">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="ENTUserAccountId" MasterKeyField="ENTUserAccountId" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridTemplateColumn DataField="ENTRoleId" HeaderText="Rol" UniqueName="ENTRoleId">
                        <ItemTemplate>
                           
<asp:Label ID="ENTRoleIdLabel" runat="server" Text='<%#
Eval("ENTRole.RoleName") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>                 
            </telerik:GridTableView>
        </DetailTables>
    </MasterTableView>
</telerik:RadGrid>

<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="TelerikWebApp1.DataClasses1DataContext"
    EntityTypeName="" TableName="ENTUserAccount"/>
        
<asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="TelerikWebApp1.DataClasses1DataContext"
    EntityTypeName="" TableName="ENTRoleUserAccount" Where="ENTUserAccountId == @ENTUserAccountId">
        <WhereParameters>
            <asp:SessionParameter Name="ENTUserAccountId" Type="Int32" />
        </WhereParameters>
</asp:LinqDataSource>  



Delvis
Top achievements
Rank 1
 asked on 03 Mar 2015
0 answers
52 views
I created my own  "Template" column. Everything works ok. But when I add a child hierarchy and expand any row, the values of that column in the father grid are lost.

Any suggestions on this?

I added part of my code to show the situation.

Code:

public class MyGridTemplateColumn : GridTemplateColumn
{
    public override void Initialize()
    {
        base.Initialize();

        HeaderStyle.Width = Unit.Pixel(105);
        HeaderText = "State";
        UniqueName = "StateCol";

        DataField = "StateId";
        DataType = typeof(byte);

        var _dataSource = new List<KeyValuePair<int, string>>
        {
            new KeyValuePair<int, string>(1, "Active"),
            new KeyValuePair<int, string>(2, "Deleted"),
            new KeyValuePair<int, string>(3, "Inactive"),
            new KeyValuePair<int, string>(6, "Other")
        };

        ItemTemplate = new MyItemTemplate(this.DataField, _dataSource);
        EditItemTemplate = new MyEditItemTemplate(this.DataField, _dataSource);
    }

    public override GridColumn Clone()
    {
        var res = new MyGridTemplateColumn();
        res.CopyBaseProperties(this);

        return res;
    }

    private class MyItemTemplate : ITemplate
    {
        private readonly string _dataField;
        private readonly List<KeyValuePair<int, string>> _dataSource = new List<KeyValuePair<int, string>>();

        public MyItemTemplate(string dataField, List<KeyValuePair<int, string>> origenDatos)
        {
            _dataField = dataField;
            _dataSource = origenDatos;
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            var lControl = new LiteralControl { ID = _dataField + "_lControl" };
            lControl.DataBinding += lControl_DataBinding;
            container.Controls.Add(lControl);
        }

        private void lControl_DataBinding(object sender, EventArgs e)
        {
            var l = (LiteralControl)sender;
            var value = l.NamingContainer.GetFieldValue("DataItem." + _dataField);
            if (value != null)
                l.Text = _dataSource.FirstOrDefault(s=>s.Key == (int)value).Value;
        }
    }

    private class MyEditItemTemplate : IBindableTemplate
    {
        private readonly string _dataField;
        private readonly List<KeyValuePair<int, string>> _dataSource = new List<KeyValuePair<int, string>>();

        public MyEditItemTemplate(string dataField, List<KeyValuePair<int, string>> origenDatos)
        {
            _dataField = dataField;
            _dataSource = origenDatos;
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            var rcBox = new RadComboBox
            {
                ID = _dataField + "_RadComboBox",
                DataTextField = "Value",
                DataValueField = "Key",
                DataSource = _dataSource
            };

            rcBox.DataBinding += rcBox_DataBinding;
            container.Controls.Add(rcBox);
        }

        public IOrderedDictionary ExtractValues(Control container)
        {
            var dictionary = new OrderedDictionary
            {
                {_dataField, (container.FindControl(_dataField + "_RadComboBox") as RadComboBox).SelectedValue}
            };
            return dictionary;
        }

        private void rcBox_DataBinding(object sender, EventArgs e)
        {
            var rcBox = (RadComboBox)sender;
            var value = rcBox.NamingContainer.GetFieldValue("DataItem." + _dataField);
            rcBox.SelectedValue = value != null ? value.ToString() : string.Empty;
        }
    }
}

Usage:

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="LinqDataSource1" AllowPaging="True" AutoGenerateColumns="False" Width="50%">
    <MasterTableView DataKeyNames="ENTUserAccountId" DataSourceID="LinqDataSource1" PageSize="5">
        <Columns>
            <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" UniqueName="UserName"/>
            <telerik:GridBoundColumn DataField="Email" HeaderText="Email" UniqueName="Email"/>
            <a:MyGridTemplateColumn />
        </Columns>
        <DetailTables>
            <telerik:GridTableView runat="server" DataSourceID="LinqDataSource2" DataKeyNames="ENTUserAccountId">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="ENTUserAccountId" MasterKeyField="ENTUserAccountId" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridTemplateColumn DataField="ENTRoleId" HeaderText="Rol" UniqueName="ENTRoleId">
                        <ItemTemplate>
                            <asp:Label ID="ENTRoleIdLabel" runat="server" Text='<%# Eval("ENTRole.RoleName") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>                 
            </telerik:GridTableView>
        </DetailTables>
    </MasterTableView>
</telerik:RadGrid>

<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="TelerikWebApp1.DataClasses1DataContext"
    EntityTypeName="" TableName="ENTUserAccount"/>
        
<asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="TelerikWebApp1.DataClasses1DataContext"
    EntityTypeName="" TableName="ENTRoleUserAccount" Where="ENTUserAccountId == @ENTUserAccountId">
        <WhereParameters>
            <asp:SessionParameter Name="ENTUserAccountId" Type="Int32" />
        </WhereParameters>
</asp:LinqDataSource>  

Delvis
Top achievements
Rank 1
 asked on 03 Mar 2015
5 answers
700 views
Hello,

I am getting issue to customize group header, I have some operation(sum,count,min,max, last, first, average) in footer.
But I want to do same operation in group header.  Example: I have last product in footer now I want to show total product count in header.
How can I do this? 

[I can have max 3 column for grouping]

Could you please help me anyone?
Please see attached image.
Youssef
Top achievements
Rank 1
 answered on 02 Mar 2015
3 answers
306 views
we need to change skin dynamically for all controls in web application. i have not found appropriate solution for web application. Kindly provide a solution which would be helpful for me.
Thanks,
Rajender..
David
Top achievements
Rank 1
 answered on 02 Mar 2015
4 answers
73 views
Hi, we are in the process of upgrading some grids from Infragistics Ultrawebgrid  to Telerik Controls.  We are under some time constraints due to enforced IE11 upgrade.  The grid I am working with is very simple.  It is straight data entry of requsition details.  It can be one or many lines.  Is the RadGrid appropriate for this?  I have tried using it and am struggling a bit.  I don't want to bind to a data source as there won't be any data on inital load of the screen.  When the user is done inputting all of the data, I then want to insert detail lines into database.  How do I create a simple input grid?

Thanks and sorry for such a rookie question!
C
Top achievements
Rank 1
 answered on 02 Mar 2015
2 answers
49 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.

Ivan Danchev
Telerik team
 answered on 02 Mar 2015
2 answers
298 views
We are removing all Infragistic controls from our website and converting them over to Telerik.

I am looking for any tools or information on how to convert UltraWebGrid over to Telerik RadGrid.

Thanks
C
Top achievements
Rank 1
 answered on 02 Mar 2015
5 answers
186 views
I have seen and tried this code that is floating around using this code bit:

<telerik:RadDatePicker ID="RadDatePicker1" runat="server">    
<Calendar runat="server" ShowDayCellToolTips="false">        
<ClientEvents OnLoad="calendarLoad" />    
</Calendar>
</telerik:RadDatePicker>

function calendarLoad(sender, args) {    
$(sender.get_element()).find("[title]").each(function (i, el)
 {        
el.title = "";    });

}

however when i use this code, it DOES remove the title text, but the tooltip still shows up blank. we have deployed the RadTooltipManager in our Master Page. is there some way to mute these blank tooltips from the calendar? is there no setting like ShowDayCellToolTips="false" for the day cells that apply to the navigation and Day of the Week titles?
this is very frustrating. any help would be GREATLY appreciated

thanks in Advance


Web Developer
Top achievements
Rank 1
 answered on 02 Mar 2015
0 answers
60 views
I need to consume a service to CRUD operation and bind the data to RadGrid. I need to understand which of the below two methods will give me good performance or both of them would yield same results.

1. Consume service using client side and bind to the RadGrid - something like demonstrated in this url - http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/insert-update-delete-client/defaultcs.aspx

2. Consume service using code behind (.Net Code) and ajaxfying the events using RadAjaxManager

For both of the above method, the effect would pretty much look the same but i guess there should be some performance difference?





A
Top achievements
Rank 1
 asked on 02 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?