RadToolBar for ASP.NET

Data Binding Send comments on this topic.
Defining the ToolBars Structure > Data Binding

Glossary Item Box

Telerik RadToolBar fully supports binding to (IEnumerable, IListSource). The input for the data binding method is very easily localizable.

Example:

Data binding

C# Copy Code
public class DefaultCS : System.Web.UI.Page
   {
       
protected RadToolBar toolbar1;
       
private void Page_Load(object sender, System.EventArgs e)
       {
           
//Declare the databinding mappings
           
toolbar1.ButtonCommandField = "CommandName";
           toolbar1.ButtonImageField =
"ButtonImage";
           toolbar1.ItemDataBound +=
new Telerik.WebControls.RadToolBar.OnItemDataBoundDelegate(toolbar1_ItemDataBound);

           DataTable dt =
new DataTable();
           dt.Columns.Add(
"CommandName");
           dt.Columns.Add(
"ToolTip");
           dt.Columns.Add(
"ButtonImage");

           DataRow dr = dt.NewRow();
           dr[
"CommandName"] = "new";
           dr[
"ToolTip"] = "New Document";
           dr[
"ButtonImage"] = "new.gif";
           dt.Rows.Add(dr);

           toolbar1.DataSource = dt;
           toolbar1.DataBind();
       }

       
//You can perform more advanced databinding here:
       
private void toolbar1_ItemDataBound(object sender, RadToolBarItemDataBoundEventArgs e)
       {
           e.Button.ToolTip = Convert.ToString(DataBinder.GetPropertyValue(e.DataItem,
"ToolTip"));
       }