Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
58 views

Hello, is there a way to limit how many checkbox buttons can be selected at one time by the client/enduser? We have a page that displays more than 10 buttons at a time (all brought in server side). The buttons are set up as Telerik RadButtons ButtonType="StandardButton" ToggleType="Checkbox". When the buttons are clicked they open up videos that get displayed at the top of the page and get put into a div. We have 5 spaces for the videos to display at the top of the page. I used CheckBox because of the selected/notselected (on/off) functionality. I want to limit the user to only selecting 5 buttons at a time. If the user has 5 buttons selected and tries to click the 6th one, a message should appear that tells them only 5 can be selected at a time. They can "turn off" unselect one of the buttons if they want to select another one. I'm having trouble figuring out how to approach this. Client side or code behind? Any help is appreciated, thanks!

  <ItemTemplate>
      <div class="itemWrapper">
        <telerik:RadButton 
        RenderMode="Lightweight" 
        runat="server" 
        OnCommand="videoClicked" 
        CommandArgument='<%# Eval("videoId") %>' 
        ButtonType="StandardButton" 
        ToggleType="CheckBox" 
        ID="RadToggleButton1" 
        AutoPostBack="true">
          <ToggleStates>
            <telerik:RadButtonToggleState SecondaryIconCssClass="rbOk" Text="Selected" Value="selectedButton"></telerik:RadButtonToggleState>
            <telerik:RadButtonToggleState Text="Not Selected" Value="notSelectedButton"></telerik:RadButtonToggleState>
          </ToggleStates>
        </telerik:RadButton>

Vessy
Telerik team
 answered on 08 Feb 2022
1 answer
155 views
Hello, I need some help with a Telerik RadButton that I have set up to work like a checkbox. It's loading the OnCommand click event each time that it's clicked. I need it to be more of a on/off switch. More details below.
ButtonType="StandardButton" 
    ToggleType="CheckBox"

Current state:

  • normal state (notSelectedButton): clickable and loads OnCommand event when clicked.
  • selected/checked state (selectedButton): clickable and loads OnCommand event when clicked.

What I need the button to do:

  • normal state (notSelectedButton): stay the same - be clickable and load OnCommand="videoClicked" event.
  • selected/checked state (selectedButton): be clickable but disable OnCommand event. I want it to go back to normal state (like an on/off switch).

My example code below shows what I have so far. I don't know if this should be done client side or code behind? Any suggestions are welcomed.

aspx code:

<ItemTemplate>
  <div class="itemWrapper">
    <telerik:RadButton 
    RenderMode="Lightweight" 
    runat="server" 
    OnCommand="videoClicked" 
    CommandArgument='<%# Eval("videoId") %>' 
    ButtonType="StandardButton" 
    ToggleType="CheckBox" 
    ID="RadToggleButton1" 
    AutoPostBack="true">
      <ToggleStates>
        <telerik:RadButtonToggleState SecondaryIconCssClass="rbOk" Text="Selected" Value="selectedButton"></telerik:RadButtonToggleState>
        <telerik:RadButtonToggleState Text="Not Selected" Value="notSelectedButton"></telerik:RadButtonToggleState>
      </ToggleStates>
    </telerik:RadButton>
  </div>
</ItemTemplate>

Vessy
Telerik team
 answered on 08 Feb 2022
3 answers
259 views

Hi there,

I would like to see the focus on the rows or just in the Visibility cell when I'm navigating through the grid using the keyboard and if I press enter, make a click on the toggle button to change the visibility. 

Also, I´m adding in the clientSettings 

 

Doncho
Telerik team
 answered on 25 Jun 2021
1 answer
260 views

Hi there, 

 

I have a radtoggleButton in a grid with two states and I´m creating the new rows using a DataTable source of the Grid.

My question is how I can use the datable to set the second state of the toggle button.

This is how the grid looks like: 

And this is the column template for the grid. 

I´ve tried to set the value as newRow("Visibility") = "Hide"  or adding the button directly to this cell of the row. 

Let me know if you have some ideas, please.

Thanks, 

Alvaro.

 

 

Doncho
Telerik team
 answered on 18 Jun 2021
0 answers
52 views

I have a rad grid and on every row i have rad toggle button, now i want whenever user change state of toggle button then in javascript i have to get row index of rad grid.

I have written following

its giving me toggle button that state just changed but now i want row index of radgrid where this control resides

function toggleStateChangedDir(sender, args) {
 
 var getElement= $telerik.$(sender.get_element());
 
}

 

Yash
Top achievements
Rank 1
 asked on 20 Apr 2018
0 answers
30 views

I want to use Toggle radio button in rad grid and want to bind it with data coming from server.

Please share the demo of it.

Yash
Top achievements
Rank 1
 asked on 11 Jan 2018
1 answer
74 views

Has anyone else noticed that if you have RadButtons which use embedded icons, if you then add a RadToggleButton the positions of the embedded icons in the RadButtons change? They move leftward so that part of the icon overlaps the left edge of the RadButton. You have to move them in (left) by 2px to get them back where they should be!

Has anyone also noticed that, by default, the RadToggleButton exceeds the RadButton in height so aligning them adjacent to each other is a little difficult?

Danail Vasilev
Telerik team
 answered on 17 Feb 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?