Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:12:19+00:00 2026-06-03T03:12:19+00:00

I am trying to add a link with parameters only if certain things are

  • 0

I am trying to add a link with parameters only if certain things are retrieved from the database.

Here is my code:

protected void GetOrderLines (string OrderID)
{
    string query;
    query = "SELECT ol.ItemId, ol.Amount, ol.Quantity, i.description, ol.RetailPrice, o.OrderDate";
    query += " FROM Distributor d";
    query += " INNER JOIN Orders o";
    query += " ON o.DistID = d.DistID";
    query += " INNER JOIN Orderlines ol";
    query += " ON ol.OrderID = o.OrderID";
    query += " INNER JOIN Items i";
    query += " ON i.InventoryID = ol.ItemID";
    query += " WHERE ol.OrderID = " + OrderID;
    query += " AND ol.GroupItem = 0";
    query += " AND d.DistID = " + Session[ "Distid" ];

    DataTable data = GeneralFunctions.GetData( query );

    RepeaterOrderlineInfo.DataSource = data;
    RepeaterOrderlineInfo.DataBind();
}

Here is the data it gives me:

ItemId  Amount  Quantity    description RetailPrice OrderDate
6015    660 1   Item 1  660 5/1/2012
6021    199.2   332 Item 2  0.6 5/1/2012
6018    150 6   Item 3  25  5/1/2012
9000    85  4   Technical Support   21.25   5/1/2012
8000    125 4   Custom Programming and Misc. Fees   31.25   5/1/2012

Here is the Eval code on the page:

<asp:Repeater ID="RepeaterOrderlineInfo" runat="server">
    <ItemTemplate>
        <tr>
            <td>
                <%# Eval("Itemid") %>
            </td>
            <td>
                <%# Eval("description") %>
            </td>
            <td align="right">
                <%# Eval("RetailPrice", "{0:C}") %>
            </td>
            <td align="right">
                <%# Eval("Quantity") %>
            </td>
            <td align="right">
                <%# Eval( "Amount", "{0:C}" )%>
            </td>
        </tr>
    </ItemTemplate>
</asp:Repeater>

I am trying to build a link for the <%# Eval("Description") %>

<a href="SupportSummary.aspx?sd="<%# Eval("OrderDate") %>&ed=<%# Eval("OrderDate") //- 1 month %>"><%# Eval("Description") %>

I only need the description to be a link if the description = "Technical Support". Is this possible when using a repeater?

So the main things I am seeking here are:

How to Eval the OrderDaye and subtract one month.
How to do a condition on the description only if it = “Technical Support”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:12:20+00:00Added an answer on June 3, 2026 at 3:12 am

    If you add a method to your code-behind, you can call it like this in your repeater:

    <%# MyMethod(Eval("Description"),Eval("OrderDate")) %>
    

    The method would be something like this:

    protected string MyMethod(object description, object orderDate)
    { 
        string link = String.Empty;
    
        // conditions, assign link if needed
    
        return link;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get form parameters from a GET request. The html code
I'm trying to add an action link to a grid. But only if a
Am trying to add a link besides the Edit | Delete links in wordpress
I am trying to hide my Add friend link if - current_user and @user
I'm trying to add a link to a Rails view to set a boolean
pstrjds, From the code you have provided I am trying to implement that code
I'm trying to add a link to each slideshow image in joomla, but I've
I'm trying to add an function to an a click event to my code.
I'm trying to add a link in my header.php file that disappears after a
I'm trying add a tab to my web page that looks like this: Using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.