Skip to content

Replies

0
Birendra Aujla
Birendra Aujla answered on Nov 30, 2016 12:03 PM

Since the above suggestion didn't work, so I had done it like below.

In .ascx, defined the field inside webdatagrid as under:

 <ig:UnboundField Header-Text="Cash Received" Key="Cash Received"></ig:UnboundField>

Inside InitializeRow event defined it like below:

protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)

{

     if(e.Row.DataItem !=null)

     {

        Client cln=e.Row.DataItem as Client;

        if(cln.CashRec < 0)

       {

          String strCR = cln.CashRec.ToString("f2");  //Two places of decimal

         e.Row.Items[4].Value= string.Format("-${0}", strCR.Substring(1, strCR.Length -1));    //Added minus sign & Dollar symbol

       }

      else

           e.Row.Items[4].Value= string.Format("${0}",cln.CashRec);   //Added Dollar symbol

     }

}

0
Birendra Aujla
Birendra Aujla answered on Nov 7, 2016 6:14 AM

Admin, please don't 'Mark as answer' since my issue is not resolved by the suggestion mentioned.

0
Birendra Aujla
Birendra Aujla answered on Nov 2, 2016 5:41 AM

Thanks Radoslav for replying. I had applied the same on Master page but it didnot worked for grid present in  ContentPage.