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 6596487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:04:57+00:00 2026-05-25T18:04:57+00:00

i have a database table that holds the following fields: product_id | design_id |

  • 0

i have a database table that holds the following fields:

product_id | design_id | material_id | color_id | picture1 (picture name field)..

design_id, material_id and color_id are nullable fields in the database..

I am using linqtosql for it.

I have dropdownlists for the id fields. The dropdowns are in order as so:

Product>Design>Material>Color

This is an unbreakable line. (yeah, I figured how to do this)

When I choose the first dropdown item (Product list item) I want my picture to change. Then when choosing further dropdown items I want it to change again. (for example: after product is chosen when a design is chosen I want it to find the picture which matches product and design id (which can be found in the database).

So if product=1, design=0, material=0 and color=0 the picture for this situation will be displayed and if product=3, design=6, material=2 and color=9 the picture for this different situation will be displayed.

EDIT : I can now change the image but cant display on the screen only the link comes..

Here is new code:

jquery

    $.getJSON('@Url.Content("~/Admin/GetPictures/")', { productId: prod, designId: des, matsid: mats, colid: col }, function (data) {
        $.each(data, function (i, c) {
            /*$("img#res").attr("src", "../../Pictures/" + c.Text).attr("alt", "../../Pictures/" + c.Text).attr("width", "100%");*/
              $("img#res").attr({ 'src': '../../Pictures/' + c.Text, 'alt': '../../Pictures/' + c.Text, 'width': '100%' });
        })
    })
  • 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-05-25T18:04:58+00:00Added an answer on May 25, 2026 at 6:04 pm

    Found a solution for this problem :

    controller

    public JsonResult GetPictures(int productId, int? designId, int? matsid, int? colid)
    {
        int? d = 0;
        int? m = 0;
        int? c = 0;
        if (designId == null) { d = 0; } else if (designId != null) { d = designId; };
        if (matsid == null) { m = 0; } else if (matsid != null) { m = matsid;};
        if (colid == null) { c = 0; } else if (colid != null) { c = colid; };
        IEnumerable<SelectListItem> PictureItems = db.Pictures.Where(x => x.product_id == productId & x.design_id == d & x.material_id == m & x.color_id == c).AsEnumerable().Select(x => new SelectListItem()
        {
            Text = x.picture1,
            Value = x.id.ToString().TrimEnd() 
        });
        SelectList data = new SelectList(PictureItems, "Value", "Text");
        return Json(data, JsonRequestBehavior.AllowGet);
    }
    

    view

    $.getJSON('@Url.Content("~/Admin/GetPictures/")', { productId: prod, designId: des, matsid: mats, colid: col }, function (data) {
        $.each(data, function (i, c) {
            $("img#res").attr("src", "../../Pictures/" + c.Text).attr("alt", "../../Pictures/" + c.Text);
        })
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table that holds the following grade information for a student:
I have a database table with 6 fields that holds information about restaurants: id
I have a table that holds phone calls, with the following fields: ID STARTTIME
I have a database table TravelRequest that contains, amongst other things, the fields SignOffName
I have a database table that holds information for received files. One of the
I happen to have a database with a table that holds all possible combination
I have a MySql database that holds datetime in one field, in this format:
I have a table that holds the card, which is described by the following
I have a database table that holds parent and child records much like a
I have a database table that i want to allow my friends to update.

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.