Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > GetCellValue for Visual Baisc?

Reply
Thread Tools

GetCellValue for Visual Baisc?

 
 
jonefer
Guest
Posts: n/a
 
      05-25-2007
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;
}
}

}
 
Reply With Quote
 
 
 
 
Manish Bafna
Guest
Posts: n/a
 
      05-25-2007
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.



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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OT]Visual Studio / Visual Source Safe 6.0 Rob Meade ASP .Net 2 05-22-2004 10:22 AM
visual studio .net 2003 verses visual studio .net 2002 wh ASP .Net 2 01-16-2004 04:54 PM
eMbedded Visual Basic & Visual Studio .NET - No Longer Supported? ¢harlie MCSD 0 12-26-2003 07:23 PM
Trivial question - Visual C# .Net vs Visual Studio .Net John Timbers ASP .Net 32 11-08-2003 06:12 AM
Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET Jaime MCSD 2 09-20-2003 05:16 AM



Advertisments