Hi
I have below code & how i can get particular Column values in each row while looping. For e.g Student Mobile No etc
List
Thanks
Hi
I have below code & how i can get particular Column values in each row while looping. For e.g Student Mobile No etc
List
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishvjit ShindeRank #3,119 · 459 reputationPosted Oct 4, 2022, 3:13 AM EDT
var values = (from t in dt.AsEnumarable() // dt is your data table select t[ColumnName]).ToList().ForEach(your expression ); or try normal way foreach(DataRow drow in dt.Rows) { string value = drow[columnname].ToString(); }Vishal JoshiRank #377 · 6.7K reputationPosted Oct 4, 2022, 12:48 AM EDT
Hello
You can try the below LINQ query to pass a particular column cell value to each rows cell
var objStudent = students.Where(t=> t.ID == Id && t.Name != null).Select(x => new Student { ID = x.ID, Name = x.Name, MobileNo = "XXXXX-XXXXX" });