Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

VB If statement for repeating region

Participant ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

Basically Im trying to show different code if the value in the DB in column Format is "View" or "Download" in bold is what I did my I'm thinking the code is wrong. I made one recordset named Umm. Any help is appreciated.

<table class="sortable" id="sortabletable" width="900" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <th width="260">Division</th>
        <th width="226">Title</th>
        <th width="108">Format</th>
        <th width="148">Language</th>
      </tr>
      <% While ((Repeat2__numRows <> 0) AND (NOT Umm.EOF)) %>
        <tr>
          <td><%=(Umm.Fields.Item("Division").Value)%></td>
          <td><%=(Umm.Fields.Item("Title").Value)%></td>

<% if (Request.QueryString("Format")) = "Download" then %>
         
          <td><a href="<%=(Umm.Fields.Item("URL").Value)%>"><%=(Umm.Fields.Item("Format").Value)%></a></td>

<%elseif (Request.QueryString("Format")) = "View" then%>
            <td><a href="javascript:;" onclick="MM_openBrWindow('<%=(Umm.Fields.Item("URL").Value)%>','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600')"><%=(Umm.Fields.Item("Format").Value)%></a></td>

<% end if %>  
         
          <td><%=(Umm.Fields.Item("Language").Value)%></td>
        </tr>
        <%
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  Umm.MoveNext()
Wend
%>
    </table>

TOPICS
Server side applications

Views

1.1K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 24, 2011 Feb 24, 2011

QueryString is used to get the querystring in the url. You want to compare a value in the database column:

<% if Umm.Fields.Item("Format").Value = "Download" then %>
         
etc.....

Votes

Translate
LEGEND ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

Is there a problem? What are the symptoms? I see a possible typo with a space character in "Format" but not sure if this is just a cut and paste issue in your post. There could be other problems but it's hard to tell when we don't know what problem you are experiencing.

<td><a  href="<%=(Umm.Fields.Item("URL").Value)%>"><%=(Umm.Fields.Item("Forma  t").Value)%></a></td>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

The problem is the HTML is not written for either IF or Else If. How does Request Query know where to get the information from?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

Request Query? Do you mean Request.QueryString? It gets the name/value pair from the querystring collection. Can you give us an example of what your url/querystring looks like?

Is your condition based on a querystring value or a database value?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

No not a query string value just a DB value.


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

I created the recordset and need all columns, but if the Format column has a value of View

I want certain HTML written:

<% if (Request.QueryString("Format")) = "Download" then %>
         
          <td><a href="<%=(Umm.Fields.Item("URL").Value)%>"><%=(Umm.Fields.Item("Format").Value)%></a></td>

<%elseif (Request.QueryString("Format")) = "View" then%>
            <td><a href="javascript:;" onclick="MM_openBrWindow('<%=(Umm.Fields.Item("URL").Value)%>','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600')"><%=(Umm.Fields.Item("Format").Value)%></a></td>

What do I need to use instead of Request.QueryString? Hmm I will research.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

QueryString is used to get the querystring in the url. You want to compare a value in the database column:

<% if Umm.Fields.Item("Format").Value = "Download" then %>
         
etc.....

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 25, 2011 Feb 25, 2011

Copy link to clipboard

Copied

LATEST

Thank you very much!


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines