protected void showMembers(Boolean filtered=false) { using (var cn = GetConnection()) { cn.Open(); string cmsGetProfiles = "SELECT * FROM [Vm_siteMembers] order by [Last Login Time] desc "; SqlDataAdapter EventsAdapter = new SqlDataAdapter(cmsGetProfiles, cn); BaseMembersListDS.Clear();// this DataSet defined as public static EventsAdapter.Fill(BaseMembersListDS); using (DataSet filteredMemberListDS = new DataSet()) { filteredMemberListDS.Merge(BaseMembersListDS.Tables[0]); if (filtered) { DataTable dt = new DataTable(); dt.TableName = "filtered"; filteredMemberListDS.Clear(); foreach (var item in BaseMembersListDS.Tables[0].Columns) dt.Columns.Add(item.ToString()); foreach (DataRow dr in BaseMembersListDS.Tables[0].AsEnumerable().Take(5)) dt.ImportRow(dr); filteredMemberListDS.Tables.Add(dt); } MembersdataBind(filteredMemberListDS);//why filteredMemberListDS is empty } } } protected void MembersdataBind(DataSet filteredMemberList) { MemebersDdl.DataSource = filteredMemberList; MemebersDdl.DataBind(); }
Columns headers on datatable match by doing this foreach (var item in BaseMembersListDS.Tables[0].Columns) dt.Columns.Add(item.ToString());
filteredMemberListDS
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)