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. Problem with Placeholder control [modified]

Problem with Placeholder control [modified]

Scheduled Pinned Locked Moved ASP.NET
helpcomdesignquestion
24 Posts 3 Posters 1 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.
  • T thomasa

    Sorry, dident see the dgi. That is acculy not a problem, for in each datagriditem every label would have the id="lb2". as in:

    DataGrid dg = new DataGrid();
    dg.ID = "dgTheDataGrid";
    dg.RunatServer = true;
    DataGridItem dgi = new DataGridItem();
    Lable lb2 = new Label();
    lb2.ID = "lb2";
    dgi.AddControl(lb2);
    dg.AddControl(dgi);
    PlaceHolder2.AddControl(dg);

    The syntax in this code is probably wrong, but something like this.

    E Offline
    E Offline
    eyeseetee
    wrote on last edited by
    #21

    Thanks for the reply again. Im finding an error with the line DataGridItem dgi = new DataGridItem(); It says that: No overload for method 'DataGridItem' takes '0' arguments

    Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"

    1 Reply Last reply
    0
    • E eyeseetee

      J4amieC wrote:

      You seem to be having memory problems,

      Your're the only problem around here

      J4amieC wrote:

      If that isn't screaming "beginning programming book" then its beyond me what is.

      Yes but your reply(which you deleted to cover your back) just suggested to go get a beginners asp.net book rather than actually suggesting a proper tutorial. You seem to be downvoting my posts as well which makes you a hyporcrite and confirms my suspicions that you are a complete moron.

      Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #22

      .netman wrote:

      Yes but your reply(which you deleted to cover your back)

      Wrong again chump, go check again its still there. Idiot.

      E 1 Reply Last reply
      0
      • J J4amieC

        .netman wrote:

        Yes but your reply(which you deleted to cover your back)

        Wrong again chump, go check again its still there. Idiot.

        E Offline
        E Offline
        eyeseetee
        wrote on last edited by
        #23

        Deleted Message You really are dumb

        Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"

        1 Reply Last reply
        0
        • T thomasa

          Sorry, dident see the dgi. That is acculy not a problem, for in each datagriditem every label would have the id="lb2". as in:

          DataGrid dg = new DataGrid();
          dg.ID = "dgTheDataGrid";
          dg.RunatServer = true;
          DataGridItem dgi = new DataGridItem();
          Lable lb2 = new Label();
          lb2.ID = "lb2";
          dgi.AddControl(lb2);
          dg.AddControl(dgi);
          PlaceHolder2.AddControl(dg);

          The syntax in this code is probably wrong, but something like this.

          E Offline
          E Offline
          eyeseetee
          wrote on last edited by
          #24

          Someone provided me with help on another forum so I have some code which works now: Thanks for all the help though! :)

          foreach (Control c in PlaceHolder2.Controls)
          {
          if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
          {
          int textboxId = PlaceHolder2.Controls.IndexOf(c);
          if (textboxId > 0)
          {
          Control cLabel = PlaceHolder2.Controls[textboxId - 1];

                                              try
                                              {
                                                  Label lb2 = (Label)cLabel;
                                                  TextBox tb2 = (TextBox)c;
          
                                                  SqlCommand cmdinsert = new SqlCommand("INSERT INTO table(field1, field2) VALUES ('" + lb2.Text + "', '" + tb2.Text + "')", con);
                      cmdinsert.ExecuteNonQuery(); 
                                                  cmdinsertliftunion.ExecuteNonQuery();
                                              }
                                              catch (Exception)
                                              { 
                                              }
                                          }
                                      }
          

          Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"

          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