ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Photo Upload from Grid
Title:
B
I
{code}
?
Will the photo upload like in prodinner work when used for a grid ? I have a grid where you click "change picture" button on a row, and a popup opens and in the popup you upload a new picture, crop it, click save, close the popup, and the problem is that the rows doesn't update. How should that demo code be updated for a grid instead of ajaxlist ?
Save Changes
Cancel
Stephan Luis
asked at 12 Sep 2018
Answers
B
I
{code}
?
add a `gridId` parameter to the `changePicture` popup @(Html.Awe().InitPopup() .Name("changePicture") .Url(Url.Action("ChangePicture")) .Parameter("gridId", "mealsg")) in `ProGridUtils.cs` add this method: public static string ChangePictureFormat(string popupName) { return "<button type='button' class='awe-btn editbtn' onclick=\"awe.open('" + popupName + "', { params:{ id: .Id } })\">" + Mui.change_picture + "</button>"; } and use it in the button column: new Column { ClientFormat = Html.EditFormatForGrid("mealsg"), Width = 55 }, in the controller add it to the viewdata: public ActionResult ChangePicture(int id, string gridId) { ViewData["gridId"] = gridId; in the `changepicture` view use it to update the grid like this: @{ var gridId = ViewData["gridId"] as string; } ... <script type="text/javascript"> var grid = '@gridId'; ... var id = $('#id').val(); $('#currentPicture').closest('.awe-popup').one('aweclose', function () { if (picChanged) { utils.itemEdited(grid)({ id: id }); } });
Save Changes
Cancel
Omu
answered at 13 Sep 2018
Have a problem updating the picture a second time after a row update. When I click the button the parameter values are not in place. Works fine after the whole grid is refreshed. In my grid I'm using the escaped html code for a button new Column { ClientFormat = "<button type=\"button\" class=\"fa fa-camera\" onclick=\"awe.open(\'ChangePictureItem\', { params:{ id: \'.(ItemId)\', type: \'.(TypeForItem)\'}})\">" }
at 14 Sep 2018
Stephan Luis
Which rendered buttons with the values of ItemId and TypeForItem from the Json from the server ONLY on (whole) grid load, but it's not providing a value for TypeForItem on the single row update. Id value is provided on row update. Any idea how to fix? Using version 4, so for the time being stuck without awe.button with .params . . Secondly, maybe, you could recommend code for the photo button ? Thx.
at 14 Sep 2018
Stephan Luis
edited the answer to add more details, it is working in the latest prodinner, with latest version of awesome (5.5)
at 14 Sep 2018
Omu
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK