protected void Gridview1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lnkFile = (LinkButton)e.Row.FindControl("lnkFilePath"); if (lnkFile != null) ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(lnkFile); } } protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete"); if (btnDelete != null) btnDelete.Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to delete this record?');"); } } protected void Gridview1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = Gridview1.Rows[e.RowIndex]; TextBox txtDesc = (TextBox)row.Cells[0].FindControl("txtListValue"); } protected void Gridview1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Label lblListDesc = (Label)Gridview1.Rows[e.RowIndex].FindControl("lblListValue"); } protected void Gridview1_RowEditing(object sender, GridViewEditEventArgs e) { Label lblIsActive = (Label)(Gridview1.Rows[Gridview1.EditIndex].FindControl("lblStatus")); } protected void Gridview1_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow grow = (GridViewRow)((Control)e.CommandSource).NamingContainer; Label lblTemp = (Label)grow.FindControl("lblDatatype"); }
Monday, December 16, 2013
How to findcontrols on gridview RowCreated,RowDataBound,RowUpdating,RowDeleting,RowEditing and RowCommand?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment