asp.net – repeater或listview vs concatenated html

It took a lot of time to convert pages that use serial html, such as

string output = "";
output +="
    ";
    foreach(MyClass item in MyItems)
    {
    output += "
  • "+item.Name+"-"+item.SomeProperty .ToString()+"
  • ";
    }
    output+="
";

literalPlaceHolder.Text=output;

In order to use the ListView control, I just discovered that the original developer returned and converted the page back to use connected html. My personal feeling is that list views and forwarders can provide clearer and more informative markup, which can be derived from more experience in C# Fewer people edit, and they are faster and use less memory. At least pages should use StringBuilder instead of strings. Does anyone have a good reason for this? When I mentioned this matter, I had a feeling that it would cause a major conflict.

First of all, I I think that for other developers, just replacing your code is not very cooperative and there is no discussion. If you want to prevail in this position, you must definitely prepare for your position.

I agree that standard ASP.Net controls are easier to handle for less experienced developers, if this is your concern.

I am not sure if I agree with your information about StringBuilder, because StringBuilder often sparks controversial controversy here and elsewhere. If your list is not long enough, then StringBuilder may not have enough reasons.

An experienced developer may appreciate this particular method. On the one hand, it is easy to see how each item is filled step by step. Using ListView is not easy-you have to add an event to capture the item being added, and then put a breakpoint in it.

Finally, I You are encouraged to choose your battle carefully. This particular example is not a major design issue. If you foresee other greater differences of opinion in the future, you may decide to start with a smaller issue in order to establish with your developers The way to resolve this type of conflict. Alternatively, you can think that this is not a large enough agreement to fight for and wait for something important (I suspect you will have to wait a long time). Which way to choose depends on what is involved Personality.

It takes a lot of time to convert pages that use serial html, such as

string output = "";
output +="
    ";
    foreach(MyClass item in MyItems)
    {
    output += "
  • "+item.Name+" -"+item.SomeProperty.ToString()+"
  • ";
    }
    output+="
";

literalPlaceHolder.Text=output;

In order to use the ListView control, I just discovered that the original developer went back and converted the page back to using connected html. My personal feeling is that list views and forwarders can provide clearer and more informative markup, Can be edited by people with less experience in C#, And they are faster and use less memory. At least pages should use StringBuilder instead of strings. Does anyone have a good reason for this? When I mentioned this matter, I had a feeling that it would cause a major conflict.

First of all, I think for other developers, just replace yours The code is not very cooperative and there is no discussion. If you want to gain the upper hand in this position, you must be prepared for your position.

I agree that the standard ASP.Net controls are inexperienced It’s easier for developers to deal with if this is your concern.

I’m not sure if I agree with your information about StringBuilder, because StringBuilder often sparks controversial controversy here and elsewhere. If your list is not verbose enough, then StringBuilder may not have enough reason.

One aspect that experienced developers may appreciate this particular method is that it is easy to look at the filling of each item step by step Way. Using ListView is not easy-you have to add an event to capture the item being added, and then put a breakpoint in it.

Finally, I encourage you to choose your battle carefully. This particular example Not a major design issue. If you foresee other larger differences of opinion in the future, you may decide to start with a smaller issue in order to establish a way to resolve such conflicts with your developers. Or, you can think This is not a big enough agreement to fight for and wait for something important (I suspect you will have to wait a long time). Which way you choose depends on the personality involved.

Leave a Comment

Your email address will not be published.