title: Change value of cells before it's rendered into datagrid
body: <p>I have a web app I'm trying to write that will get the percentages of supplies left in a printer. and display that in a friendly 1-100 percent number. to get that number i must multiply what is left by 100 then divide that by the total possible. </p>
  
  <p>I have not been able to take the data that is coming from a sql server table and modify it before it is rendered into the data gridview. Any help would be appreciated.</p>
  
  <p>I've already tried in the code behind to convert it to integer with no luck. Here is my code.</p>
  
  <p>ASPX</p>
  
  <pre><code>&lt;asp:GridView ID="GridView2" runat="server" AllowSorting="True" 
          AutoGenerateColumns="False" BackColor="#DEBA84" BorderColor="#DEBA84" 
          BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" OnRowDataBound = "changeToPercent" 
          DataSourceID="SqlDataSource1" EnableModelValidation="True"&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="p_ipaddress" HeaderText="p_ipaddress" 
                  SortExpression="p_ipaddress" /&gt;
              &lt;asp:BoundField DataField="s_prtmarkerssuppliesdescription" 
                  HeaderText="s_prtmarkerssuppliesdescription" 
                  SortExpression="s_prtmarkerssuppliesdescription" /&gt;
              &lt;asp:BoundField DataField="s_prtMarkersSuppliesLevel" 
                  HeaderText="s_prtMarkersSuppliesLevel" 
                  SortExpression="s_prtMarkersSuppliesLevel" /&gt;
          &lt;/Columns&gt;
          &lt;FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /&gt;
          &lt;HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /&gt;
          &lt;PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /&gt;
          &lt;RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /&gt;
          &lt;SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /&gt;
      &lt;/asp:GridView&gt;
      &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:XrxDBCWWConnectionString %&gt;" 
          SelectCommand="usp_SUPPLYPERCENTAGE" SelectCommandType="StoredProcedure"
          CancelSelectOnNullParameter="False"&gt;
          &lt;SelectParameters&gt;
              &lt;asp:ControlParameter ControlID="percentBox" DefaultValue="10" 
                  Name="PCT_REQUESTED" PropertyName="Text" Type="Int32" /&gt;
              &lt;asp:Parameter DefaultValue="" Name="PRINTER_ID" Type="String" /&gt;
          &lt;/SelectParameters&gt;
      &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>I have no CS Code to use because everything i have tried has failed miserably </p>