Search
Tuesday, September 30, 2008 ..:: Home ::.. Register  Login
Site Navigation
  Home

 Welcome To RMC-Solutions Minimize

RMC-Solutions provides taylored hosting solutions. Our plans will meet your needs no matter how big or small. We also can install and support all the main Content Management System i.e. Drupal, DotNetNuke.

Training sessions can be organised. Topics include:

  • Updating your CMS
  • Basic Web Site Design

 We also offer "special" rates for churches and charities. Contact us for more details

info@rmc-solutions.co.uk


Syndicate   Print   
 BLOG Minimize

Jun 12

Written by: host
6/12/2008 6:40 PM

Most of the applications which I develop are report driven, time critical information systems. For this reason I have always found it useful to be able to format the output of a datagrid at runtime. In most cases, I will just change the background colour of a cell\row, in other cases I will change the text depending on the criteria.

Merging Two Fields
Firstly you will need this function in your code page.

ProtectedFunction createFullName(ByVal fName AsObject, ByVal sName AsObject) AsString

    
Return CType(fName, String) & " " & CType(sName, String)
End
Function

In Order to call this function you need to change the text properties of the label field.

<asp:Label runat="server" Text='<%# createFullName(DataBinder.Eval(Container, "DataItem.Forename"), DataBinder.Eval(Container, "DataItem.Surname")) %>'>

Changing Cell Properties
In this example I am changing the back color depending on whether a target has been met.

Protected Sub gV_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
   tempDays = DateDiff(DateInterval.Day, Now(), tempdate)
   If e.Row.RowType = DataControlRowType.DataRow Or e.Row.RowType = DataControlRowType.Header Then
       If e.Row.Cells(2).Text <> "" Then
         tempdate = DateTime.Parse(e.Row.Cells(2).Text)
         tempDays = DateDiff(DateInterval.Day, Now(), tempdate) 
          If tempDays < 0 Then
            e.Row.BackColor = Drawing.Color.Red
         End If
         If tempDays >= 0 And tempDays < 5 Then
            e.Row.BackColor = Drawing.Color.Orange 
         End If
         If tempDays > 4 Then
            e.Row.BackColor = Drawing.Color.LightGreen
         End If 
      End If
   End If
End Sub

Tags:

  
 BLOG Minimize

Archive
<September 2008>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
Monthly
June, 2008

 Print   
 BLOG Minimize


 Print   
 BLOG Minimize

You must be logged in and have permission to create or edit a blog.

 Print   
 BLOG Minimize


 Print   
Copyright 2007 RMC-Solutions   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2008 by DotNetNuke Corporation