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. Other Discussions
  3. The Weird and The Wonderful
  4. Kinda guy

Kinda guy

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
7 Posts 6 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.
  • G Offline
    G Offline
    glhrmbhnrt
    wrote on last edited by
    #1

    One developer at work like to do things the hard way.

    protected void ProcessDropDown(DropDownList myCombo, string myValue)
    {
    foreach (ListItem myItem in myCombo.Items)
    {
    if (myItem.Value == myValue)
    {
    myItem.Selected = true;
    break;
    }
    }
    }

    All this just to select an item on aspx pages, should i throw him by the window? And yes, this method is used only on the .cs file. So why use protected and do this thing? My eyes still hurt.

    return true;

    L B B 3 Replies Last reply
    0
    • G glhrmbhnrt

      One developer at work like to do things the hard way.

      protected void ProcessDropDown(DropDownList myCombo, string myValue)
      {
      foreach (ListItem myItem in myCombo.Items)
      {
      if (myItem.Value == myValue)
      {
      myItem.Selected = true;
      break;
      }
      }
      }

      All this just to select an item on aspx pages, should i throw him by the window? And yes, this method is used only on the .cs file. So why use protected and do this thing? My eyes still hurt.

      return true;

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      There are times when I am glad that 'the hard way' is still available. For one thing I don't like to be confined to using the one and only 'right way' to do things. Data binding may be the 'easy way', but also creates its own new problems. Just srearch for 'GridView' in Q&A. Besides that, data binding can be unacceptably slow in some cases. Filling controls directly can speed up things very much. And when I decide to do it 'the hard way' I also tend to keep all eggs in one basket and fill all controls that way, just to minimize the potential for misunderstandings. Luckily, I have not been thrown by the window for doing that yet. Edit: 'protected' is probably not the best choice in this case, but it does not do any harm.

      At least artificial intelligence already is superior to natural stupidity

      M 1 Reply Last reply
      0
      • G glhrmbhnrt

        One developer at work like to do things the hard way.

        protected void ProcessDropDown(DropDownList myCombo, string myValue)
        {
        foreach (ListItem myItem in myCombo.Items)
        {
        if (myItem.Value == myValue)
        {
        myItem.Selected = true;
        break;
        }
        }
        }

        All this just to select an item on aspx pages, should i throw him by the window? And yes, this method is used only on the .cs file. So why use protected and do this thing? My eyes still hurt.

        return true;

        B Offline
        B Offline
        BobJanova
        wrote on last edited by
        #3

        This seems like he just didn't know about SelectedItem ... a harmless mistake, easily corrected.

        L 1 Reply Last reply
        0
        • B BobJanova

          This seems like he just didn't know about SelectedItem ... a harmless mistake, easily corrected.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          That would have been too easy. But I think I came across some control without SelectedItem or SelectedIndex properties.

          At least artificial intelligence already is superior to natural stupidity

          1 Reply Last reply
          0
          • G glhrmbhnrt

            One developer at work like to do things the hard way.

            protected void ProcessDropDown(DropDownList myCombo, string myValue)
            {
            foreach (ListItem myItem in myCombo.Items)
            {
            if (myItem.Value == myValue)
            {
            myItem.Selected = true;
            break;
            }
            }
            }

            All this just to select an item on aspx pages, should i throw him by the window? And yes, this method is used only on the .cs file. So why use protected and do this thing? My eyes still hurt.

            return true;

            B Offline
            B Offline
            BillW33
            wrote on last edited by
            #5

            Hopefully, that guy can be taught the correct way to do things. If not, then it is time to take him to that window. ;)

            Just because the code works, it doesn't mean that it is good code.

            P 1 Reply Last reply
            0
            • B BillW33

              Hopefully, that guy can be taught the correct way to do things. If not, then it is time to take him to that window. ;)

              Just because the code works, it doesn't mean that it is good code.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              CIDev wrote:

              take him to that window

              At least post a sign at the window: "This is the window out of which you will be thrown if you write bad code."

              1 Reply Last reply
              0
              • L Lost User

                There are times when I am glad that 'the hard way' is still available. For one thing I don't like to be confined to using the one and only 'right way' to do things. Data binding may be the 'easy way', but also creates its own new problems. Just srearch for 'GridView' in Q&A. Besides that, data binding can be unacceptably slow in some cases. Filling controls directly can speed up things very much. And when I decide to do it 'the hard way' I also tend to keep all eggs in one basket and fill all controls that way, just to minimize the potential for misunderstandings. Luckily, I have not been thrown by the window for doing that yet. Edit: 'protected' is probably not the best choice in this case, but it does not do any harm.

                At least artificial intelligence already is superior to natural stupidity

                M Offline
                M Offline
                Mohibur Rashid
                wrote on last edited by
                #7

                Agree with you.

                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