• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

CorneliuTusnea
#1 Posted : Friday, September 15, 2006 4:09:01 AM(UTC)
CorneliuTusnea

Rank: Member

Joined: 8/17/2006(UTC)
Posts: 681

I'll have to start with :sad: .


I'm trying to customize BVC5 but it seems to be a lost battle: http://www.bvsoftware.com/Forums/default.aspx?f=78&m=39976




<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Now, let's say I don't have to go to WebApps. A website is good enough so I should just try to use it.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">However this is not the case. If you try to customize BVC5 you have to start editing the BV files if you want to achieve anything else than CSS styles. This is (unfortunately) because the VB codes generates ALOT of html code. This is simply WRONG.<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">The VB code should never try to generate HTML code. That’s the whole point of ASP.Net. You build controls and you reuse them. You want to create a new link you do a<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">Dim myLink as new HyperLink<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">myLink.Text = “click me”<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">myLink.NavigateUrl = “http://wherever you want”<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"><o:p> </o:p>

[3]However in BV5 there is a bunch of <SPAN style="mso-spacerun: yes"> [/3]<SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append("&lt;a href=""categories.aspx?id=0""&gt;Root&lt;/a&gt;").<o:p></o:p>

[3]Maybe one of the worse is when you see things like:[/3]

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(<SPAN style="COLOR: maroon">"&lt;div class=""recordimage""&gt;")<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(<SPAN style="COLOR: maroon">"&lt;a href=""")<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(destinationLink)<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(<SPAN style="COLOR: maroon">"""&gt;&lt;img src=""")<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(imageUrl)<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(<SPAN style="COLOR: maroon">""" border=""0"" alt=""")<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(p.ProductName)<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(<SPAN style="COLOR: maroon">" ")<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(p.Sku)<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(<SPAN style="COLOR: maroon">""" /&gt;&lt;/a&gt;")<o:p></o:p>

<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append(<SPAN style="COLOR: maroon">"&lt;/div&gt;")<o:p></o:p>

[3]Helloo. OOP? Code Reuse?[/3]

[3]Make a user control and reuse it across your classes. That will allow me to set CSS styles on the elements. That will allow me to replace just the child user control and still get the display model defined by the category template. Right now all the display model is hard coded in the template. Seeing this code remembers me of the ASP era when all the code was a mix &amp; match of html and vb script and makes me cry.[/3]

[3]One more that it just started to rewrite: [/3]<SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">Controls.Add(New LiteralControl("&lt;li&gt;"))

[3]ASP.Net has a nice asp:bulletlist and if that is not good enough there is the asp:repeater. So I can define my item template and the elements and so on IN the ASP code. IN the presentation layer.[/3]

[3]Same type of issues: [/3]<SPAN style="FONT-SIZE: 8pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-fareast-language: EN-US; mso-no-proof: yes">sb.Append("&lt;tr&gt;&lt;td class=""formlabel""&gt;")[3]. There is a asp:gridview and asp:datagrid and asp:datalist and all of them can generate you nice tables or divs or whatever you need for each product/category/element whatever you need. [/3]

[3]The good part is that some controls are really done the correct way. For example a “by the book control” is the ProductReviewDisplay that has a nice DataList with ItemTemplate and so on. [/3]

[3]Sorry for whinging so much. I spent my last 10 evenings customizing BVC5 and the more I change it the more I start crying.[/3]

[3]So, Marcus, if you want to release SP1 for BVC5, I think one of the first things to change is the code. Make user controls. Reuse code. Make it OOP.[/3]

<o:p>[3]Corneliu.[/3]</o:p>
http://www.bestgames.com.au
http://www.bestchess.com.au



BV Product Links, Details and Signatures: Improve your customer experience:

http://www.acorns.com.au/projects/bv/quicklink/

Kman
#2 Posted : Friday, September 15, 2006 6:30:05 AM(UTC)
Kman

Rank: Member

Joined: 11/25/2003(UTC)
Posts: 370

Cornelu, have you seen the CSS friendly Control Adapters Beta?
http://www.asp.net/CSSAdapters/Default.aspx
They may be of some use to you also.
Regards,
Kim(Kman) Rossey
www.toocoolwebs.com
BVSoftware - MerchantTribe Programming/Design, Database Programming and Business Applications
[email protected]
Marcus
#3 Posted : Friday, September 15, 2006 1:13:26 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Corneliu,

I appreciate your input and it is clear that you care very much about the structure of your applications.

Perhaps I was mistaken but it is my understanding that every single part of an ASP.NET page (user controls, html, code behind, assemblies) ultimately gets converted into a control that contain a Render() method. The Render method simply writes out html text.

So, the only difference between a control with "Text" or "Href" properties and one with uses a string builder is how you write the code. In the end they both write out HTML text.
bbcweb
#4 Posted : Friday, September 15, 2006 2:34:42 PM(UTC)
bbcweb

Rank: Member

Joined: 5/14/2005(UTC)
Posts: 398

I think the point is that the presentation layer people shouldn't have to go into a layer they aren't familiar with to change stringbuilder code. Old habits are hard to break so I get in trouble for doing the same thing sometimes.

And in reference to Kman's reference, because you've used stringbuilders instead of controls, those control adapters couldn't be used anyhow.
BetterBuilt.net professional web design and development. call 1-877-325-1109 x7
jetheredge
#5 Posted : Tuesday, September 19, 2006 10:42:22 AM(UTC)
jetheredge

Rank: Member

Joined: 3/1/2006(UTC)
Posts: 1,142

Most of the places we do this are holdovers from previous BV Commerce versions. We will try and be much better about it in the future, but in some instances you just need to generate your own html. Especially in instances where we need to generate multi-dimensional lists. For example with the category lists they are rendered as unordered lists with unordered lists embedded in them that can go down any number of levels. Using asp.net list controls for this would be both resource intensive and slow. Using string builders and allow for them to be styled with css is much better in these situations. And in most cases, if the control doesn't work how you like it, then the entire user control could be changed to render in a specific way.
Justin Etheredge
Senior Software Engineer
BVSoftware
CorneliuTusnea
#6 Posted : Wednesday, September 20, 2006 1:52:28 AM(UTC)
CorneliuTusnea

Rank: Member

Joined: 8/17/2006(UTC)
Posts: 681

Justin,

I think using StringBuilders is never a good option. The code is not safe, the generated HTML can be flaky and changing it is more than a challenge.
Using controls embedded in controls might be a bit slower but it is much safer and easier to change.

For example the way you use it to create the Type Properties in the ProductsEdit is nice and easy to change when required. It was a 2-3h work for me to add support for CheckBoxes instead of ComboBox only by rewriting small parts of that class. If that class was implemented using StringBuilder it would have been extremely complicated and I would have given up for sure.
it
http://www.bestgames.com.au
http://www.bestchess.com.au



BV Product Links, Details and Signatures: Improve your customer experience:

http://www.acorns.com.au/projects/bv/quicklink/

Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012