This is a migrated thread and some comments may be shown as answers.

Base class for all RadControls ?

6 Answers 137 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
LamKhoa
Top achievements
Rank 1
LamKhoa asked on 11 Jul 2011, 03:30 PM
As you might have know, in Visual Studio ASP.NET built-in control, there is a WebControl which is a base class for all webcontrols in ASP.NET.  Is there any equivalent base class like that for Telerik RadControl?

Thanks

LamK.

6 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 12 Jul 2011, 12:15 PM
Hi Lamkhoa,

 Yes, there is such base class implemented for RadControls and it is called RadWebControl. The RadWebControl on the other hand inherits WebControl as well.

Best wishes,
Svetlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
LamKhoa
Top achievements
Rank 1
answered on 13 Jul 2011, 08:22 AM
I would want to make a method that take in two parameters, a CheckBox and any RadControls, in which, if the checkbox is checked, the RadControl will be disable, otherwise, it is enabled.

public void ToogleCheckBoxWithRadControl(CheckBox chkBox, RadWebControl radControl)
{
    if (chkBox.Checked == true)
    {
        radControl.Enabled = false;
    }
    else
    {
        radControl.Enabled = true;
    }
}

But it didn't work. Do you have any idea?

Thanks

LamK
0
Svetlina Anati
Telerik team
answered on 18 Jul 2011, 09:51 AM
Hello Lamkhoa,

Please, accept my sincere apologies for the provided wrong information - it turned out that not all of RadControls inherit the RadWebControl class, despite most of them does. The class which is base is the System.Web.UI.Control class but as you know it does not provide the Enabled property. However, I suggest to use the WebControl class and cast to it to set the property - if a RadControl can be casted to WebControl, you can set the property, otherwise - setting Enabled property to this particular control will not make sense.

For your convenience I prepared a simple demo page and attached it to the thread.

I am sorry for any inconvenience I might have caused with my previous post. 
 

Kind regards,
Svetlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
LamKhoa
Top achievements
Rank 1
answered on 18 Jul 2011, 05:11 PM
Would you please make it in code-behind? I didn't need it in Javascript.
0
Svetlina Anati
Telerik team
answered on 19 Jul 2011, 02:28 PM
Hello Lamkhoa,

 This is actually server code which is written like that for simplicity since it is a small piece of code and to save an additional file. You can verify this by examining the definition of the script block which is as follows:

<script type="text/C#" runat="server">

instead of

<script type="text/javascript">

so this i snot javascript but server C# code.

I noted this only for your information, in case you come along similar code on the net. You can find a demo with two separate files attached to the thread, let me know how it goes.

Regards,
Svetlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
LamKhoa
Top achievements
Rank 1
answered on 19 Jul 2011, 10:06 PM
Thanks, The demo that you attached in the last post, shown exactly what I need.

Appreciate it.

LamK
Tags
General Discussions
Asked by
LamKhoa
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
LamKhoa
Top achievements
Rank 1
Share this question
or