protected void _grdMattersForClient_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { MatterSearchItem searchItem = (MatterSearchItem)e.Row.DataItem; //Truncate large descriptions if (searchItem.Description.Length > 20) { Label lbldescription = (Label)e.Row.FindControl("_lblDescription"); lbldescription.Text = searchItem.Description.Substring(0, 20) + "..."; } //Truncate large descriptions if (searchItem.KeyDescription.Length > 20) { Label lbldescription = (Label)e.Row.FindControl("_lblKeyDescription"); lbldescription.Text = searchItem.KeyDescription.Substring(0, 20) + "..."; } //Hide blank dates if (searchItem.OpenedDate == DataConstants.BlankDate) { Label lblOpenedDate = (Label)e.Row.FindControl("_lblOpened"); lblOpenedDate.Text = string.Empty; } //Hide blank dates if (searchItem.ClosedDate == DataConstants.BlankDate) { Label lblClosedDate = (Label)e.Row.FindControl("_lblClosed"); lblClosedDate.Text = string.Empty; } // Add '-' after the matter ref LinkButton matterLink = ((LinkButton)e.Row.FindControl("_lnkMatterReference")); if (matterLink.Text.Length > 6) { matterLink.Text = matterLink.Text.Insert(6, "-"); } if (!_displayMatterLinkable) { Label _lblMatterReference = (Label)e.Row.FindControl("_lblMatterReference"); matterLink.Visible = false; _lblMatterReference.Visible = true; // Add '-' after the matter ref if (_lblMatterReference.Text.Length > 6) { _lblMatterReference.Text = _lblMatterReference.Text.Insert(6, "-"); } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _grdSearchMatterList_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { foreach (TableCell tc in e.Row.Cells) { if (tc.HasControls()) { // search for the header link LinkButton lnk = (LinkButton)tc.Controls[0]; if (lnk != null) { // inizialize a new image System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image(); // setting the dynamically URL of the image img.ImageUrl = "~/Images/PNGs/sort_az_" + (_grdSearchMatterList.SortDirection == SortDirection.Ascending ? "descending" : "ascending") + ".png"; // checking if the header link is the user's choice if (_grdSearchMatterList.SortExpression == lnk.CommandArgument) { // adding a space and the image to the header link tc.Controls.Add(new LiteralControl(" ")); tc.Controls.Add(img); } } } } } if (e.Row.RowType == DataControlRowType.DataRow) { MatterSearchItem searchItem = (MatterSearchItem)e.Row.DataItem; //Truncate large descriptions if (searchItem.Description.Length > 20) { Label lbldescription = (Label)e.Row.FindControl("_lblDescription"); lbldescription.Text = searchItem.Description.Substring(0, 20) + "..."; } //Truncate large descriptions if (searchItem.KeyDescription.Length > 20) { Label lbldescription = (Label)e.Row.FindControl("_lblKeyDescription"); lbldescription.Text = searchItem.KeyDescription.Substring(0, 20) + "..."; } //Hide blank dates if (searchItem.OpenedDate == DataConstants.BlankDate) { Label lblOpenedDate = (Label)e.Row.FindControl("_lblOpened"); lblOpenedDate.Text = string.Empty; } //Hide blank dates if (searchItem.ClosedDate == DataConstants.BlankDate) { Label lblClosedDate = (Label)e.Row.FindControl("_lblClosed"); lblClosedDate.Text = string.Empty; } //Add '-' after the client ref LinkButton matterLink = ((LinkButton)e.Row.FindControl("_lnkMatterReference")); if (matterLink.Text.Length > 6) { matterLink.Text = matterLink.Text.Insert(6, "-"); } } }