Keep Your Template Logic in the Template(sitepoint.com)

submitted by wwb_99wwb_99(870) 4 years, 2 months ago

Why keeping your template logic in the template is next to godliness. With a concrete example.

4 comments |category: |Views: 2

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by FlySwatFlySwat(485) 4 years, 2 months ago 0

Why the animosity? The .NET community is small enough as it is, there is no need to turn on fellow coders.

That said, I disagree with you entirely.

Also:

1. ASP:Labels and ASP:Literals have no viewstate.
2. Html Controls with runat="server" are represented as System.Web.UI.Controls.HTMLControls in the Control Tree, which has the same footprint as my ASP controls.
3. You are doing the exact same thing in your example as mine, binding a business object to a repeater...Except in your example you don't have compile time checking because its all inline in the aspx. It is also harder to understand, modify, and maintain.
4. If your project follows a Build / QA / Deploy schedule, I don't want to see people fixing things in the aspx and pushing them to production without following procedure.
5. Why the hate? Does your blog not get enough readers?

Reply

posted by wwb_99wwb_99(870) 4 years, 2 months ago 0

No animosity intended, and I am not certain where you got that from. Healthy intellectual disagreement, yeah. But hate, nah.

Side note: Labels and Literals do have viewstate. Not sure where you got that notion from.

Reply

posted by FlySwatFlySwat(485) 4 years, 2 months ago 0

You are right, Labels and Literals do have view state if they are modified.

http://msdn2.microsoft.com/en-us/library/ms972976.aspx

Reply

posted by FlySwatFlySwat(485) 4 years, 2 months ago 0

Ew, I can't edit my last comment.

Labels and Literals only have viewstate if they are modified after a postback. In this situation, that never happens, so there is no viewstate.

Reply

information Login or create an account to comment on this story