Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Handle the grid's RowDataBound event
- MyGridView.RowDataBound += new GridViewRowEventHandler(MyGridView_RowDataBound);
- // Set the value to x / 1000 in the RowDataBound event
- protected void MyGridView_RowDataBound( object sender, GridViewRowEventArgs e )
- {
- if( e.Row.RowType != DataControlRowType.DataRow )
- return;
- // Cast e.Row.DataItem to whatever type you're binding to
- BindingObject bindingObject = (BindingObject)e.Row.DataItem;
- // Set the text of the correct column. Replace 0 with the position of the correct column
- e.Row.Cells[0].Text = bindingObject.ProcessingTime / 1000M;
- }
- GridView.DataSource = ....
- BoundField total = new BoundField();
- total.DataField = "Total";
- total.HeaderText = "Total Amount";
- total.DataFormatString = "{0:C}";
- donations.Columns.Add(total);
- ......
- String.Format("{0:0.000}", test/1000);
- try
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- if (((DataRowView)(e.Row.DataItem))["Columnname"].ToString().Equals("Total", StringComparison.OrdinalIgnoreCase))
- {
- e.Row.Font.Bold = true;
- //-----or ant thing you want to do------
- }
- }
- }
- catch (Exception ex)
- {
- }
Add Comment
Please, Sign In to add comment