|
Hello can anyone help me with this? i am trying to make a carousel with bootstrap, and i am using images from my db, but as you can see in the picture, both images are showing at the same time with no consideration to the carousel, any ideas how i can fix this? the code looks like this.
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
@for (int i = 0; i < Model.car.Images.Count; i++)
{
if (i == 0)
{
<li data-target="#carouselExampleIndicators" data-slide-to="@i" class="active"></li>
}
<li data-target="#carouselExampleIndicators" data-slide-to="@i"></li>
}
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
@if (Model.car.Images != null)
{
@foreach (var i in Model.car.Images)
{
<img class="img-fluid" src="~/Images/Cars/@i.Filename" alt="First slide">
}
}
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
Previous
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
Next
</a>
</div>
|
|
|
|
|
Look at the HTML in the documentation[^]:
<div class="carousel-inner">
<div class="carousel-item active">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
</div> Now look at the HTML your page is generating:
<div class="carousel-inner">
<div class="carousel-item active">
<img class="img-fluid" src="..." alt="First slide">
<img class="img-fluid" src="..." alt="First slide">
<img class="img-fluid" src="..." alt="First slide">
</div>
</div> You need to move the carousel-item tag inside your item loop, and move the item loop outside of the indicators loop.
There's also no point checking whether Model.car.Images is null - if it was, your view would have crashed on the indicators loop above.
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
@for (int i = 0; i < Model.car.Images.Count; i++)
{
string cssClass = i == 0 ? "active" : null;
<li data-target="#carouselExampleIndicators" data-slide-to="@i" class="@cssClass"></li>
}
</ol>
<div class="carousel-inner">
@for (int i = 0; i < Model.car.Images.Count; i++)
{
string fileName = Model.car.Images[i].Filename;
string cssClass = i == 0 ? "carousel-item active" : "carousel-item";
<div class="@cssClass">
<img class="img-fluid" src="~/Images/Cars/@fileName" alt="">
</div>
}
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
</div>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you, but if the car.Image is a ICollection? how would
string fileName = Model.car.Images[i].Filename; look like then? because then it doesnt take indexes.
|
|
|
|
|
The simplest solution would be to make it an IList<T> .
If you can't do that, you'll need to find another way to track whether you're rendering the first item. For example, using LINQ and a value tuple:
<div class="carousel-inner">
@foreach ((var img, int index) in Model.car.Images.Select((img, index) => (img, index)))
{
string fileName = img.Filename;
string cssClass = index == 0 ? "carousel-item active" : "carousel-item";
<div class="@cssClass">
<img class="img-fluid" src="~/Images/Cars/@fileName" alt="">
</div>
}
</div> Enumerable.Select Method (System.Linq) | Microsoft Docs[^]
C# 7 Series, Part 1: Value Tuples – Mark Zhou's Tech Blog[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks that worked thanks for your help!
|
|
|
|
|
|
provide me with a solution
|
|
|
|
|
The title of your question describes the problem exactly. You have not provided a required parameter in your SQL statement.
|
|
|
|
|
As Richard mentioned, this is very easy to fix but since you didn't post any of your code I'm not sure what more you want us to do. Review your code and make sure you're adding all the necessary parameters.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
My Visual Studio 2017 community is opening my React-Redux Application with tsx files by default when I am opening new Project, is there anyway to open it with .jsx files instead? This is for my learning at home, not understanding how can I make jsx files as default for the React Redux template? Am I missing something? Any help please?
|
|
|
|
|
Because according to this Github complaint or issue, TSX is the official extension to be used for today's React Projects as of 2018. They say that JSX is not a language, but rather psueto code.
Makes sense to me. I remember going to a training center to recruit entry level programmers and one of the advanced speakers that night did a presentation on React, and I was surprised that React wasn't using TypeScript. In fact none of these new programmers have never even heard of TypeScript. So if React finally went TypeScript than I applaud it. Perhaps Nathan has a better explanation for this.
TSX files are identified as TypeScript rather than JSX+TS · Issue #4359 · github/linguist · GitHub
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
IDK about this but most of the clients and even Developers are using jsx, its just unfortunate how things are going - to confuse the developers more. Even though ts and jsx work same way behind the wheels at least there is learning curve added on the developers side which makes their life more uneasy anyways no complains about industry, we have to survive in it .
|
|
|
|
|
For me at least, when I soon transition over to React next year from Angular, I can concentrate on writing TypeScript so that makes it easier for me since I have 18 months in on it currently. I wasn't looking forward to writing in something else for React.
I totally get your position. When I started writing Angular, it was called AngularJs, and was completely different. But AngularJs allowed the developer to use an AngularJs object on a single page within a project of say Razor pages. Just like the first version of React that I learned in which I could create a single React object and embed it on a Razor page. And I thought that was so cool to be able to do!
Give it a couple of months and you'll see how superior TypeScript is. TypeScript is evolving as well and getting much better. It's almost like using c# in VS2017 as far as intellisense goes.
And next on your Radar is Vue. Suppose to be way easier to learn.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I understand if they are releasing Technologies like Angular, React, Vue or even something else because they give better features, but at least languages could have been consistent within VS at least, but its OK we have to learn to fill our bellies
|
|
|
|
|
please reinstall Visual Studio 2017 and check again.
|
|
|
|
|
Thank you very much buddy
|
|
|
|
|
Nothing I've read about this error seems to be the problem, because the problem is not the code. My co-worker created a solution in Visual Studio 2019 that has a web application and a WCF web service. He had it working on his machine, then he put it into our source repository. I checked it out of the source repository and made NO CHANGES to it. When I tried to update/configure the service reference with the address on my machine, I got the above-mentioned error message.
We're thinking it must be some option or setting in Visual Studio 2019 that is different on our machines. We both have .Net Framework 4.8.
Can anyone help?
|
|
|
|
|
The difference in the data that you are sending to the service. Service is expecting text/xml, but you are sending over a SOAP based message. Check if sending a plain XML document works in this case.
Since we do not have the access to the code, there is not much that we can do to help you here. See this maybe, wcf - Content Type application/soap+xml; charset=utf-8 was not supported by service - Stack Overflow
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
After a lot of digging, we found that the problem apparently was in the code, after all. When I checked the solution back into source, and my co-worker checked it out, he then received the same error message as I received. We don't really know why his worked initially, because we had compared our web.config files, and they looked the same.
We were finally able to resolve this by adding
behaviorConfiguration="serviceBehavior"
to the service item in the web.config.
Thank you for your response.
|
|
|
|
|
hi everybody here, I have requirement, in the following way, i have some button or link, when its clicked it opens a new Window, i want to pass some values or (maybe state) from parent window to child window like user id, user name etc (just user id is also enough), in the child window user enters values and clicks on the submit button, what i want is
1. either the data from the child window to be posted along with the user id information, then the components like grid, dropdown, textbox etc in the main window refresh with the newly entered values without page flickering
2. or all those values to be transferred to the main window to refresh with new values, and main window submit button submit those values.
Anybody please give me an example for it or is there any better approach for it than React iFrames, any help - thanks in advance.
|
|
|
|
|
Any given div-based modal would be better than that. I'd be hard pressed to give a good reason to use an iFrame in HTML5 that wouldn't be better served by another approach.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Since you mention react, react modal could be one option. If not, then bootstrap too provides a modal dialog.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
iFrames are old school, outdated and are not really PCI compliant in my opinion. They can be hijacked and used for other purposes.
I would just use a modal window, in whatever responsive framework you have chosen.
Write a click function and pass the userId in HTML5, then use that Id to select the record and use the same function to populate the modal display fields and show the modal.
Something like
<button (click)="userInfo(model.userId);"></button>
userInfo(userId: string): void {
const user = getUser(userId);
modalUserInfo.show();
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
Is there any SDK or API available to integrate with CISCO IP Phones.
The idea is to make a call out to the user's CISCO IP phone from an Incident management system. So the call will be initiated from the application instead of phone. then the users should hear the text passed along with the call as voice message.
Is there any way or any samples to do in ASP .Net ?
|
|
|
|