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

Assign ID property of RadToolBarButton programmatically in code behind

1 Answer 111 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 25 Apr 2013, 05:32 PM
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();
            }
        }
}

1 Answer, 1 is accepted

Sort by
0
Syed
Top achievements
Rank 1
answered on 07 May 2013, 08:35 PM
Can somebody please answer the question? Its been a long while since it has been posted.

Thanks,
Syed.
Tags
ToolBar
Asked by
Syed
Top achievements
Rank 1
Answers by
Syed
Top achievements
Rank 1
Share this question
or