There are two ways. 1. Have a hidden field in the page and set the value of that field as $("#hiddendfield").val($("#ddlProjectsID option:selected").text()); You need to this on OnChange event of the dropdown. after that call the form submit method. it will be better if you use $.ajax of the jquery for submission. Then in by using formcollection you can get the value of that hidden field in the controller. 2. have the list again in the controller and fire a query in that list against the id selected. now you have the selected item and you can get the display text
mr priyank
Posts
-
how to get selected item text in razor dropdownlist. -
DataTable: Query a programmatically generated DataTableYou can use Linq Or Lamda Expression to form such query
DataTable dt = new DataTable();
dt.Columns.Add("ID"); dt.Columns.Add("Rate"); dt.Rows.Add("1", "10"); dt.Rows.Add("1", "20"); dt.Rows.Add("2", "30"); dt.Rows.Add("2", "40"); var result = dt.AsEnumerable().GroupBy(row => row\["ID"\]).Select(GroupedRows => new { ID = GroupedRows.Key, SumOfRate = GroupedRows.Sum(row => Convert.ToDecimal(row\["Rate"\])) }).ToList();
-
linqlinq is a language feature of c#(.net language) that enables you to fire query over any collection such as array. Ex
int[] numArray = { 1, 2, 3, 4, 5, 6, 7 };
var query = from num in numArray where num > 5 select num; var filteredArray = query.ToArray(); foreach (var item in filteredArray) { MessageBox.Show(item.ToString()); }
//MessageBox will appear twice with value 6 and 7 //the query is a linq query
-
I Propose We Rename \ and /considering the directions. the names could be. North West (NW) Slash or South East(SE) Slash for \ North East (NE) Slash or South West(SW) Slash for / There is no confusion now. From the suggested name we can know the direction and find the correct slash.
-
ASP.NET MVC: For Those Who Dislike ReusabilityMvc resusable controles are not dependent on ajax. Use uihint attribute over the property on which the control is to be rendered. In uihint pass the partial view name. In view page use editorfor to render that property. The partial view will be rendered automaticaly. The property will act as model to that partial view so make sure the datatype of the property and the model of the view is same.
-
OK, my brain is not working well this morning, can't think why!be easier to deal with