I know I have done this before, but I can't seem to get this figured out. I have a RadGrid and based on which row I want to format the text to {0:C}. The APX:
So I just selected the row based on the text in the first column, the for each cell in the row I applied my format.
Can someone help me do the same thing using the Rad Ajax 3.5 Radgrid. Thank you.
| <telerik:RadGrid ID="GridView2" runat="server" HorizontalAlign="Left" Skin="Web20" OnItemDataBound="RadGrid1_ItemDataBound" > |
| <MasterTableView> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| </telerik:RadGrid> |
for an asp.net gridview I did this using rowdatabound:
| Sub gvCurrentYearBudgetnew_rowdatabound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles gvCurrentYearBudgetNew.RowDataBound |
| Dim i As Integer |
| Dim str1 As String = "nothing yet" |
| If e.Row.RowType = DataControlRowType.DataRow Then |
| e.Row.Cells(1).Font.Bold = True |
| e.Row.Cells(5).Font.Bold = True |
| e.Row.Cells(6).Font.Bold = True |
| e.Row.Cells(1).BackColor = Drawing.Color.Bisque |
| e.Row.Cells(5).BackColor = Drawing.Color.Bisque |
| e.Row.Cells(6).BackColor = Drawing.Color.Bisque |
| Select Case RTrim(e.Row.Cells(0).Text) |
| Case "Sales" |
| For i = 1 To e.Row.Cells.Count - 1 |
| If Not String.IsNullOrEmpty(e.Row.Cells(i).Text) Then |
| Try |
| e.Row.Cells(i).Text = String.Format("{0:c}", Double.Parse(e.Row.Cells(i).Text)) |
| Catch |
| End Try |
| End If |
| Next |
| Case "Gross Profit" |
| For i = 1 To e.Row.Cells.Count - 1 |
| If Not String.IsNullOrEmpty(e.Row.Cells(i).Text) Then |
| Try |
| e.Row.Cells(i).Text = String.Format("{0:c}", Double.Parse(e.Row.Cells(i).Text)) |
| Catch |
| End Try |
| End If |
| Next |
| Case "Price" |
| For i = 1 To e.Row.Cells.Count - 1 |
| If Not String.IsNullOrEmpty(e.Row.Cells(i).Text) Then |
| Try |
| e.Row.Cells(i).Text = String.Format("{0:c}", Double.Parse(e.Row.Cells(i).Text)) |
| Catch |
| End Try |
| End If |
| Next |
| Case "Actual GP" |
| For i = 1 To e.Row.Cells.Count - 1 |
| If Not String.IsNullOrEmpty(e.Row.Cells(i).Text) Then |
| Try |
| e.Row.Cells(i).Text = String.Format("{0:c}", Double.Parse(e.Row.Cells(i).Text)) |
| e.Row.Cells(i).ForeColor = Drawing.Color.ForestGreen |
| Catch |
| End Try |
| End If |
| Next |
| Case "Actual Sales" |
| For i = 1 To e.Row.Cells.Count - 1 |
| If Not String.IsNullOrEmpty(e.Row.Cells(i).Text) Then |
| Try |
| e.Row.Cells(i).Text = String.Format("{0:c}", Double.Parse(e.Row.Cells(i).Text)) |
| e.Row.Cells(i).ForeColor = Drawing.Color.ForestGreen |
| Catch |
| End Try |
| End If |
| Next |
| End Select |
| End If |
| End Sub |
Can someone help me do the same thing using the Rad Ajax 3.5 Radgrid. Thank you.