(1)、引用using Microsoft.Web.UI.WebControls;
(2)、添加button或其他按钮
(3)、在Toolbar1_ButtonClick事件中写
ToolbarTextBox mytext=new ToolbarTextBox();
mytext=(ToolbarTextBox)Toolbar1.Items[1];
ToolbarButton mybutton=new ToolbarButton();
mybutton=(ToolbarButton)sender;
switch (mybutton.ID)
{
case "toolbutton1":
{
if (mytext.Text=="")
{
Response.Write("<script>window.alert('请输入查询条件!');</script>");
return;
}
break;
}
case "toolbutton3":
Response.Redirect("WebForm1.aspx");
break;
(4)、其他用法
ToolbarButton mybutton1=new ToolbarButton();
mybutton1=(ToolbarButton)Toolbar1.Items[0];
mybutton1.ImageUrl="image\\tianjia2.bmp";
mybutton2.ImageUrl="image\\shanchu2.bmp";
mybutton1.Enabled=false;
mybutton2.Enabled=false;