|
Hi everybody,,
I'v installed ASP maker app to assist me in generating Web forms from database very fast .. but the problem is that it uses visual Basic as a code behind for asp pages.. does anyone know how can I make it use C#??
with VB it's unusable because can't modify the code ..
and please tell me about other useful applications..
the link of the app
ASPMaker 2018 - The Best ASP Code Generator[^]
|
|
|
|
|
You should ask this question at the ASPMaker forums.
|
|
|
|
|
Hi,
I need to draw triangle into canvas. When I research this on web, I found that we can draw shapes into canvas by using javascript, like below.
$(function () {
var canvas = document.getElementById('mycanvas');
var context = canvas.getContext('2d');
context.fillRect(30, 30, 70, 90);
});
But the problem is, when a button clicked, I need to generate shape on server side than return it back to canvas as I callback result.
Can give me an idea about it?
Thank you
|
|
|
|
|
Quote: I need to generate shape on server side than return it back to canvas as I callback result.
Then that means that you process and return the result from the server, and have the client-side JavaScript render it. One of the way we can do that would be to remove the hardcoded values,
context.fillRect(30, 30, 70, 90); Becomes,
let points = [ 30, 30, 70, 90 ];
context.fillRect(points[0], points[1], points[2], points[3]); That is definitely one of the ways in which this can be done. Once you reach this point, you can see that this same array can be returned from a server. You can use jQuery's Ajax and request the content from the server,
$.ajax({
url: '/points-generator',
success: function(data) {
context.fillRect(data[0], data[1], data[2], data[3]);
}
}); This assumes that you change your context variable to be a global variable so that it can be accessed from almost every function. Then, you can request the data from server using Ajax, and then render the data.
Read more on the MDN documentation for context and study the parameter-lists, and then generate the proper responses for your requests.
CanvasRenderingContext2D - Web APIs | MDN
jQuery.ajax() | jQuery API Documentation
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thanks all for the answers.
I generated objects (points) in controller class and returned points back from server.
I have a question drawing right angle triangle.
I generated a and b sides and calculated hypotenuse. But using canvas, I draw a and b sides and use closePath() function to draw line from a to b. Looks like hypotenuse value is useless. How can I draw hypotenuse without closePath() function?
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(20, 20);
ctx.lineTo(20, response.sideB);
ctx.lineTo(response.sideA, response.sideB);
ctx.closePath();
|
|
|
|
|
As far as I know, when you want to draw an object and place them on a canvas to save as an image, you use System.Drawing on the server side.
When you want to draw a shape directly on a web page, you can use CSS to draw and animate.
You can also use the canvas web API to draw shapes as well.
So search for System.Drawing, Draw Triangle.
There are hundreds of examples available online.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hello, in my details view model I want to make a LINQ that shows 4 related car to the current car by manufacturer and price, but I don't get it to work really, can someone please helpme? The view model looks like this.
public class DetailsViewModel
{
public BolindersContext ctx;
public Car car;
public Car currentCar;
public DetailsViewModel(BolindersContext ctx)
{
this.ctx = ctx;
}
public DetailsViewModel(BolindersContext ctx, Car car)
{
this.ctx = ctx;
this.car = car;
this.currentCar = car;
}
IQueryable<Car> PriceyCars(BolindersContext ctx, Car currentCar)
{
return ctx.Cars.Where(e => e.Brand == car.Brand).Where(e => e.Price > car.Price).OrderBy(e => e.Price).Take(4);
}
|
|
|
|
|
I would imagine that you just need to change car to currentCar
IQueryable<Car> PriceyCars(BolindersContext ctx, Car currentCar)
{
return ctx.Cars.Where(e => e.Brand == currentCar.Brand).Where(e => e.Price > currentCar.Price).OrderBy(e => e.Price).Take(4);
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
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?
|
|
|
|