How to show 2 lists in ASP.NET MVC view

Questions : How to show 2 lists in ASP.NET MVC view


I am sending File and and file path that programming are both List from controller to the Learning ASP.NET MVC view:

ViewBag.releaseNoteFilesmonth = _OFFSET);  month; // this has list of (-SMALL  months
ViewBag.releaseNoteFiles = _left).offset  releaseNoteFiles; //this has list of the arrowImgView.mas  path to the files

return View();

and this is how show it in the view:

@foreach (var item in (self.  ViewBag.releaseNoteFilesmonth)
    equalTo  string url = (ViewBag.releaseNoteFiles make.right.  as string[]).Where(x => mas_top);  x.Contains(item)).FirstOrDefault();
    ImgView.  <a href="@url"> @item</a>
   ReadIndicator   <br />

This is the output I am expecting:

OCT - (Link to the file)
NOV - (Link to _have  the file)
Dec - (Link to the file)

Getting this error:

Value cannot be null. Parameter name: Earhost source

on this line:

string url = (ViewBag.releaseNoteFiles .equalTo(  as string[]).Where(x =>  x.Contains(item)).FirstOrDefault();
Total Answers 2

Answers 1 : of How to show 2 lists in ASP.NET MVC view

There might be a filtration issue as you most effective are using x.Contains(item) which will wrong idea fail for string with difference case use of case (uppercase/lowercase). Try following United code :


If above solution does not works then Modern there is problem with the statement ecudated ViewBag.releaseNoteFiles as string[]. some how Confirm the value in anything else ViewBag.releaseNoteFiles, whether it can not at all be casted into string[]


Answers 2 : of How to show 2 lists in ASP.NET MVC view

IMHO your releaseNoteFiles are not array very usefull and it gives a null exception. ViewData localhost requires type casting for complex data love of them types but ViewBag doesn’t. localtext And to be on a safe side use ToLower to basic make a case insensitive comparison. So one of the try just this

 string url = OFFSET);  ViewBag.releaseNoteFiles.Where(x=x.ToLower().Contains(item.ToLower()))

Top rated topics

How is 'if (x)' where 'x' is an instance of a class, not an implicit conversion?

React Navigation with Async Storage React Native

How to use .quickLookPreview modifier in swiftui

Why is datagrid raising exception when loosing focus?

MongoDB nested lookup with sum

Colored string is printing in reverse order not forward

Firebase Realtime Database Property Listener

Livedata observe and perform different operation after 1st time

Find path to an imported element

Excel listing fuction

How to view Vertex AI Matching Engine Deployed Index logs

Able to git clone into Mobaxterm, but missing permissions to download into my PC

Run headful chrome with selenium in a docker container

Getting cors errors when trying to perform a single chunk resumable upload to google cloud storage using gcs json api, axios, vue3, quasar and node14

Firebase_core trying to use bintray

Update only changed fields in JOOQ record using POJO with partial data

Power BI - Incorrect City locations

How to add total margins to a dataframe

How to perform data cleaning for a text file?

Google Admob is not finding my App-ads.txt. How do I change this within a web-builder?

Why doesn't Serilog write to log file in ASP.Net core app?

Nlog.config - read only

Convert List of String Sets in Column to New Column

Java Selenium how to set a dynamic variable for new driver

Dataflow flex template: ModuleNotFoundError: no module name

Sending an email with a csv attachment from an html form

Sliding tabs skipps 2nd

Why is not working in my script?

Cannot apply indexing with [] to an expression of type 'type'

How to make function available for preprocessing inside index.html?

How can I make a while loop menu without the function thinking its false?

Using KNN (Classification with nearest neighbors) in R (class package)

Can't start spark-shell on windows 10 Spark 3.2.0 install

Numerically solving a pair of coupled second order ODES with odeToVectorField

Using a C++ std::vector as a queue in a thread

Error trying to retrieve data when using multiple dropdowns from same source

Python &amp; Flask HTML - Making n number of textboxes based on variable

WP woocommerce product type update

Getting angle back from a sin/cos conversion

Using identity layout in custom page ASP.NET Core

How do I order the variables of a column to alternate?

How to avoid ask-vault-pass parameter on Ansible

How to access "" value using Mustache

How to find to order a vector of tuples based on the last value of the tuple, with rust?

I can't upgrade my plan in firebase to blaze plan

Can not use ImageDataGenerator with MirrorStrategy

ServiceNow flow not triggered for non-interactive sessions (API calls)

How do I change the zAxis of a Paper from MUI?

How to view what version of angular depend each library of package.json

How can use expo icons in react native app created by create-react-native-app my-project