R2i DotNetNuke® Forum

R2i wants you to have the opportunity to ask questions, post reviews, help others or just rant and rave about DotNetNuke® or any of the R2i Modules and Skins. Our team spends hour upon hour, day after day, working on custom DotNetNuke® modules and services; please feel free to ask us anything.
 
dropdown Visibilty
Last Post 01 Jan 1900 05:00 AM by . 0 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Informative
schafer_bradUser is Offline
New Member
New Member
Posts:14

--
17 Mar 2006 07:57 PM  
I needed the ability to set the visibility of a dropdown based on some other property of the user. Oh, and the dropdown needed to postback on the change of selection

Here is the solution I used:
[TotalPartnerships] is an integer returned in the main QUERY it is 0 or > 0.

As I am unaware of a way to 'disable' sub-queries to run or show I decided to use CSS to handle the visibility.

Notice this:
style="{IIF,[TotalPartnerships] > 1,,"display:none;"}"

Basically it says if the total partners is > 1 then show them and allow the user to select one. Otherwise don't show the selection.

Then notice this:
OnChange="form.submit()"

It handles the auto-postback


Here is the whole SubQuery Piece... it goes in the display.

<SELECT OnChange="form.submit()" name=cboPartnerID id=cboPartnerID style="{IIF,[TotalPartnerships] > 1,,"display:none;"}">
<OPTION Value="-1">ALL</OPTION>
{SUBQUERY, Name="", Query="SELECT PartnerID,PartnerName FROM Partners WHERE UserID = [*UserID]", Format="<option value= '[PartnerID]'>[PartnerName]</option>", SelectedFormat="<option value='[PartnerID]' SELECTED>[PartnerName]</option>", SelectedField="PartnerID",
SelectedItems="[cboPartnerID,Form]"}
</SELECT>

Of course you will need to have your own tables and select statements to make this work, however, the framework remains the same.
<center><b>Brad Schafer<br><br><br><img src="http://www.theschafergroup.com/Portals/0/Logo-New.jpg"><br><br><a href="http://www.thechafergroup.com" style="font-size:7px;"> Brand Building</a> , <a href="http://www.thechafergroup.com" style="font-size:7px;">Lead Generation</a>, <a href="http://www.thechafergroup.com" style="font-size:7px;">Web Design</a></center>
You are not authorized to post a reply.

Active Forums 4.1
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share