Monday, April 19, 2021

Asign Class with Class Name in Razor

Asign Class with Class Name in Razor

or Show Class with Class Name in Razor

or show Class Attribute with Class Name in Razor

@(i==0?"class=active":"")

Index in foreach loop

 1.  Index in foreach loop in c#


foreach ((var item, Int32 i) in data_banner.Select((value, i) => (value, i)))

{

    Console.WriteLine("I am at index" + i + " and I can find the value on val : " + item.Heading_Name);

}


 2.  Index in foreach loop in razor


@foreach ((var item, Int32 i) in data_banner.Select((value, i) => (value, i)))

{

    Console.WriteLine("I am at index" + i + " and I can find the value on val : " + item.Heading_Name);

}


Sunday, April 18, 2021

Java Script Event fire

 1. javascript event fire or Java Script Click Event fire, 


var tbl_item_detail_go = document.getElementById("tbl_item_detail_go");
        tbl_item_detail_go.addEventListener("click",function(){
                document.getElementById("tbl_item_detail").focus();
                window.scrollTo(0window.innerHeight);
        })

Saturday, April 17, 2021

Important Url

1. Fontawesome or font awesome or font owesome

https://fontawesome.com/v4.7.0/icons/


2. html graph or svg graph or canvas graph, js graph

https://www.rgraph.net/demos/bar-adjustable.html


Tuesday, April 13, 2021

Array List in C# Mvc

1.  

var list = new List<Tuple<double, double>>();            

            for (int i = 0; i < 5; i++)

            {

                list.Add(new Tuple<double, double>(i, i * 3));                

            }

            foreach (var item in list)

            {

                double dd = item.Item1;

                double dd2 = item.Item2;

            }

Sunday, April 11, 2021

ActionResult return view with another controller in mvc

*. Return view with another folder

*. Return view with another conroller


 return View("~/Views/Home/invoice.cshtml", model_name); 



using Newtonsoft.Json; 

class aa{

public async Task<string> fill_mail_message(Order_Status_Meta d)

        {

            var list =  await (from x in db.v_Order_Status

                                        where x.Odr_St_Code == d.Odr_St_Code

                                        select x).ToListAsync();

            return JsonConvert.SerializeObject(list);

        }

}


Ajax Post or Ajax Get

1. $.ajax({ type: "POST", url: "/Atrb_SubCategory/Create2", data: { Sub_Name: $("#Sub_Name").val(), Sort: $("#Sort").val() }, success: function (data) { //alert(data); var jsonObj = JSON.parse(data); $("#ctrl_code").html(jsonObj[0].Sub_Code); }, error: function (data) { alert("error : " + data); }, failed: function (data) { alert("failed : " + data); } });

Area in Action or Area in ActionLink

 @Url.Action("{action}", "{controller}", new { Area = "areaname" });


@Html.ActionLink("LinkName", "{action}", "{controller}", new { area = "{areaname}"}, 
new { @class = "btn btn-cool" })

Linq Expression syntax for where condtion in linq

(Expression<Func<T, bool>> filter)