How to use findcontrol with togglebutton

I am trying to use a togglebutton inside a repeater, but when I try to iterate over the repeater rows and use findcontrol, it tells me that it cannot convert type System.Web.UI.Control to Syncfusion.Javascript.ToggleButton.

Code is similar to this:

foreach (RepeaterItem ri in rptGivens.Items)
                {
                    Syncfusion.JavaScript.ToggleButton tbx = (Syncfusion.JavaScript.ToggleButton)ri.FindControl("ToggleButton1");
                }

How can I get access to the togglebutton while iterating of the control rows in the repeater?



1 Reply 1 reply marked as answer

MK Muthukrishnan Kandasamy Syncfusion Team June 5, 2020 12:29 PM UTC

Hi Ben, 
 
Thanks for contacting Syncfusion support. 
 
We have validated your reported problem with Syncfusion ToggleButton control. We were able to reproduce your reported problem. We have found that in your shared code snippet, you have accessed ToggleButton directly from Syncfusion.JavaScript. To resolve your reported problem, we need to use Syncfusion.JavaScript.Web for accessing the Syncfusion controls. Please refer the below code block. 
 
   protected void SeverClick(object sender, Syncfusion.JavaScript.Web.ButtonEventArgs e) 
        { 
            Syncfusion.JavaScript.Web.ToggleButton toggle = (Syncfusion.JavaScript.Web.ToggleButton)Master.FindControl("ToggleButton1"); 
        } 
 
 
 
Description 
Link 
Getting started 
Appearance 
Server-side events 
Live demo 
 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Muthukrishnan K 


Marked as answer
Loader.
Up arrow icon