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. SharePoint
  4. check box list item with a text box on check in share point list

check box list item with a text box on check in share point list

Scheduled Pinned Locked Moved SharePoint
sharepointgame-devtutorial
7 Posts 2 Posters 2 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.
  • U Offline
    U Offline
    User 12219784
    wrote on last edited by
    #1

    I have a custom input form some of the fields are coming from a list in SharePoint 2010. I have a check box control which is populated by a list item. there are around 10 rows. Now i want when a user select a check box list item, a text box should appear beside it. for example I have a list called subjects, which have column name title and the entries are physics, maths, chem etc... Now when a user select physics from the check box list a text-box should appear beside it and user should be able to write on text box.

    D 1 Reply Last reply
    0
    • U User 12219784

      I have a custom input form some of the fields are coming from a list in SharePoint 2010. I have a check box control which is populated by a list item. there are around 10 rows. Now i want when a user select a check box list item, a text box should appear beside it. for example I have a list called subjects, which have column name title and the entries are physics, maths, chem etc... Now when a user select physics from the check box list a text-box should appear beside it and user should be able to write on text box.

      D Offline
      D Offline
      DanielBrownAU
      wrote on last edited by
      #2

      Sounds liek you will want to have an event on the checkbo, where it will show or hide the textbox based on the checkbox being selected. What have you tried so far?

      U 1 Reply Last reply
      0
      • D DanielBrownAU

        Sounds liek you will want to have an event on the checkbo, where it will show or hide the textbox based on the checkbox being selected. What have you tried so far?

        U Offline
        U Offline
        User 12219784
        wrote on last edited by
        #3

        protected void chkboxIncentive_SelectedIndexChanged(object sender, EventArgs e) { foreach (ListItem checkbox in chkboxIncentive.Items) { //If this particular item is checked if (checkbox.selected) { checkbox.Text = String.Format("{0}<input id=\"TextBox{0}\" name=\"TextBox{0}\" / >", checkbox.Value); //TextBox tb = new TextBox { ID = checkbox.Value }; //Input.Controls.Add(tb); } } } its throwing error at ListItem saying ambiguity and another error at selected and value

        D 1 Reply Last reply
        0
        • U User 12219784

          protected void chkboxIncentive_SelectedIndexChanged(object sender, EventArgs e) { foreach (ListItem checkbox in chkboxIncentive.Items) { //If this particular item is checked if (checkbox.selected) { checkbox.Text = String.Format("{0}<input id=\"TextBox{0}\" name=\"TextBox{0}\" / >", checkbox.Value); //TextBox tb = new TextBox { ID = checkbox.Value }; //Input.Controls.Add(tb); } } } its throwing error at ListItem saying ambiguity and another error at selected and value

          D Offline
          D Offline
          DanielBrownAU
          wrote on last edited by
          #4

          checkbox.Text = String.Format("{0}<input id=\"TextBox{0}\" name=\"TextBox{0}\" / >", checkbox.Value);

          This is going to cause you problems. You are on the right path with adding the textbox to the controls of the container tho, with:

          //TextBox tb = new TextBox { ID = checkbox.Value };
          //Input.Controls.Add(tb);

          Although I dont know what "Input" is, But I assume its a container for your controls. What are the exact errors you are getting? You could also create the text boxes when you create the checkboxes and then hide them by default, only showing when you need them?

          U 1 Reply Last reply
          0
          • D DanielBrownAU

            checkbox.Text = String.Format("{0}<input id=\"TextBox{0}\" name=\"TextBox{0}\" / >", checkbox.Value);

            This is going to cause you problems. You are on the right path with adding the textbox to the controls of the container tho, with:

            //TextBox tb = new TextBox { ID = checkbox.Value };
            //Input.Controls.Add(tb);

            Although I dont know what "Input" is, But I assume its a container for your controls. What are the exact errors you are getting? You could also create the text boxes when you create the checkboxes and then hide them by default, only showing when you need them?

            U Offline
            U Offline
            User 12219784
            wrote on last edited by
            #5

            I am getting error at foreach loop when i am using Listitem . the error says there is a ambiguity between system.data and microsoft.sharepoint

            D 1 Reply Last reply
            0
            • U User 12219784

              I am getting error at foreach loop when i am using Listitem . the error says there is a ambiguity between system.data and microsoft.sharepoint

              D Offline
              D Offline
              DanielBrownAU
              wrote on last edited by
              #6

              OK, Now we are getting somewhere. It means, its cannot decide which 'ListItem' to use I would assume. Add the namespace infront of the class, Something like System.Data.ListItem - tho im not sure this is correct and I would use System.Web.UI.WebControls.ListItem but it all depends on what 'ListItem' class you are trying to use. -DB

              U 1 Reply Last reply
              0
              • D DanielBrownAU

                OK, Now we are getting somewhere. It means, its cannot decide which 'ListItem' to use I would assume. Add the namespace infront of the class, Something like System.Data.ListItem - tho im not sure this is correct and I would use System.Web.UI.WebControls.ListItem but it all depends on what 'ListItem' class you are trying to use. -DB

                U Offline
                U Offline
                User 12219784
                wrote on last edited by
                #7

                I used Microsoft.SharePoint.Client.ListItem still I am getting error.

                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