protected virtual void WriteCellValue(HtmlTextWriter writer, VehicleInfo vehicle, string column, string link) { PropertyInfo propertyInfo = vehicle.GetType().GetProperty(column); object value = propertyInfo.GetValue(vehicle, null); string stringValue = value == null ? string.Empty : value.ToString(); //<a href="'.$link.'">'.(string)$value.'</a> writer.AddAttribute(HtmlTextWriterAttribute.Href, link); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write(stringValue); writer.RenderEndTag(); }
private void PrepareVihecleInfo(VehicleInfo vehicle, IEnumerable<string> actualColumns) { StringBuilder sb = new StringBuilder(); foreach (string column in actualColumns) { PropertyInfo propertyInfo = vehicle.GetType().GetProperty(column); object value = propertyInfo.GetValue(vehicle, null); if(value == null) continue; sb.AppendFormat("{0}: {1}; ", GetLocalizedString(string.Format("ColumnVehicle{0}", column)), value); } vehicle.PathData = sb.ToString().TrimEnd(' ', ';'); }
protected virtual void WriteCell(HtmlTextWriter writer, VehicleInfo vehicle, string column, string link) { //'<td>'.$this->DrawCellValue($row, $column, $link).'</td>'; writer.RenderBeginTag(HtmlTextWriterTag.Td); WriteCellValue(writer, vehicle, column, link); writer.RenderEndTag(); }
protected virtual void WriteRow(HtmlTextWriter writer, VehicleInfo vehicle, List<string> actualColumns) { PrepareVihecleInfo(vehicle, actualColumns); string link = FormatLink("vehicle", vehicle); //<tr onmouseout="this.className=\'\';" onmouseover="this.className=\'over\';" onclick="window.location=\''.$link.'\'"> writer.AddAttribute(HtmlTextWriterAttribute.Onclick, String.Format("window.location = '{0}'", link)); writer.AddAttribute("onmouseout", "this.className='';"); writer.AddAttribute("onmouseover", "this.className='over';"); writer.RenderBeginTag(HtmlTextWriterTag.Tr); foreach (string column in actualColumns) { WriteCell(writer, vehicle, column, link); } writer.RenderEndTag(); }