function handleCmd(arg) {
__doPostBack("HandleCmd", arg);
}
-------------------------------------
public void InitToolbar(Toolbar pToolStrip)
{
List<CMenu> cmdList = CMenu.FetchCmdItems(Ps.ModuleId);
int j = 1;
foreach (CMenu cmd in cmdList)
{
if (cmd.Hidden) continue;
long commId = (long)System.Math.Pow(2, j++);// Convert.ToUInt64(commands[j]["CommandId"]);
if ((Ps.RoleRight & commId) <= 0) continue;
string param = Convert.ToString(cmd.Param);
ExtAspNet.Button item = new ExtAspNet.Button();
item.EnablePostBack = false;
item.Text = cmd.Caption;
if (!string.IsNullOrEmpty(cmd.Image))
{
int icon = 0;
if (int.TryParse(cmd.Image, out icon))
{
item.Icon = (Icon)icon;
}
else
{
item.IconUrl = string.Format("res/menu/{0}.png", cmd.Image);
}
}
item.ID = string.Format("cmd{0}", cmd.Name);
if (string.IsNullOrEmpty(cmd.Param))
{
if (cmd.Name.ToLower().StartsWith("del"))
{
item.OnClientClick = "confirmCmd('" + cmd.Name + "','" + cmd.Caption + "');";
}
else
{
item.OnClientClick = "handleCmd('" + cmd.Name + "');";
}
}
else
{
item.OnClientClick = cmd.Param;
}
pToolStrip.Items.Add(item);
}
pToolStrip.Items.Add(new ExtAspNet.ToolbarSeparator());
pToolStrip.Items.Add(new ExtAspNet.ToolbarFill());
ToolbarText txtMsg = new ToolbarText();
txtMsg.ID = "txtMsg";
pToolStrip.Items.Add(txtMsg);
} |