Skip to content

Cannot implicitly convert type

aravinth kandasamy

Asked Apr 7, 2015, 5:11 AM EDT2 answers
Share
LinkedInX
 This is my line.
TextBox txtSingleUnitPrice = ((TextBox)gvSender.Rows[e.RowIndex].FindControl("txtSingleUnitPrice"))?(TextBox)gvSender.Rows[e.RowIndex].FindControl("txtSingleUnitPrice"):0;


Error name is Cannot implicitly convert type 'System.Web.UI.WebControls.TextBox' to 'bool'..Please Help me.How to correct this error

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Vithal Wadje
    +1
    try like this

    TextBox txtSingleUnitPrice = ((TextBox)gvSender.Rows[e.RowIndex].FindControl("txtSingleUnitPrice"))?(TextBox)gvSender.Rows[e.RowIndex].FindControl("txtSingleUnitPrice"):0 as TextBox ;
    +1
  • +1
    When i use THis query ( TextBox txtSingleUnitPrice = ((TextBox)gvSender.Rows[e.RowIndex].FindControl("txtSingleUnitPrice")) ? (TextBox)gvSender.Rows[e.RowIndex].FindControl("txtSingleUnitPrice") : 0 as TextBox;) That time This error was produced please help me
    +1