title: set the value of inputbox inside a data grid through VB code
body: <p>I have a asp datagrid one of the column is having one input</p>
  
  <pre><code>     &lt;asp:DataGrid ID="dgItem" runat="server" Width="100%" CssClass="TableList" AutoGenerateColumns="False" PagerStyle-Visible="False"&gt;
        &lt;Columns&gt;
  
           &lt;asp:TemplateColumn HeaderText="Disc %"&gt;
          &lt;HeaderStyle HorizontalAlign="Right" CssClass="ListHeader"&gt;&lt;/HeaderStyle&gt;
          &lt;ItemStyle HorizontalAlign="Right" Width="6%" CssClass="TdList"&gt;&lt;/ItemStyle&gt;
           &lt;ItemTemplate&gt;
                  &lt;input class="Input" onkeypress="if((event.keyCode&lt;48 || event.keyCode&gt;57) &amp;amp;&amp;amp; event.keyCode != 46 &amp;amp;&amp;amp; event.keyCode != 45) event.returnValue=false;"
  id="txtDiscRate" style="width: 100%; text-align: right" value="0.00" name="txtDiscRate"
  runat="server" onchange="checkrate();"&gt;
           &lt;/ItemTemplate&gt;
           &lt;/asp:TemplateColumn&gt;
       &lt;/Columns&gt;
      &lt;PagerStyle Visible="False"&gt;&lt;/PagerStyle&gt;
   &lt;/asp:DataGrid&gt;
  </code></pre>
  
  <p>how to set the value of that column through VB.net code
  This column is the 10th cell. In the 1st cell there is a value which should be set to the 10th column</p>
  
  <p>So, I've tried the following..but not working.</p>
  
  <pre><code> Dim lnDiscRate As Double
   Double.TryParse(lodgGrid.Cells(1).Text, lnDiscRate)
   Dim loDiscRate As HtmlInputText
   For Each lodgGrid In dgItem.Items
     loDiscRate = lodgGrid.Cells(10).FindControl("txtDiscRate")
     loDiscRate.Value = lnDiscRate 'Not working :(
     loDiscRate.Enabled = True 'this is Working.. 
   Next
  </code></pre>
  
  <p>Pls Help!!</p>
  
  <p>Got something else. when i do this</p>
  
  <pre><code>CType(lodgGrid.FindControl("txtDiscRate"), HtmlInputText).Value = 10 ' Working
  CType(lodgGrid.FindControl("txtDiscRate"), HtmlInputText).Value = lnDiscRate ' Not Working
  </code></pre>