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

  • SEARCH
  • Home
  • 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 8322463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:23:48+00:00 2026-06-08T23:23:48+00:00

I have a repeater that it has image inside itself. I want to show

  • 0

I have a repeater that it has image inside itself. I want to show different image base on ranking for example if ranking is 1 I show an image and if it is 2 I show the other etc.and i have 5 kind of image and 5 grade too.

Ranking is a column in dataset. But my function does not work correctly and I can’t get correct result. It only shows first pic. What solution do you suggest for this operation??

thank a lot .

This is my code

public string getimg()
{ 
    SqlConnection con = new SqlConnection("data source=.;database=site;integrated security=true;");
     string sSQL = "Select username ,weight,point , Rank() over(order by point desc) as 'ranking' from karbar order by point desc";  
     SqlCommand cmd = new SqlCommand(sSQL, con);
     SqlDataAdapter adapt = new SqlDataAdapter(cmd);
     DataSet ds = new DataSet();
     adapt.Fill(ds);
     foreach (DataRow myRow in ds.Tables[0].Rows)
     {
         if (Convert.ToInt32(myRow["ranking"]) == 1)

         { return "price/con1.png"; }
         else return "price/con2.png";
     }

     }

and its html

  <div class="innerTitle">
                <img style="width:55px;height:55px" alt=""  src="<%# getimg() %>" />     </div>
                  <div class="innerContent" style=" width: 391px; direction:rtl ">
  • 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-08T23:23:50+00:00Added an answer on June 8, 2026 at 11:23 pm

    Hello you can try with this answer

    1 Modify your function

    public string getimg(int indexRow)
    { 
    }
    

    2 Add this selection code

      if (Convert.ToInt32(myRow["ranking"]) == 1 
             && Convert.ToInt32(myRow["yourIndex"]) == indexRow ) //in order to select nice row
      {  
         return "price/con1.png"; 
      }
    
      return "price/con2.png";   
    

    3 in your call you must have your index Row printed in your page, in order to select

    img style="width:55px;height:55px" alt=""  src="<%# getimg(1) %>" />  //getimg(1) print first row.   
    

    4 Get you index

    input type="hidden" runat="server" id="test" value="<%# DataBinder.Eval(Container.DataItem, "YourIndex") />%>" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DropDownList inside a repeater control in an ASP.NET page that has
I have a Flex repeater that has a complex item template. When a checkbox
I have a repeater for different updates identified by Update_ID. Each Update_ID has a
I have a login page that has 2 tags that have a background image
I have a repeater that has a LinkButton in one of its columns and
I have a UITableViewController that has a background image. I am setting the image
I have a product page that has image thumbnails and links bellow for front
I have a repeater that has an OnItemDataBound event on it. For some reason
I have a repeater that has a text box and when I enter edit
I have a repeater with which I want to use to show a user

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.