Cannot resolve template context
I'm adding an SfComboBox to a grid column for editing. like this
<GridColumn HeaderText="Employee Image" TextAlign="TextAlign.Center" Width="120"> <Template> @{ var employee = (context as EmployeeData); <div class="image"> <img src="@($"scripts/Images/Employees/{employee.EmployeeID}.png")" alt="@employee.EmployeeID" /> </div> } </Template> </GridColumn>
I get this error : Cannot resolve symbol 'context'
You can recreate by creating a new Blazor WASM project using the SyncFusion temlate and include the DataGridFeature page. On that page paste in the code from your example here: https://blazor.syncfusion.com/documentation/datagrid/templates/. Change EmployeeData to Order and remove the IMG tag, and the only error left is the one about context.
SIGN IN To post a reply.
4 Replies
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
June 3, 2020 04:43 AM UTC
Hi Bradley,
Thanks for contacting Syncfusion support.
Query: “ If your engineer generates the default Grid sample and pastes in this grid, he should get the same error ”
As per your suggestion we have prepared a sample with Syncfusion template studio and WebAssembly sample. We are not able to reproduce the reported issue at our end. Kindly download the sample from below
After referring the sample, if you are still facing the issue. Kindly share the following details.
- Share the Syncfusion Nuget package version.
- Share the details about the exception with full stack trace.
- If possible try to reproduce the reported issue in provided sample or share the issue reproducible sample.
- Also ensure the run the sample by clear the browser cache, deleting the bin and obj folder and Nuget cache.
Requested details will be helpful for us to validate the reported issue at our end and provide solution as early as possible.
Regards,
Vignesh Natarajan
Marked as answer
BI
Bradley Irby
June 3, 2020 09:08 AM UTC
Thanks for looking into this. It turns out this is a problem with ReSharper. The solution you sent still had the same problem of claiming the context could not be resolved, yet the project compiled and ran successfully. I turned off ReSharper and the error in the UI is gone.
BI
Bradley Irby
June 3, 2020 09:32 AM UTC
For anyone else with this problem, Resharper 2020.1.3 fixes this
VN
Vignesh Natarajan
Syncfusion Team
June 4, 2020 03:23 AM UTC
Hi Bradley,
Thanks for your solution.
We are glad to hear that you have resolved your query.
Kindly get back to us if you have further queries.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
- Marked answer
-
BI Bradley Irby
- Jun 2, 2020 12:55 PM UTC
- Jun 4, 2020 03:23 AM UTC