Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>===========</p> <h1>Update</h1> <p>Try changing this line as follows if cashval is a string type, </p> <pre><code> cashval = DirectCast(fvEmp.FindControl("chck" &amp; CStr(x)),TextBox).Text; </code></pre> <p>Kenny thing I figured out is FindControl returns Control Type which need to be converted into TextBox type if it is a TextBox control and then you can use its Text property to get the string. I edited it above. Try it now.</p> <p>In C# it will be done like this. </p> <pre><code> string cashval = ((TextBox)(fvEmp.FindControl("whatever control name"))).Text; </code></pre> <p>==============</p> <h1> New UPDATE</h1> <pre><code>chckval = Gridview1.FindControl("chck" &amp; CStr(x)) </code></pre> <p>Kenny now this third line is causing the problem I believe. Try removing this second line from For loop. But when you remove this second line you also will need to assign some value to your chckval TextBox type variable as it can not be null when it is used in query. May be you can assign new empty TextBox </p> <p>Or </p> <p>You can also make checkval String like you made cashval variable string this will simplify it. </p> <p>But whatever value you assign to checkval assign it in this IF statement. </p> <pre><code> If chckval.Text &lt;&gt; "" And Not checkboxval.Checked Then cashval = DirectCast(Gridview1.FindControl("chck" &amp; CStr(x)), TextBox).Text &lt; SET SOME VALUE FOR chckval here ... which is default value which will be used in SQL server&gt; Else chckval = Gridview1.FindControl("chck" &amp; CStr(x)) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload