Hi,
What i am telling is very basic thing but somehow if you have missed then
try doing this:
You need to download full code by clicking on link at top "Download
Formatting Samples and Extender Source".In that you will find the code for
custom function GetCellValue.
Hope this helps
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
[quoted text, click to view] "jonefer" wrote:
> I found this excellent article of Formatting AutoGenerateColumns in ASP.NET
> Grid - The code project written in C#
>
> I converted it into Visual Basic for my project
> But it says that GetCellValue needs to be declared
>
> Here's the code with the GetCellValue method
> private void GV_RowDataBound(object o, GridViewRowEventArgs e)
> {
> // apply custom formatting to data cells
> if (e.Row.RowType == DataControlRowType.DataRow)
> {
> // set formatting for the category cell
> TableCell cell = e.Row.Cells[0];
> cell.Width = new Unit("120px");
> cell.Style["border-right"] = "2px solid #666666";
> cell.BackColor = System.Drawing.Color.LightGray;
>
> // set formatting for value cells
> for(int i=1; i<e.Row.Cells.Count; i++)
> {
> cell = e.Row.Cells[i];
>
> // right-align each of the column cells after the first
> // and set the width
> cell.HorizontalAlign = HorizontalAlign.Right;
> cell.Width = new Unit("90px");
>
> // alternate background colors
> if (i % 2 == 1)
> cell.BackColor
> = System.Drawing.ColorTranslator.FromHtml("#EFEFEF");
>
> // check value columns for a high enough value
> // (value >= 8000) and apply special highlighting
> if (GetCellValue(cell) >= 8000)
> {
> cell.Font.Bold = true;
> cell.BorderWidth = new Unit("1px");
> cell.BorderColor = System.Drawing.Color.Gray;
> cell.BorderStyle = BorderStyle.Dotted;
> cell.BackColor = System.Drawing.Color.Honeydew;
> }
>
> }
> }
>
> // apply custom formatting to the header cells
> if (e.Row.RowType == DataControlRowType.Header)
> {
> foreach (TableCell cell in e.Row.Cells)
> {
> cell.Style["border-bottom"] = "2px solid #666666";
> cell.BackColor=System.Drawing.Color.LightGray;
> }
> }
>