Kinda guy
-
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;
-
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;
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
-
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;
-
This seems like he just didn't know about SelectedItem ... a harmless mistake, easily corrected.
-
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;
-
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.
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."
-
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
Agree with you.