JellyRekt
JellyRekt
CC#
Created by wildbush on 10/28/2024 in #help
Dont know how to pass an image source into a style
I found a highly upvoted answer on Stack Overflow
6 replies
CC#
Created by wildbush on 10/28/2024 in #help
Dont know how to pass an image source into a style
What does the internet say? Have you found any examples?
6 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Are you trying to insert a new record in both the main table and the table that column13id references?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
column13id is a reference to another table, right?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Oh! You're trying to use incrementing IDs? You need to insert the next highest number as the primary key?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
>2 things, I have a value from the current table, but the insert statement is asking for the new value. So if current value is 3, now it needs to be 4 when inserted to db I'm not sure what you mean here. What value do you have and what are you trying to insert?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Gonna take lunch but I'll check back in another hour or so
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
I'm pretty confident that will get your values all coming through to the model. When you submit a vanilla HTML form, the default handler maps the form controls automatically to a JSON object, but when you use ajax, you have to describe the body explicitly.
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Gotcha. In that case I would continue adding the fields you need to the data object.
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
You mean you want a script that can automatically create the object from the values in the form without having to map them individually?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
I'll see if I can find an example I've written that I can show you
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Ah! data is the body of the request, in javascript object form. It should look like
data: {
PrimaryID1: $("Select_Staff_Dropdown").val(),
ForeignKeyID: $("foreignkey_dropdown").val(),
// Other fields
}
data: {
PrimaryID1: $("Select_Staff_Dropdown").val(),
ForeignKeyID: $("foreignkey_dropdown").val(),
// Other fields
}
Basically, for each property you're trying to add to the model, this is where you map it from the values currently in the form.
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
PrimaryID1 is the only thing working?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
What are grid and items?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Your ajax looked fine to me when I glanced over it, but I'll check again
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Interesting, I must be wrong then! I've had a similar problem before and that was how I figured out what was going on. We're looking for the key that is NOT going through, though, which is the one that is set to zero in the Model that's passed to the create action.
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
See how it says name="x.PrimaryID1"? It should be PrimaryID1, no x. Right now your request body is going to look like
{
"x.PrimaryID1": <integer>,
// other properties
}
{
"x.PrimaryID1": <integer>,
// other properties
}
So there's probably a problem with how the form element is being generated. I'll have to look back at your code again
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
No worries! If it's a web page, likely it's using the "name" property of the form control as a key in the request body. If you right click that dropdown and inspect element, you should be able to see what the "name" is in the HTML that's rendering. You'll want to verify that it matches the property on the model to which you're expecting it to map, but I don't think casing matters.
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Is it a web page in the browser?
123 replies
CC#
Created by Adrian10777 on 10/4/2024 in #help
Need help connecting AJAX to Controller to DAL
Or rather you say there is no form and it's just JSON
123 replies