Assign ID property of RadToolBarButton programmatically in code behind

2 posts, 0 answers
  1. Syed
    Syed avatar
    4 posts
    Member since:
    Apr 2013

    Posted 25 Apr 2013 Link to this post

    Hi,

    I would like to dynamically assign the id property of a RadToolBarButton dynamically in my code behind sicnce is is supposedly a readonly property. Is there any workaround to get this done? I really need to assign a fixed id to one of the buttons since it is being reference in my JQuery code using its id.




    private void PopulateRadToolBar()
    {
                RadToolBarItemCollection rtb = RadToolBar.Items;
                if (!String.IsNullOrEmpty(WebPart.RadToolBarValues))
                {
                    var properties = WebPart.RadToolBarValues.Split(@";".ToCharArray());
                    rtb.Clear();
     
                    foreach (var singleProperty in properties)
                    {
                        var itemRow = singleProperty.Split(@",".ToCharArray());
                        button = new RadToolBarButton();
                        button.ID = itemRow[0];    // ERROR HERE SINCE ID IS A READ ONLY PROPERTY      
                        button.Text = itemRow[1];      
                        button.NavigateUrl = itemRow[2];
                        button.Target = itemRow[3];    
                        button.ImageUrl = itemRow[4];  
                       rtb.Add(button);
                }
                else
                {
                    rtb.Clear();
                }
            }
    }

  2. Syed
    Syed avatar
    4 posts
    Member since:
    Apr 2013

    Posted 07 May 2013 Link to this post

    Can somebody please answer the question? Its been a long while since it has been posted.

    Thanks,
    Syed.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top