Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. BC30201: Expression expected. [modified]

BC30201: Expression expected. [modified]

Scheduled Pinned Locked Moved ASP.NET
helpcsharpcssdatabase
12 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A alaminfad

    Hello All I've a grid with multiple columns ,one of them is a boolean column,i want to represent it as a chackbox , when the checkbox checked or unckecked i want the database to change automatically , i get this error before the page even loaded ,here is the Source Error: ------------------------------------------------------------------- Line 38: Line 39: Line 42: ------------------------------------------------------------------------ Microsoft (R) Visual Basic Compiler version 8.0.50727.42 for Microsoft (R) .NET Framework version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. C:\CRFF\Default.aspx.vb(79) : warning BC42104: Variable 'wks' is used before it has been assigned a value. A null reference exception could result at runtime. If Not (wks Is Nothing) Then ~~~ C:\CRFF\Default2.aspx(49) : warning BC42020: Variable declaration without an 'As' clause; type of Object assumed. Dim s = r("employeeid").ToString ~ C:\CRFF\IT_Daily_Tasks.aspx(40) : error BC30201: Expression expected. target.SetDataBoundString(1, System.Convert.ToString(Container.Value == "True" ? "checked='checked'" : "", System.Globalization.CultureInfo.CurrentCulture)) ~ C:\CRFF\IT_Daily_Tasks.aspx(40) : error BC30035: Syntax error. target.SetDataBoundString(1, System.Convert.ToString(Container.Value == "True" ? "checked='checked'" : "", System.Globalization.CultureInfo.CurrentCulture)) ---------------------------------------------------------------------------- Help Please

    modified on Wednesday, December 2, 2009 12:10 AM

    A Offline
    A Offline
    Anurag Gandhi
    wrote on last edited by
    #3

    Try the following:

    <asp:CheckBox ID="chkBox" runat="server" önclick="updateSent(this.checked, <%# Container.PageRecordIndex %>)" Checked='<%# Container.Value == "True" ? "true" : "false" %>' />

    Hope that this will work.

    Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.

    A 1 Reply Last reply
    0
    • A Anurag Gandhi

      Try the following:

      <asp:CheckBox ID="chkBox" runat="server" önclick="updateSent(this.checked, <%# Container.PageRecordIndex %>)" Checked='<%# Container.Value == "True" ? "true" : "false" %>' />

      Hope that this will work.

      Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.

      A Offline
      A Offline
      alaminfad
      wrote on last edited by
      #4

      thnx for yr swift response, but it doesnt work

      1 Reply Last reply
      0
      • D Dinesh Mani

        I understand that your code behind is VB.NET [C:\CRFF\Default.aspx.vb]. As far as I know there is no ternary operator i.e. [expr?expr:expr], available in VB.

        A Offline
        A Offline
        alaminfad
        wrote on last edited by
        #5

        Actually i do have VB.net code behind ,but for the purpose of instant DB updating i've used JAVASCRIPT the sript is below, hope that would clarify function updateSent(bSent, iRowIndex) { var oRecord = new Object(); oRecord.OrderID = grid1.Rows[iRowIndex].Cells[0].Value; oRecord.ShipName = grid1.Rows[iRowIndex].Cells[1].Value; oRecord.ShipCity = grid1.Rows[iRowIndex].Cells[2].Value; oRecord.ShipPostalCode = grid1.Rows[iRowIndex].Cells[3].Value; oRecord.ShipCountry = grid1.Rows[iRowIndex].Cells[4].Value; oRecord.Sent = bSent; grid1.executeUpdate(oRecord); }

        D 1 Reply Last reply
        0
        • A alaminfad

          Actually i do have VB.net code behind ,but for the purpose of instant DB updating i've used JAVASCRIPT the sript is below, hope that would clarify function updateSent(bSent, iRowIndex) { var oRecord = new Object(); oRecord.OrderID = grid1.Rows[iRowIndex].Cells[0].Value; oRecord.ShipName = grid1.Rows[iRowIndex].Cells[1].Value; oRecord.ShipCity = grid1.Rows[iRowIndex].Cells[2].Value; oRecord.ShipPostalCode = grid1.Rows[iRowIndex].Cells[3].Value; oRecord.ShipCountry = grid1.Rows[iRowIndex].Cells[4].Value; oRecord.Sent = bSent; grid1.executeUpdate(oRecord); }

          D Offline
          D Offline
          Dinesh Mani
          wrote on last edited by
          #6

          Based on your question I understood that we are talking about a compilation error and my comment was about the checkbox definition statement

          />

          You are using a server evaluation to set the checked status using the ternary operator in the below line. <%# Container.Value == "True" ? "checked='checked'" : "" %> I guess this is where the error is, using ternary operator in a server evaluation where the code behind is VB.NET

          A 1 Reply Last reply
          0
          • A alaminfad

            Hello All I've a grid with multiple columns ,one of them is a boolean column,i want to represent it as a chackbox , when the checkbox checked or unckecked i want the database to change automatically , i get this error before the page even loaded ,here is the Source Error: ------------------------------------------------------------------- Line 38: Line 39: Line 42: ------------------------------------------------------------------------ Microsoft (R) Visual Basic Compiler version 8.0.50727.42 for Microsoft (R) .NET Framework version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. C:\CRFF\Default.aspx.vb(79) : warning BC42104: Variable 'wks' is used before it has been assigned a value. A null reference exception could result at runtime. If Not (wks Is Nothing) Then ~~~ C:\CRFF\Default2.aspx(49) : warning BC42020: Variable declaration without an 'As' clause; type of Object assumed. Dim s = r("employeeid").ToString ~ C:\CRFF\IT_Daily_Tasks.aspx(40) : error BC30201: Expression expected. target.SetDataBoundString(1, System.Convert.ToString(Container.Value == "True" ? "checked='checked'" : "", System.Globalization.CultureInfo.CurrentCulture)) ~ C:\CRFF\IT_Daily_Tasks.aspx(40) : error BC30035: Syntax error. target.SetDataBoundString(1, System.Convert.ToString(Container.Value == "True" ? "checked='checked'" : "", System.Globalization.CultureInfo.CurrentCulture)) ---------------------------------------------------------------------------- Help Please

            modified on Wednesday, December 2, 2009 12:10 AM

            D Offline
            D Offline
            Dinesh Mani
            wrote on last edited by
            #7

            Why din't I think of this before? Ok try this! " />

            A 1 Reply Last reply
            0
            • D Dinesh Mani

              Based on your question I understood that we are talking about a compilation error and my comment was about the checkbox definition statement

              />

              You are using a server evaluation to set the checked status using the ternary operator in the below line. <%# Container.Value == "True" ? "checked='checked'" : "" %> I guess this is where the error is, using ternary operator in a server evaluation where the code behind is VB.NET

              A Offline
              A Offline
              alaminfad
              wrote on last edited by
              #8

              I guess you are right ,cuz when i removed the[evaluation] the page loaded succesfuly , now do i have to give up the whole idea of changing the DB instantly via some JavaScript code?

              D 1 Reply Last reply
              0
              • A alaminfad

                I guess you are right ,cuz when i removed the[evaluation] the page loaded succesfuly , now do i have to give up the whole idea of changing the DB instantly via some JavaScript code?

                D Offline
                D Offline
                Dinesh Mani
                wrote on last edited by
                #9

                Did you try using the IFF function to evaluate the checked status?

                A 1 Reply Last reply
                0
                • D Dinesh Mani

                  Why din't I think of this before? Ok try this! " />

                  A Offline
                  A Offline
                  alaminfad
                  wrote on last edited by
                  #10

                  Thnx Sir,i tried but i got: BC30451: Name 'IFF' is not declared. i tried : Checked="<%# IF((Container.Value = "True"), true, false)%>" /> i got the old error : BC30201: Expression expected.

                  D 1 Reply Last reply
                  0
                  • D Dinesh Mani

                    Did you try using the IFF function to evaluate the checked status?

                    A Offline
                    A Offline
                    alaminfad
                    wrote on last edited by
                    #11

                    i tried but i got: BC30451: Name 'IFF' is not declared. i tried : Checked="<%# IF((Container.Value = "True"), true, false)%>" /> i got the old error : BC30201: Expression expected.

                    1 Reply Last reply
                    0
                    • A alaminfad

                      Thnx Sir,i tried but i got: BC30451: Name 'IFF' is not declared. i tried : Checked="<%# IF((Container.Value = "True"), true, false)%>" /> i got the old error : BC30201: Expression expected.

                      D Offline
                      D Offline
                      Dinesh Mani
                      wrote on last edited by
                      #12

                      alaminfad wrote:

                      i tried : Checked="<%# IF((Container.Value = "True"), true, false)%>" />

                      mm, try this - Checked="<%# IF(Container.Value = "True") Then True Else False)%>"

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups