Automatically generate ID based on ejs-for Attribute

In the stock tag helpers that ship with .Net Core, if you specify the "asp-for" attribute you do not need to specify an Id for the tag. The Razor framework will generate it for you.

E.g., this tag helper:

<input asp-for="@joe">

will generate this:

<input type="text" id="joe" name="joe" value="Joe">


Is it possible to do the same for the ejs-for attribute so we don't need to explicitly add the ID?

Thanks

17 Replies

VR Vairamuthu Ramamoorthi Syncfusion Team February 14, 2020 12:22 PM UTC

Hi Daniel, 

Thank you for contacting Syncfusion Support. 

We have checked your reported query and the ‘id’ attribute is required for rendering our Syncfusion EJ2 Asp Core components. However, we considered this requirement “Auto ID generation for our Form components based on ‘ejs-for’ attribute” as an improvement task and it’ll will be available in our upcoming Essential Studio 2020 Volume 1 release which is expected to be rolled-out in the end of March, 2020. We appreciate your patience until then.  

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this feedback.   

Regards, 
Vairamuthu R 



SM Saranya Murugasamy Syncfusion Team April 8, 2020 03:24 PM UTC

Hi Daniel, 

Sorry for the inconvenience. 

We will complete the improvement task “Auto ID generation for our Form components based on ‘ejs-for’ attribute” and include this in our upcoming second patch release and we will update the further details once the feature is included. 

Regards, 
Saranya M 



DH Daniel Hulse April 8, 2020 03:47 PM UTC

Thank you for letting me know.


SM Saranya Murugasamy Syncfusion Team April 9, 2020 05:59 AM UTC

Hi Daniel, 

Most welcome. 

We will update you once the feature is included in our upcoming patch release. 

Regards, 
Saranya M 



RS Robert Saddler March 31, 2021 12:29 PM UTC

Hi,

This still does not happen on the latest version released yesterday (30th March 2021) and is a real pain.  I couldn't figure out for ages why none of the ejs controls would render properly and it was because I hadn't specified an ID.  It doesn't even mention this in the documentation so is a real gotcha for anyone used to working with tag helpers that use asp-for.

Can we get an update on this please?  Can you at least get the documentation improved to reflect this, perhaps in the "Getting Started" section.

Thanks,
Rob.


MK Muthukumar Kannan Syncfusion Team April 9, 2021 11:20 AM UTC

Hi Robert, 

Sorry for the inconvenience caused. 

We have completed this support for ‘Auto ID generation for our Form components based on ‘ejs-for’ attribute’ and currently, ensuring this against our Components. However, it will be available in live from our upcoming weekly patch release which is scheduled on April 13th, 2021 without further delay. Until then we appreciate your patience. 

Please let us know if you have any queries.  

Regards, 
Muthukumar K 



MK Muthukumar Kannan Syncfusion Team April 13, 2021 11:39 AM UTC

Hi Robert / Daniel, 

Thanks for your patience. 

We want to let you know that our weekly patch for this week has been released today with the support for your reported query “Auto ID generation for our Form components based on ‘ejs-for’ attribute” and included in this release and available in live. So, could you please check your reported query with this latest package once again and ensure it? 



Please get back to us if you have any concerns. 

Regards, 
Muthukumar K 



RS Robert Saddler April 28, 2021 02:19 PM UTC

Hi Muthukumar,

This works most of the time as expected but there is still a bug.  I have ejs-checkboxes output in a loop like so:

 @for (int i = 0; i < Model.CheckBoxList.Count; i++)
            {
               
                   
                        label="@Model.CheckBoxList[i].Label">  
               
            }   

When I now remove id="CheckBoxList_@(i)_Active" and allow the control to auto generate the id, the HTML is fine but there is now a javascript error being thrown:

constants.js:111 Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#CheckBoxList[0]_Active' is not a valid selector.
    at G (https://cdn.syncfusion.com/ej2/dist/ej2.min.js:10:9605)
    at t.appendTo (https://cdn.syncfusion.com/ej2/dist/ej2.min.js:10:606796)

As you can see, the queryselector code has a bug as it is is searching for #CheckBoxList[0]_Active rather than #CheckBoxList_0_Active.

Please advise.

Rob.


MK Muthukumar Kannan Syncfusion Team May 3, 2021 02:08 PM UTC

Hi Robert, 

Sorry for the delay. 

Currently, we are checking your reported issue in specific case for facing issue while render the components using loop without ID and name attribute. However, we will update the further validation details and information on May 5th, 2021. Until then we appreciate your patience. 

Please let us know if you have any concerns. 

Regards, 
Muthukumar K 



RS Robert Saddler May 10, 2021 10:04 AM UTC

It is May 10th and still no reply?


MK Muthukumar Kannan Syncfusion Team May 12, 2021 03:00 PM UTC

Hi Robert, 

We are sorry for the delay in getting back to you. 

Based on your provided information, we can reproduce your reported issue with for-loop while ‘for’ model binding from list collection and we have considered this as a bug with the provided support. We have logged the defect report for this issue and created the feedback at our end. The fix for this issue will be available and included in our 2nd weekly patch release after the Volume 1 2021 SP1 release which is expected to be available on May 25th, 2021. 
 
 
We will update you once released, and we appreciate your patience until then. 

Regards, 
Muthukumar K 



MK Muthukumar Kannan Syncfusion Team May 25, 2021 09:59 AM UTC

Hi Robert, 

Sorry for the inconvenience caused. 

As we promised, we could not able to include the fix for issue with for-loop while ‘for’ model binding from list collection due to complexity we have faced. So, we need time check this and include this from our end. However, we will include this in our upcoming weekly patch release on June 1st , 2021. Until then we appreciate your patience. 

Please get back to us if you have any concerns. 

Regards, 
Muthukumar K 



MK Muthukumar Kannan Syncfusion Team June 1, 2021 01:45 PM UTC

Hi Robert,   

We deeply regret the inconvenience caused.  

Still, we are not able to include the fix for the issue “for-loop while ‘for’ model binding from list collection” due to complexity we have faced. Currently, we are working on this with prioritized and will include this in our upcoming weekly patch release on June 8th, 2021 without fail. Until then we appreciate your patience.   

Please get back to us if you have any concerns.   

Regards,  
Muthukumar K 



MK Muthukumar Kannan Syncfusion Team June 9, 2021 05:02 PM UTC

Hi Robert, 

Thanks for your patience. 

Due to some unforeseen circumstances, we could not able to include the fix for the issue “for-loop while ‘for’ model binding from list collection” in the latest v19.1.0.67 weekly patch release. But we have fixed the issue and provide the custom package for your reported issue. Please find that packages from below and could you please ensure whether the reported issue was resolved or not? 


 However, this fix will be included in our upcoming weekly patch release on June 15th, 2021. We will update you once the package is released. 

Please let us know if you have any concerns. 

Regards, 
Muthukumar K 



MK Muthukumar Kannan Syncfusion Team June 15, 2021 02:40 PM UTC

Hi Robert,  

Thanks for your patience. 

We are glad to announce that our ASP.NET Core Weekly patch release (v19.1.0.69) has been rolled out successfully and in this release we have included the fix for “Script error throws with 'ejs-for' components while model binding value from list collection” issue. So kindly update your NuGet (Syncfusion.EJ2.AspNet.Core) to our latest version (19.1.0.69) to resolve the reported issue. 

Please find the Nuget package from below 




Note : In order to resolve the issue, you have to upgrade Syncfusion NuGet to 19.1.0.69. 

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 

Regards, 
Muthukumar K 



RS Robert Saddler June 23, 2021 09:08 AM UTC

The patch resolved the issue.  Many thanks.



MK Muthukumar Kannan Syncfusion Team June 23, 2021 09:25 AM UTC

Hi Robert, 

Welcome…! 

We are glad that your issue has been resolved. Please get back to us if you need any other assistance. 
 
Regards, 
Muthukumar K 


Loader.
Up arrow icon