本文整理汇总了C#中System.Web.UI.WebControls.DataGridItemEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataGridItemEventArgs类的具体用法?C# DataGridItemEventArgs怎么用?C# DataGridItemEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridItemEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了DataGridItemEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: grdSizes_ItemDataBound
protected void grdSizes_ItemDataBound(object sender, DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType != ListItemType.Footer) && (itemType != ListItemType.Separator))
{
if (itemType == ListItemType.Header)
{
object checkBox = e.Item.FindControl("chkSelectAll");
if ((checkBox != null))
{
((CheckBox)checkBox).Attributes.Add("onClick", "Javascript:chkSelectAll_OnClick(this)");
}
}
else
{
string tableRowId = grdSizes.ClientID + "_row" + e.Item.ItemIndex.ToString();
e.Item.Attributes.Add("id", tableRowId);
object checkBox = e.Item.FindControl("chkSelect");
if ((checkBox != null))
{
e.Item.Attributes.Add("onMouseMove", "Javascript:chkSelect_OnMouseMove(this)");
e.Item.Attributes.Add("onMouseOut", "Javascript:chkSelect_OnMouseOut(this," + e.Item.ItemIndex.ToString() + ")");
((CheckBox)checkBox).Attributes.Add("onClick", "Javascript:chkSelect_OnClick(this," + e.Item.ItemIndex.ToString() + ")");
}
}
}
}
示例2: dgDataList_ItemDataBound
protected void dgDataList_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.CssClass = "show";
}
}
示例3: dgTests_ItemDataBound
private void dgTests_ItemDataBound(object sender, DataGridItemEventArgs e)
{
Label lblSub, lblEval, lblQueue;
System.Web.UI.WebControls.Image imgStatus;
if (null != (lblSub = (Label) e.Item.FindControl("lblSub"))) {
lblEval = (Label) e.Item.FindControl("lblEval");
lblQueue = (Label) e.Item.FindControl("lblQueue");
imgStatus = (System.Web.UI.WebControls.Image) e.Item.FindControl("imgStatus");
AutoJobTest test = (AutoJobTest) e.Item.DataItem;
lblEval.Text = test.AutoEval.Name;
Components.Submission sub =
new Submissions(Globals.CurrentIdentity).GetInfo(test.SubmissionID);
lblSub.Text = new FileSystem(Globals.CurrentIdentity).GetFile(sub.LocationID).Alias;
if (test.Status == AutoJobTest.DONE)
imgStatus.ImageUrl = "../../attributes/subgrade.gif";
else
imgStatus.ImageUrl = "../../attributes/sub.gif";
AutoJobs autojobda = new AutoJobs(Globals.CurrentIdentity);
lblQueue.Text = String.Format("{0} out of {1}",
autojobda.GetQueuePosition(test), autojobda.GetAllTests().Count);
}
}
示例4: GridItemList_ItemDataBound
protected void GridItemList_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if ((((e.Item.ItemType == ListItemType.Item) | (e.Item.ItemType == ListItemType.AlternatingItem)) | (e.Item.ItemType == ListItemType.SelectedItem)))
{
e.Item.Cells[4].Attributes.Add("onClick", "return confirm('Bạn có chắc chắn xóa?');");
}
}
示例5: DataGrid_ItemDataBound
private void DataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
#region 设置数据绑定的长度
switch (e.Item.ItemType)
{
case ListItemType.Item:
break;
case ListItemType.AlternatingItem:
break;
case ListItemType.Header:
e.Item.Cells[0].ColumnSpan = 1; //合并单元格
e.Item.Cells[1].Visible = false;
break;
case ListItemType.EditItem:
{
for (int i = 0; i < DataGrid1.Columns.Count; i++) //只调整被编辑的列
{
if (e.Item.ItemType == ListItemType.EditItem)
{
if (i >= 3)
{
System.Web.UI.WebControls.TextBox txt = (System.Web.UI.WebControls.TextBox)e.Item.Cells[i].Controls[0];
txt.Width = 60;
}
}
}
break;
}
default:
break;
}
#endregion
}
示例6: SlotsDataGrid_ItemDataBound
protected void SlotsDataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
switch (e.Item.ItemType)
{
case ListItemType.AlternatingItem:
case ListItemType.Item:
if (e.Item.Cells[6].Text.Equals("SubHeading"))
{
DateTime myDate = DateTime.Parse(e.Item.Cells[0].Text.ToString());
e.Item.Cells[1].Text = myDate.DayOfWeek.ToString() + " " + myDate.Day + " " + returnMonth(myDate.Month).ToString().ToLower();
//De breedte van de toegevoegde subheader
e.Item.Cells[1].ColumnSpan = e.Item.Cells.Count;
e.Item.Cells[1].CssClass = "DayRow";
//De overigge cellen verwijderen
for (int i = e.Item.Cells.Count - 1; i > 1; i--)
e.Item.Cells.RemoveAt(i);
}
break;
default:
break;
}
}
示例7: grid_ItemDataBound
protected void grid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
string Dormancy = (string)DataBinder.Eval(e.Item.DataItem, "Dormancy");
int ClassId = (int)DataBinder.Eval(e.Item.DataItem, "ClassId");
if (Dormancy.ToLower() == "true")
{
e.Item.Cells[4].Text = "<span style=\" color:Red\">����</span>";
}
else
{
e.Item.Cells[4].Text = "<span style=\" color:Green\">����</span>";
}
Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass();
Maticsoft.Model.NewsManage.NewsClass mod = bll.GetModelByCache(ClassId);
if (mod != null)
{
e.Item.Cells[5].Text = mod.ClassDesc;
}
else
{
e.Item.Cells[5].Text = "δ֪���";
}
}
}
示例8: dgNewContent_ItemDataBound
protected void dgNewContent_ItemDataBound(Object sender, DataGridItemEventArgs e)
{
switch(e.Item.ItemType)
{
case ListItemType.Header:
((Literal)e.Item.Cells[2].FindControl("litTitleHeader")).Text = "Title";
((Literal)e.Item.Cells[3].FindControl("litIdHeader")).Text = "ID";
((Literal)e.Item.Cells[4].FindControl("litLastEditorHeader")).Text = "Submitted By";
((Literal)e.Item.Cells[5].FindControl("litModifiedDateHeader")).Text = "Modified Date";
((Literal)e.Item.Cells[6].FindControl("litPathHeader")).Text = "Path";
break;
case ListItemType.Item:
case ListItemType.AlternatingItem:
((Image)e.Item.Cells[1].FindControl("imgContentIcon")).AlternateText = ((ContentData)e.Item.DataItem).Title;
((Image)e.Item.Cells[1].FindControl("imgContentIcon")).ImageUrl = GetImagePath(((ContentData)e.Item.DataItem));
((Image)e.Item.Cells[1].FindControl("imgContentIcon")).Attributes.Add("title", ((ContentData)e.Item.DataItem).Title);
((HyperLink)e.Item.Cells[2].FindControl("aTitle")).NavigateUrl = GetTitleHref(((ContentData)e.Item.DataItem));
((HyperLink)e.Item.Cells[2].FindControl("aTitle")).Text = ((ContentData)e.Item.DataItem).Title;
((HyperLink)e.Item.Cells[2].FindControl("aTitle")).Attributes.Add("title", ((ContentData)e.Item.DataItem).Title);
((Literal)e.Item.Cells[3].FindControl("litIdValue")).Text = ((ContentData)e.Item.DataItem).Id.ToString();
((HyperLink)e.Item.Cells[4].FindControl("aLastEditor")).NavigateUrl = GetLastEditorHref(((ContentData)e.Item.DataItem));
((HyperLink)e.Item.Cells[4].FindControl("aLastEditor")).Text = ((ContentData)e.Item.DataItem).EditorLastName + ", " + ((ContentData)e.Item.DataItem).EditorFirstName;
((HyperLink)e.Item.Cells[4].FindControl("aLastEditor")).Attributes.Add("title", ((ContentData)e.Item.DataItem).EditorLastName + ", " + ((ContentData)e.Item.DataItem).EditorFirstName);
((Literal)e.Item.Cells[3].FindControl("litModifiedDateValue")).Text = ((ContentData)e.Item.DataItem).DisplayLastEditDate;
((HyperLink)e.Item.Cells[2].FindControl("aPathValue")).NavigateUrl = GetPathHref(((ContentData)e.Item.DataItem));
((HyperLink)e.Item.Cells[2].FindControl("aPathValue")).Text = ((ContentData)e.Item.DataItem).Path;
((HyperLink)e.Item.Cells[2].FindControl("aPathValue")).Attributes.Add("title", ((ContentData)e.Item.DataItem).Path);
break;
}
}
示例9: dgTemplate_itemdatabound
protected void dgTemplate_itemdatabound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
((CheckBox)e.Item.FindControl("ckbAllowTemplate")).Checked = true;
}
}
示例10: DataGrid_ItemDataBound
private void DataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
#region 绑定附件类型显示方式
if (e.Item.ItemType == ListItemType.EditItem)
{
TextBox t = (TextBox)e.Item.Cells[3].Controls[0];
t.Attributes.Add("maxlength", "255");
t.Attributes.Add("size", "30");
t = (TextBox)e.Item.Cells[4].Controls[0];
t.Attributes.Add("maxlength", "9");
t.Attributes.Add("size", "10");
}
if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item))
{
if (e.Item.Cells[3].Text.ToString().Length > 40)
{
e.Item.Cells[3].Text = e.Item.Cells[3].Text.Substring(0, 40) + "…";
}
}
#endregion
}
示例11: dgJobs_ItemDataBound
private void dgJobs_ItemDataBound(object sender, DataGridItemEventArgs e)
{
Label lblProgress;
if (null != (lblProgress = (Label) e.Item.FindControl("lblProgress"))) {
lblProgress.Text = GetProgress((AutoJob)e.Item.DataItem);
}
}
示例12: BoxGuid_ItemCreated
protected void BoxGuid_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem)
{
e.Item.Cells[0].Text = "<p align=center>" + Convert.ToString(e.Item.ItemIndex + 1) + "</p>";
}
}
示例13: grdMain_ItemCreated
protected void grdMain_ItemCreated(object sender, DataGridItemEventArgs e)
{
if ( e.Item.ItemType == ListItemType.Header || e.Item.ItemType == ListItemType.Footer )
{
e.Item.CssClass += " nodrag nodrop";
}
}
示例14: dgUserCourses_ItemDataBound
private void dgUserCourses_ItemDataBound(object sender, DataGridItemEventArgs e)
{
HyperLink hypAdmin, hypStudent, hypStudentAdmin;
if (null != (hypAdmin = (HyperLink) e.Item.FindControl("hypAdmin"))) {
Course course = (Course) e.Item.DataItem;
CourseRole role = new Courses(Globals.CurrentIdentity).GetRole(
Globals.CurrentUserName, course.ID, null);
hypStudent = (HyperLink) e.Item.FindControl("hypStudent");
hypStudentAdmin = (HyperLink) e.Item.FindControl("hypStudentAdmin");
hypStudent.Enabled = course.Available;
hypStudentAdmin.Enabled = course.Available;
if (!hypStudent.Enabled)
hypStudent.Text += " (Unavailable)";
if (role.Staff) {
hypAdmin.NavigateUrl = "../courseadmin.aspx?CourseID="+course.ID;
hypAdmin.Visible = true;
hypStudentAdmin.NavigateUrl = "../course.aspx?CourseID="+course.ID;
hypStudentAdmin.Visible = true;
} else {
hypAdmin.NavigateUrl = "../course.aspx?CourseID="+course.ID;
hypAdmin.Visible = false;
hypStudentAdmin.Visible = false;
}
}
}
示例15: dtgCategory_ItemDataBound
protected void dtgCategory_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
DropDownList ddl = e.Item.FindControl("ddlCat") as DropDownList;
LoadDdl(ddl);
int parentid = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ParentId"));
if (parentid != 0)
ddl.SelectedValue = parentid.ToString();
CheckBox c = e.Item.FindControl("chkSubCat") as CheckBox;
bool isSub = (bool)DataBinder.Eval(e.Item.DataItem, "IsSubCat");
c.Checked = isSub;
if (isSub)
ddl.Visible = true;
else
ddl.Visible = false;
ImageButton imbDelete = e.Item.FindControl("btnDelete") as ImageButton;
imbDelete.OnClientClick = "javascript : return confirm('Bạn có chắc muốn xóa không?')";
}
else if (e.Item.ItemType == ListItemType.Footer)
{
DropDownList ddl = e.Item.FindControl("ddlCat") as DropDownList;
LoadDdl(ddl);
ddl.Visible = false;
}
}