Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsLinksLinksLinks.ascx alterationsLinks.ascx alterations
Previous
 
Next
New Post
4/9/2007 6:40 AM
 

Hi all,

I normally mod the links.ascx file quite a bit each time there's an update to the links module, but the latest one needs a little more than I can manage in order to get the nowrap option working.

I've pasted my version of the file below. The basics I do are... I remove all the tables, tighten up the spacing, make the dropdown display the go button on the side more often, and I have always added nowrap to the links list by adding ItemStyle-Wrap="false" to the first datalist.

And that's where my problem is. In the latest 03.03.07 release, there is now a setting for adding nowrap to the table cell that surrounds the list. The %# NoWrap % variable presumably inserts either nowrap or nothing. What I need is a way to make it instead return "true" or "false" which is what ItemStyle-Wrap needs.

Does anyone know a convenient way to achieve this? I'm not familiar with compiling source so go easy on me in that regard. If it won't work easily, please take the changes as a suggestion for a future update.

Regards,
Rob

(to try out my changes (so long as the forum hasn't buggered the code up), it pastes straight into links.ascx replacing everything there)

<%@ Control language="vb" Inherits="DotNetNuke.Modules.Links.Links" CodeBehind="Links.ascx.vb" AutoEventWireup="false" Explicit="True" %>
<asp:panel id="pnlList" runat="server">
    <asp:DataList id="lstLinks" runat="server" summary="Links Design Table" itemstyle-verticalalign="Top"  CellSpacing="0" cellpadding="2" ItemStyle-Wrap="false">
  <itemtemplate>
   <asp:HyperLink id="editLink" NavigateUrl='<%# EditURL("ItemID",DataBinder.Eval(Container.DataItem,"ItemID")) %>' Visible="<%# IsEditable %>" runat="server">
   <asp:Image id="editLinkImage" ImageUrl="~/images/edit.gif" AlternateText="Edit" Visible="<%# IsEditable %>" Runat="server" />
   </asp:HyperLink>
   <asp:Image ImageUrl="<%# FormatIcon() %>" Visible="<%# DisplayIcon() %>" runat="server" />
   <asp:HyperLink CssClass="Normal" Text='<%# DataBinder.Eval(Container.DataItem,"Title") %>' NavigateUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem,"Url"),DataBinder.Eval(Container.DataItem,"TrackClicks")) %>' ToolTip='<%# DisplayToolTip(DataBinder.Eval(Container.DataItem,"Description")) %>' Target='<%# IIF(DataBinder.Eval(Container.DataItem,"NewWindow"),"_blank","_self") %>' runat="server" />
   <asp:LinkButton Runat="server" CssClass="CommandButton" Text="..." CommandName="Select" Visible="<%# DisplayInfo() %>" />
   <asp:Panel id="pnlDescription" visible="false" runat="server">
    <asp:Label runat="server" CssClass="Normal" Text='<%# HtmlDecode(DataBinder.Eval(Container.DataItem, "Description")) %>' ID="Label1" />
   </asp:Panel>
  </itemtemplate>
  <ItemStyle VerticalAlign="Top" />
 </asp:DataList>
</asp:panel>
<asp:panel id="pnlDropdown" runat="server" Wrap="false">
                <asp:imagebutton id=cmdEdit runat="server" imageurl="~/images/edit.gif" alternatetext="Edit" resourcekey="Edit"></asp:imagebutton>
                <label style="DISPLAY: none" for="<%=cboLinks.ClientID%>">Link</label>
                <asp:dropdownlist id=cboLinks Width="85%"  runat="server" datatextfield="Title" datavaluefield="ItemID" cssclass="NormalTextBox"></asp:dropdownlist>&nbsp;
                <asp:linkbutton id=cmdGo runat="server" cssclass="CommandButton" resourcekey="cmdGo"></asp:linkbutton>&nbsp;
                <asp:linkbutton id=cmdInfo runat="server" cssclass="CommandButton" text="..."></asp:linkbutton>
                <asp:label id=lblDescription runat="server" cssclass="Normal"></asp:label>
</asp:panel>

 
New Post
4/9/2007 6:01 PM
 

I would just test to see if the NoWrap variable equals "nowrap."

<%# IIF(NoWrap.Equals("nowrap"), "true", "false") %>

Hope it helps.


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/10/2007 1:21 AM
 

Great stuff Brian, that's exactly what I was hoping for.. 'cept I haven't a clue about the syntax for this stuff.

I'm guessing that "IIF" was a mis-type in your post, so I tried it using this:

ItemStyle-Wrap="<%# IF(NoWrap.Equals("nowrap"), "true", "false") %>"

That line causes this error: The server tag is not well formed.

Then I tried it without the quotes seeing as they're already in there.

ItemStyle-Wrap=<%# IF(NoWrap.Equals("nowrap"), "true", "false") %>

And that line causes this error: The log says error BC30201: Expression expected.

I'm sure it's pretty close. Would you possibly be able to fill me in on the correct line?

Thanks heaps
Rob

 
New Post
4/10/2007 10:06 AM
 

Actually, IIF is a VB statement meaning "if the first parameter is true, return the second, otherwise return the third."  IIF(x,y,z) is basically a shortcut for

If(x) Then

    Return y

Else

    Return z

End If  

Also, you were right to mess with the quotes.  However, what you actually need to do is use two different styles of quotes, so change the outer quotes to be singles quotes, like so:

ItemStyle-Wrap='<%# IIF(NoWrap.Equals("nowrap"), "false", "true") %>'

Note: I just realized that we also need the true and false switched.  If it equals nowrap, then wrap is false.

 

Hope it helps!


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/10/2007 8:30 PM
 

That works perfectly.. thanks heaps for the assistance and explanation. I have to admit, the last language I learned was Sinclair Basic back in about 83... it left me knowing generally how things should work but not much else.

Since looking at other posts in the Links forum last night I've also noticed that others have been doing a similar thing and removed all the tables from this module. Mine's a little different, and if anyone wants to try it out (including Brian's fix), just replace your links.ascx with the following:

<%@ Control language="vb" Inherits="DotNetNuke.Modules.Links.Links" CodeBehind="Links.ascx.vb" AutoEventWireup="false" Explicit="True" %>
<asp:panel id="pnlList" runat="server">
    <asp:DataList id="lstLinks" runat="server" summary="Links Design Table" itemstyle-verticalalign="Top"  CellSpacing="0" cellpadding="2" ItemStyle-Wrap='<%# IIF(NoWrap.Equals("nowrap"), "false", "true") %>'>
  <itemtemplate>
   <asp:HyperLink id="editLink" NavigateUrl='<%# EditURL("ItemID",DataBinder.Eval(Container.DataItem,"ItemID")) %>' Visible="<%# IsEditable %>" runat="server">
   <asp:Image id="editLinkImage" ImageUrl="~/images/edit.gif" AlternateText="Edit" Visible="<%# IsEditable %>" Runat="server" />
   </asp:HyperLink>
   <asp:Image ImageUrl="<%# FormatIcon() %>" Visible="<%# DisplayIcon() %>" runat="server" />
   <asp:HyperLink CssClass="Normal" Text='<%# DataBinder.Eval(Container.DataItem,"Title") %>' NavigateUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem,"Url"),DataBinder.Eval(Container.DataItem,"TrackClicks")) %>' ToolTip='<%# DisplayToolTip(DataBinder.Eval(Container.DataItem,"Description")) %>' Target='<%# IIF(DataBinder.Eval(Container.DataItem,"NewWindow"),"_blank","_self") %>' runat="server" />
   <asp:LinkButton Runat="server" CssClass="CommandButton" Text="..." CommandName="Select" Visible="<%# DisplayInfo() %>" />
   <asp:Panel id="pnlDescription" visible="false" runat="server">
    <asp:Label runat="server" CssClass="Normal" Text='<%# HtmlDecode(DataBinder.Eval(Container.DataItem, "Description")) %>' ID="Label1" />
   </asp:Panel>
  </itemtemplate>
  <ItemStyle VerticalAlign="Top" />
 </asp:DataList>
</asp:panel>
<asp:panel id="pnlDropdown" runat="server" Wrap="false">
                <asp:imagebutton id=cmdEdit runat="server" imageurl="~/images/edit.gif" alternatetext="Edit" resourcekey="Edit"></asp:imagebutton>
                <label style="DISPLAY: none" for="<%=cboLinks.ClientID%>">Link</label>
                <asp:dropdownlist id=cboLinks Width="85%"  runat="server" datatextfield="Title" datavaluefield="ItemID" cssclass="NormalTextBox"></asp:dropdownlist>&nbsp;
                <asp:linkbutton id=cmdGo runat="server" cssclass="CommandButton" resourcekey="cmdGo"></asp:linkbutton>&nbsp;
                <asp:linkbutton id=cmdInfo runat="server" cssclass="CommandButton" text="..."></asp:linkbutton>
                <asp:label id=lblDescription runat="server" cssclass="Normal"></asp:label>
</asp:panel>

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsLinksLinksLinks.ascx alterationsLinks.ascx alterations


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out