We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bind multiple LinearGauges to model

Thread ID:

Created:

Updated:

Platform:

Replies:

145504 Jun 25,2019 10:09 PM UTC Jun 26,2019 09:50 AM UTC ASP.NET MVC 1
loading
Tags: LinearGauge
Matthew
Asked On June 25, 2019 10:09 PM UTC

Is it possible to bind an arbitrary number of linear gauges to an MVC model or viewbag? And are there any sorts of examples?

I would ideally like to create cards inside a foreach of my model. I am having some difficulty making progress on this front.

Many thanks in advance,
Matthew

Baby Palanidurai [Syncfusion]
Replied On June 26, 2019 09:50 AM UTC

Hi Matthew, 

Greetings from Syncfusion. 

We have analyzed your query. We have prepared a sample based on your requirement. In that sample, we have rendered multiple linear gauges based on the length of data collection that is from controller page.  
Please find the below code snippet to achieve this requirement, 
Controller.cs            
          DataTable dt = new DataTable(); 
            dt.Columns.Add("Name"); 
            dt.Columns.Add("FullName"); 
            dt.Columns.Add("Stock"); 
            dt.Columns.Add("MaxStock"); 
            dt.Columns.Add("AvailableStock"); 
            dt.Rows.Add(new Object[] { "T13", "PM01 T13", 1, 100, 34 }); 
              .. . // Add more data 
 
            List<LinearData> gauges = new List<LinearData>(); 
 
            foreach (DataRow row in dt.Rows) 
                gauges.Add(CreateLinearGauge(row)); 
 
            ViewBag.GaugeData = gauges; 
 
.CSHTML 
 
 
@{ 
            var count = 0; 
            foreach (LinearData gauge in ViewBag.GaugeData) 
            { 
                @(Html.EJ().LinearGauge("PointerGauge" + (++count)) 
                 ) 
            } 
        } 


If you are still facing any issues, kindly revert us with modify the above sample or provide more information about your requirement which will be helpful in furthermore analysis and provide you the solution sooner. 

Regards, 
Baby. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon