开发者

change property of rad controls in form

How can I access a property of rad controls in my form. something like code bellow

foreach (Control ctrl in this.Controls)
 开发者_Python百科 {
   RadControl rc = ctrl as RadControl;
    if (rc != null)
       {
           if (rc.GetType() == typeof(Telerik.WinControls.UI.RadButton))
            {
              rc.Image = ....
            }
     }
 }

thanks


In your conditional statement you want to test if (ctrl is RadControl)

And you want to make this into a recursive function that will go down through all Control collections in the page.

private void DoSomethingToRadControls(ControlCollection controls) {
  if (controls != null && controls.Any()) {
    foreach (Control ctrl in controls) {
      if (ctrl is RadControl) {
        // do something
      }
      DoSomethingToRadControls(ctrl.Controls);
    }
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜