GetCellValue for Visual Baisc?

J

jonefer

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;

// 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;
}
}

}
 
M

Manish Bafna

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top