RadButton ToggleType Checkbox

7 posts, 1 answers
  1. Eric
    Eric avatar
    7 posts
    Member since:
    Nov 2012

    Posted 30 Sep 2015 Link to this post

    how I assign a RadButtonToggleState checked or unchecked with javascript
  2. Answer
    Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 02 Oct 2015 Link to this post

    Hello Eric,

    You can utilize the client-side API of the button - $find("ButtonID").set_checked(true)

    Regards,
    Danail Vasilev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eric
    Eric avatar
    7 posts
    Member since:
    Nov 2012

    Posted 06 Oct 2015 in reply to Danail Vasilev Link to this post

    thanks
  5. Eric
    Eric avatar
    7 posts
    Member since:
    Nov 2012

    Posted 06 Oct 2015 Link to this post

    how to keep selected multiple rows and not lose the selection to apply filters or pass between pages

                                <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="-1" DataSourceID="SqlDataSource1" GridLines="Both" AllowMultiRowSelection="true" GroupPanelPosition="Top" AllowFilteringByColumn="True" AllowPaging="True" Font-Size="XX-Small" PageSize="5">
                                    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                                    <ClientSettings>
                                        <Selecting AllowRowSelect="True" />
                                        <Resizing AllowColumnResize="True" AllowResizeToFit="True" />
                                    </ClientSettings>
                                    <AlternatingItemStyle Font-Size="Small" />
                                    <MasterTableView AutoGenerateColumns="False" DataKeyNames="IDENT_ASOC" DataSourceID="SqlDataSource1">
                                        <Columns>
                                            <telerik:GridClientSelectColumn UniqueName="Seleccionar">
                                            </telerik:GridClientSelectColumn>
                                            <telerik:GridBoundColumn DataField="IDENT_ASOC" HeaderText="ID CLIENTE" ReadOnly="True" SortExpression="IDENT_ASOC" UniqueName="IDENT_ASOC" AllowFiltering="False" AllowSorting="False">
                                                <HeaderStyle Width="100px" />
                                                <ItemStyle Width="100px"/>
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="NOM_ASOC" FilterControlAltText="Filter NOM_ASOC column" HeaderText="CLIENTE" SortExpression="NOM_ASOC" UniqueName="NOM_ASOC">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                    <ItemStyle Font-Size="Small" />
                                </telerik:RadGrid> 

     

  6. Eric
    Eric avatar
    7 posts
    Member since:
    Nov 2012

    Posted 06 Oct 2015 in reply to Danail Vasilev Link to this post

    how to keep selected multiple rows and not lose the selection to apply filters or pass between pages
                                <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="-1" DataSourceID="SqlDataSource1" GridLines="Both" AllowMultiRowSelection="true" GroupPanelPosition="Top" AllowFilteringByColumn="True" AllowPaging="True" Font-Size="XX-Small" PageSize="5">
                                    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                                    <ClientSettings>
                                        <Selecting AllowRowSelect="True" />
                                        <Resizing AllowColumnResize="True" AllowResizeToFit="True" />
                                    </ClientSettings>
                                    <AlternatingItemStyle Font-Size="Small" />
                                    <MasterTableView AutoGenerateColumns="False" DataKeyNames="IDENT_ASOC" DataSourceID="SqlDataSource1">
                                        <Columns>
                                            <telerik:GridClientSelectColumn UniqueName="Seleccionar">
                                            </telerik:GridClientSelectColumn>
                                            <telerik:GridBoundColumn DataField="IDENT_ASOC" HeaderText="ID CLIENTE" ReadOnly="True" SortExpression="IDENT_ASOC" UniqueName="IDENT_ASOC" AllowFiltering="False" AllowSorting="False">
                                                <HeaderStyle Width="100px" />
                                                <ItemStyle Width="100px"/>
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="NOM_ASOC" FilterControlAltText="Filter NOM_ASOC column" HeaderText="CLIENTE" SortExpression="NOM_ASOC" UniqueName="NOM_ASOC">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                    <ItemStyle Font-Size="Small" />
                                </telerik:RadGrid> 
  7. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 07 Oct 2015 Link to this post

    Hi Eric,

    This can be done with some custom client-side logic. For example:

    ASPX:
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <script>
            function OnCommand(sender, args) {
                if (args.get_commandName() == "Page") {
                    var selectedItems = sender.get_masterTableView().get_selectedItems();
                    var selectedIndexes = "";
                    for (var i = 0; i < selectedItems.length; i++) {
                        var delimiter = "|";
                        if (i + 1 == selectedItems.length) {
                            delimiter = "";
                        }
                        selectedIndexes += selectedItems[i]._itemIndex + delimiter;
                    }
                    $get("<%=hf1.ClientID%>").value = selectedIndexes;
                }
            }
     
            function OnMasterTableViewCreated(sender, args) {
                if ($get("<%=hf1.ClientID%>").value != "") {
                    var selectedIndexes = $get("<%=hf1.ClientID%>").value.split('|');
                    for (var i = 0; i < selectedIndexes.length; i++) {
     
                        sender.get_masterTableView().get_dataItems()[selectedIndexes[i]].set_selected();
                    }
                }
            }
        </script>
        <telerik:RadButton ID="RadButton1" runat="server" />
        <asp:HiddenField ID="hf1" runat="server" />
        <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="-1" OnNeedDataSource="RadGrid1_NeedDataSource" GridLines="Both" AllowMultiRowSelection="true" GroupPanelPosition="Top" AllowFilteringByColumn="True" AllowPaging="True" Font-Size="XX-Small" PageSize="5">
            <ClientSettings>
                <ClientEvents OnCommand="OnCommand" OnMasterTableViewCreated="OnMasterTableViewCreated" />
            </ClientSettings>
            <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
                <Resizing AllowColumnResize="True" AllowResizeToFit="True" />
            </ClientSettings>
            <AlternatingItemStyle Font-Size="Small" />
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="IDENT_ASOC">
                <Columns>
                    <telerik:GridClientSelectColumn UniqueName="Seleccionar">
                    </telerik:GridClientSelectColumn>
                    <telerik:GridBoundColumn DataField="IDENT_ASOC" HeaderText="ID CLIENTE" ReadOnly="True" SortExpression="IDENT_ASOC" UniqueName="IDENT_ASOC" AllowFiltering="False" AllowSorting="False">
                        <HeaderStyle Width="100px" />
                        <ItemStyle Width="100px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="NOM_ASOC" FilterControlAltText="Filter NOM_ASOC column" HeaderText="CLIENTE" SortExpression="NOM_ASOC" UniqueName="NOM_ASOC">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ItemStyle Font-Size="Small" />
        </telerik:RadGrid>
    </form>

    C#:
    protected DataTable GetData()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("IDENT_ASOC", typeof(Int32));
        dt.Columns.Add("NOM_ASOC", typeof(Int32));
        dt.Columns.Add("Month", typeof(DateTime));
     
        dt.Rows.Add(22, 1, new DateTime(DateTime.Now.Year, 1, 1));
        dt.Rows.Add(0, 3, new DateTime(DateTime.Now.Year, 2, 1));
        dt.Rows.Add(2, 4, new DateTime(DateTime.Now.Year, 3, 1));
        dt.Rows.Add(5, 0, new DateTime(DateTime.Now.Year, 4, 1));
        dt.Rows.Add(10, 0, new DateTime(DateTime.Now.Year, 5, 1));
        dt.Rows.Add(3, 6, new DateTime(DateTime.Now.Year, 5, 1));
        dt.Rows.Add(4, 9, new DateTime(DateTime.Now.Year, 5, 1));
        dt.Rows.Add(11, 15, new DateTime(DateTime.Now.Year, 5, 1));
        dt.Rows.Add(12, 21, new DateTime(DateTime.Now.Year, 5, 1));
     
        return dt;
    }
    protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        (sender as RadGrid).DataSource = GetData();
    }

    In future when you have questions about different products I would like to ask you to open separate forum threads/ support tickets and choose the corresponding product type. Thus we can keep the threads clean and tidy.

    Regards,
    Danail Vasilev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Eric
    Eric avatar
    7 posts
    Member since:
    Nov 2012

    Posted 07 Oct 2015 in reply to Danail Vasilev Link to this post

    Thank's for your help Danail.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017