日期:2014-05-18 浏览次数:20874 次
DataTable dt = new DataTable(); dt.Columns.Add("DetpName", typeof(string)); dt.Columns.Add("MemberName", typeof(string)); DataRow dr1 = dt.NewRow(); dr1["DetpName"] = "软体研发一部一课"; dr1["MemberName"] = "AAA"; dt.Rows.Add(dr1); DataRow dr2 = dt.NewRow(); dr2["DetpName"] = "软体研发一部一课"; dr2["MemberName"] = "BBB"; dt.Rows.Add(dr2); DataRow dr3 = dt.NewRow(); dr3["DetpName"] = "软体研发一部一课"; dr3["MemberName"] = "CCC"; dt.Rows.Add(dr3); DataRow dr4 = dt.NewRow(); dr4["DetpName"] = "软体研发一部二课"; dr4["MemberName"] = "DDD"; dt.Rows.Add(dr4); DataRow dr5 = dt.NewRow(); dr5["DetpName"] = "软体研发一部二课"; dr5["MemberName"] = "EEE"; dt.Rows.Add(dr5); DataRow dr6 = dt.NewRow(); dr6["DetpName"] = "软体研发二部一课"; dr6["MemberName"] = "FFF"; dt.Rows.Add(dr6); DataRow dr7 = dt.NewRow(); dr7["DetpName"] = "软体研发二部一课"; dr7["MemberName"] = "GGG"; dt.Rows.Add(dr7); DataRow dr8 = dt.NewRow(); dr8["DetpName"] = "软体研发三部一课"; dr8["MemberName"] = "HHH"; dt.Rows.Add(dr8); dataGridView1.DataSource = dt; DataRow[] d1 = dt.Select("DetpName='软体研发一部一课'"); DataRow[] d2 = dt.Select("DetpName='软体研发一部二课'"); DataRow[] d3 = dt.Select("DetpName='软体研发二部一课'"); DataRow[] d4 = dt.Select("DetpName='软体研发三部一课'");
------解决方案--------------------
楼主,另一边的帖子我也看了
可以肯定的告诉你,除了1楼那个mvp,其他人的回答你根本不用看,根本没理解你的意思胡乱作答。当然,你自己问问题也存在很大问题
mvp就是不一样
------解决方案--------------------
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" onrowdatabound="GridView1_RowDataBound"> <Columns> <asp:TemplateField HeaderText="序号"> <ItemTemplate> <%#Container.DataItemIndex+1 %> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="部门"> <ItemTemplate> <asp:Label ID="lblDept" runat="server" Text='<%#Eval("DetpName")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField Heade