Blog Stats
  • Posts - 4
  • Articles - 0
  • Comments - 6
  • Trackbacks - 4

 

Tuesday, June 06, 2006

Nevron Charting - A generic error occurred in GDI

Okay, I am not one to complain much.  I am doing web application programming using Asp.net and VB.net.  For the most part I am using the Telerik controls.  But, I need a good 3D chart which Telerik does not have.  At least not yet.

 

I found what looks like it will be a good control from a company called Nevron.  But, Nevron has failed to make what is very critical, a well known fact.  i.e.  Did you know that if a specific folder (that you must create) is missing, you will get an "A generic error occurred in GDI+" error?  Well, neither did I.

 

I searched their site for help on this and found zero, nada, nil, nothing...  I spent hours going through their forums having the same luck.  I finally posted a question and found out what folder I did not have but needed.  So, what folder is needed? NevronTemp

 

Once I created that folder, the sample application worked just fine.  So, if you come across this error try adding this folder to the root of your project.

 

TTFN,

 

Mark

Monday, February 20, 2006

Adding totals to telerik grid

First, you'll need to define a global variable to hold the value to be displayed in the footer.

Public ClmTotChg As Integer = 0
Public ClmTotBal As Integer = 0

Then, you'll need to populate the variable.  This is where it gets tricky.  In order for this to work, you must set the “DataMember“ property of the MasterTableView or DetailTableView for the footer you want a total in.  You'll also need to set the ShowFooter value to true.  For instance...

<MasterTableView DataMember="CLAIM" DataKeyNames="CLMNO" ShowFooter="True">

Next, you will need to populate the variable when a detail item is added to the grid.  You will do this in the “ItemDataBound“ event on the grid.

'The following is used to update the total fields for the footer on the Claim Header grid
If
TypeOf e.Item Is GridDataItem And e.Item.OwnerTableView.DataMember = "CLAIM" Then
   Dim gridItem As GridDataItem = CType
(e.Item, GridDataItem)
   Select Case
gridItem.ItemType
      Case
GridItemType.AlternatingItem, GridItemType.Item
         ClmTotChg += gridItem("CLMAMT"
).Text
         ClmTotBal += gridItem("CLMBAL").Text
   End
Select
End If

Finally, you'll need to add the totals to the footer.

'The following is used to add a footer to the Claim Header grid that will show the totals
If TypeOf e.Item Is GridFooterItem And e.Item.OwnerTableView.DataMember = "CLAIM"
Then
   Dim footerItem As GridFooterItem = CType
(e.Item, GridFooterItem)
   footerItem("CLMAMT").Text = Format$(ClmTotChg, "$#,###,##0.00"
)
   footerItem("CLMBAL").Text = Format$(ClmTotBal, "$#,###,##0.00"
)
End If

That's all there is to it.

 

Tuesday, October 18, 2005

GridView Uppercase Formatting

We’ll it’s been awhile, but I’m back to the ‘art’ of programming in VB.Net / ASP.Net.

Today I was trying to figure out how to set data in a GridView to uppercase.  Well, not finding any help out there, I decided to forge my own path.  Below is what I’ve discovered.

The first step is to create a function that converts the cells contents into uppercase...
I want to convert the data in the 9th cell (column) – remember the grid cells are zero based, so visually this is the 10th cell (column) – to uppercase

    Protected Sub MyGrid_DataBound(ByVal sender As Object, _
ByVal e As GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.DataRow Then

            ' Display the cell contents in uppercase
            e.Row.Cells(9).Text = e.Row.Cells(9).Text.ToUpper
        End If
    End Sub


Then add an attribute to the grid’s ASP.Net configuration that calls that function when Row Data is bound to the grid.

Now, whenever a row is bound to the grid using MyGrid.DataBind(), the contents of the 9th column (cell) will be converted to uppercase.

How’s that for simplicity?

Empty Dataset

I was toying around today with controls from Dart Communciations. Their controls have built in callback technology. That means you don’t have to write one line of code on the client-side for ASP.Net. Anyway…

I have these panels that are hidden on my page. When you select a menu button, the panel that corresponds to the button selected is displayed and the data is updated. The problem I was having was – some of the panels have grids on them. At the time the page is rendered there is no data for the grids. So, when the page was “refreshed” the grids didn’t show the new data.

This happens because a callback will only update items that have been rendered previously. Since the grids didn’t have data in them, they were never rendered. So, I put this little chunk of code in the page_load event and it solved the issue. Essentially I’m creating a pseudo-empty dataset. I hope others will find use for this, too.

SQL = "Declare @str as varchar(1) "
SQL &= "Select @str = '' Select @str"
DataSet = GetDataSet(SQL, cs, "Empty")
grdToShow.DataSource = DataSet
grdToShow.DataBind()

Here’s the GetDataSet function just incase you want to use it, too.

Private Function GetDataSet(ByVal SelectString As String, ByVal ConnectionString As String, ByVal TableName As String) As DataSet
   Dim DataSet As DataSet
   DataSet = New DataSet
   da = New SqlDataAdapter(SelectString, ConnectionString)
   da.Fill(DataSet, TableName)
   Return DataSet
End Function


TTFN,

Mark
 

 

Copyright © Mark Pritchard