目标效果
实现流程图
测试用的XML文件
<?xml version="1.0" encoding="utf-8" ?> <table> <tr> <编码>A01</编码> <内容>你</内容> <M0601>1</M0601> <M0602>2</M0602> </tr> <tr> <编码>A02</编码> <内容>我</内容> <M0601>3</M0601> <M0602>4</M0602> </tr> </table> |
实现程序
<%@ Page language="c#" Codebehind="RowColumnConvert.aspx.cs" AutoEventWireup="false" Inherits="DataGridTest.RowColumnConvert" %> content="http://schemas.microsoft.com/intellisense/ie5"> style="Z-INDEX: 101; LEFT: 72px; POSITION: absolute; TOP: 48px" runat="server" Width="312px" Height="88px"> </asp:DataGrid> style="Z-INDEX: 102; LEFT: 96px; POSITION: absolute; TOP: 272px" runat="server" Width="256px" Height="144px"> </asp:DataGrid> style="Z-INDEX: 103; LEFT: 168px; POSITION: absolute; TOP: 208px" </asp:Button> POSITION: absolute; TOP: 136px" runat="server" |
/******************************************************* namespace DataGridTest #region Web 窗体设计器生成的代码 new System.EventHandler(this.Button1_Click); } private void Button1_Click(object sender, System.EventArgs e) DataConvert(ds,2,3).Tables[0].DefaultView; /// <summary> (DataSet ds,int startIndex,int endIndex) System.Type.GetType("System.String")); "'"+dtPart.Columns[startIndex].ColumnName+"'"; //定义默认值 dtPart.Columns[startIndex].ColumnName = "数量"; //修改字段名 if(dsNew.Tables.Count > 0) return dsNew; |