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. placeholder does not recognize line break code [modified]

placeholder does not recognize line break code [modified]

Scheduled Pinned Locked Moved ASP.NET
helpwpfwcfdesigndocker
9 Posts 2 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.
  • I Offline
    I Offline
    imranafsari
    wrote on last edited by
    #1

    Hi . I am creating dynamically dataitem for datalist and populating record to it on fly. My problem is that table does not recognize
    Inside ph.Controls.Add(new LiteralControl("
    ")); WHAT IS THE ISSUE PLEASE HELP... THANK YOU CODE THAT I AM USING TO CREATE DATALIST DATAITEM. public void InstantiateIn(System.Web.UI.Control container ) { PlaceHolder ph = new PlaceHolder(); ImageMap imp = new ImageMap(); Label item1 = new Label(); .. .. imp.ID = "img1"; switch (templateType) { case ListItemType.Header: ph.Controls.Add(new LiteralControl("" )); break; case ListItemType.Item: ph.Controls.Add(new LiteralControl("

    ")); //ph.Controls.Add(new LiteralControl("

    ")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("

    ")); ph.Controls.Add(item1); ph.Controls.Add(new LiteralControl("

    ")); ph.Controls.Add(item2); ph.Controls.Add(new LiteralControl("

    ")); ph.Controls.Add(item3); ph.Controls.Add(new LiteralControl("

    ")); ph.Controls.Add(item4); ph.Controls.Add(new LiteralControl("

    ")); ph.DataBinding += new EventHandler(Item_DataBinding); break; case ListItemType.Footer: ph.Controls.Add(new LiteralControl("")); break; } container.Controls.Add(ph); } And binding it as static void Item_DataBinding(object sender, System.EventArgs e) { PlaceHolder ph = (PlaceHolder)sender; DataListItem ri = (DataListItem)ph.NamingContainer; /string impValue = (string)DataBinder.Eval(ri.DataItem, "photopath1"); String item1Value = (String)DataBinder.Eval(ri.DataItem, "Categoryid1"); String item2Value = (String)DataBinder.Eval(ri.DataItem, "subcategoryid1"); String item3Value = (String)DataBinder.Eval(ri.DataItem, "customerid1"); String item4Value = (String ) DataBinder.Eval(ri.DataItem, "retailprice1").ToString() ; ((ImageMap)ph.FindControl("img1")).ImageUrl = impValue; ((Label)ph.FindControl("ite

    F 1 Reply Last reply
    0
    • I imranafsari

      Hi . I am creating dynamically dataitem for datalist and populating record to it on fly. My problem is that table does not recognize
      Inside ph.Controls.Add(new LiteralControl("
      ")); WHAT IS THE ISSUE PLEASE HELP... THANK YOU CODE THAT I AM USING TO CREATE DATALIST DATAITEM. public void InstantiateIn(System.Web.UI.Control container ) { PlaceHolder ph = new PlaceHolder(); ImageMap imp = new ImageMap(); Label item1 = new Label(); .. .. imp.ID = "img1"; switch (templateType) { case ListItemType.Header: ph.Controls.Add(new LiteralControl("" )); break; case ListItemType.Item: ph.Controls.Add(new LiteralControl("

      ")); //ph.Controls.Add(new LiteralControl("

      ")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("

      ")); ph.Controls.Add(item1); ph.Controls.Add(new LiteralControl("

      ")); ph.Controls.Add(item2); ph.Controls.Add(new LiteralControl("

      ")); ph.Controls.Add(item3); ph.Controls.Add(new LiteralControl("

      ")); ph.Controls.Add(item4); ph.Controls.Add(new LiteralControl("

      ")); ph.DataBinding += new EventHandler(Item_DataBinding); break; case ListItemType.Footer: ph.Controls.Add(new LiteralControl("")); break; } container.Controls.Add(ph); } And binding it as static void Item_DataBinding(object sender, System.EventArgs e) { PlaceHolder ph = (PlaceHolder)sender; DataListItem ri = (DataListItem)ph.NamingContainer; /string impValue = (string)DataBinder.Eval(ri.DataItem, "photopath1"); String item1Value = (String)DataBinder.Eval(ri.DataItem, "Categoryid1"); String item2Value = (String)DataBinder.Eval(ri.DataItem, "subcategoryid1"); String item3Value = (String)DataBinder.Eval(ri.DataItem, "customerid1"); String item4Value = (String ) DataBinder.Eval(ri.DataItem, "retailprice1").ToString() ; ((ImageMap)ph.FindControl("img1")).ImageUrl = impValue; ((Label)ph.FindControl("ite

      F Offline
      F Offline
      Fred_Smith
      wrote on last edited by
      #2

      .... Nothing to do with the placeholder - it is not valid HTML to have a
      tag placed between two tags...

      I 1 Reply Last reply
      0
      • F Fred_Smith

        .... Nothing to do with the placeholder - it is not valid HTML to have a
        tag placed between two tags...

        I Offline
        I Offline
        imranafsari
        wrote on last edited by
        #3

        thanks for reply. actually then how can i move record to next line. please help

        imran khan

        F 1 Reply Last reply
        0
        • I imranafsari

          thanks for reply. actually then how can i move record to next line. please help

          imran khan

          F Offline
          F Offline
          Fred_Smith
          wrote on last edited by
          #4

          well it depends how yu want to display them - either put them all in one td tag with br betwen them, or else use the tr tag to start a new table row between each. Try making up a simple html page with some sample data on it displayed how you want it, then recreate the html there in your code, inserting the records as and when needed.

          I 1 Reply Last reply
          0
          • F Fred_Smith

            well it depends how yu want to display them - either put them all in one td tag with br betwen them, or else use the tr tag to start a new table row between each. Try making up a simple html page with some sample data on it displayed how you want it, then recreate the html there in your code, inserting the records as and when needed.

            I Offline
            I Offline
            imranafsari
            wrote on last edited by
            #5

            actually in one i have five data to show and i would be like these data to display one below the other. how can i do it please help

            imaran khan

            F 1 Reply Last reply
            0
            • I imranafsari

              actually in one i have five data to show and i would be like these data to display one below the other. how can i do it please help

              imaran khan

              F Offline
              F Offline
              Fred_Smith
              wrote on last edited by
              #6

              the put a
              between them, but leave out the

              I 1 Reply Last reply
              0
              • F Fred_Smith

                the put a
                between them, but leave out the

                I Offline
                I Offline
                imranafsari
                wrote on last edited by
                #7

                now i change the code but it does not working ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(new LiteralControl("
                ")); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(item1); imaran khan

                F 1 Reply Last reply
                0
                • I imranafsari

                  now i change the code but it does not working ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(new LiteralControl("
                  ")); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(item1); imaran khan

                  F Offline
                  F Offline
                  Fred_Smith
                  wrote on last edited by
                  #8

                  you're still putting a br between the td tags - just leave out those tow lines: ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("
                  ")); ph.Controls.Add(item1);

                  I 1 Reply Last reply
                  0
                  • F Fred_Smith

                    you're still putting a br between the td tags - just leave out those tow lines: ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(imp); ph.Controls.Add(new LiteralControl("
                    ")); ph.Controls.Add(item1);

                    I Offline
                    I Offline
                    imranafsari
                    wrote on last edited by
                    #9

                    thanks buddy i worked ... i understood my mistake. thanks alot

                    imaran khan

                    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