public void InstantiateIn(Control container) { bool addVisible = this.AddVisible; if (addVisible) { TimImageButton btnAdd = new TimImageButton(); btnAdd.ID = "XBtn_Add"; btnAdd.ToolTip = "新增"; btnAdd.Enabled = this.AllowAdd; btnAdd.ImageUrl = "~/Images/Tim/XGrid_Add.gif"; btnAdd.OnClientClick = this.OnAddClientClick; container.Controls.Add(btnAdd); } }
public void InstantiateIn(Control container) { TimImageButton btnEdit = null; TimImageButton btnDelete = null; bool editVisible = this.EditVisible; if (editVisible) { btnEdit = new TimImageButton(); btnEdit.ID = "XBtn_Edit"; btnEdit.ToolTip = "编辑"; btnEdit.Enabled = this.AllowEdit; btnEdit.ImageUrl = "~/Images/Tim/XGrid_Edit.gif"; btnEdit.OnClientClick = "checkedRow($(this).closest('tr')[0],event);" + this.OnEditClientClick + "return false;"; } bool deleteVisible = this.DeleteVisible; if (deleteVisible) { btnDelete = new TimImageButton(); btnDelete.ID = "XBtn_Delete"; btnDelete.ToolTip = "删除"; btnDelete.Enabled = this.AllowDelete; btnDelete.ImageUrl = "~/Images/Tim/XGrid_Delete.gif"; btnDelete.OnClientClick = "checkedRow($(this).closest('tr')[0],event);if (confirm('您确定要删除当前记录?') == false) return false;" + this.OnDeleteClientClick; } bool editVisible2 = this.EditVisible; if (editVisible2) { container.Controls.Add(btnEdit); } bool flag = this.EditVisible && this.DeleteVisible; if (flag) { container.Controls.Add(new Label { Text = " | " }); } bool deleteVisible2 = this.DeleteVisible; if (deleteVisible2) { container.Controls.Add(btnDelete); } }