【asp源码栏目提醒】:网学会员鉴于大家对asp源码十分关注,论文会员在此为大家搜集整理了“解析ASPNET中DataList如何实现“行转列”代码 - 培训资料”一文,供大家参考学习
????·????????????????????????×????????????é????????????°??????????????SQL???????? case ??????????????????à??????????????????????±??ò??????????á??è????????????????????????×????????????????é???? ??????±????DataList ????·????????ü????×÷??????????????÷??????????????????????????ü????RepeatDirection ????????. ????????: ????????: using System using System.Data using System.Configuration using System.Collections using System.Web using System.Web.Security using System.Web.UI using System.Web.UI.WebControls using System.Web.UI.WebControls.WebParts using System.Web.UI.HtmlControls public partial class temp_DataList : System.Web.UI.Page private DataTable getDateTable DataTable dt new DataTable dt.Columns.Addnew DataColumnName typeofString dt.Columns.Addnew DataColumnMoney typeofInt32 DataRow dr dr dt.NewRow dr0 ??????????¤×?? dr1 100 dt.Rows.Adddr dr dt.NewRow dr0 ???????? dr1 200 dt.Rows.Adddr dr dt.NewRow dr0 ???????? dr1 300 dt.Rows.Adddr return dt private void DataListBindDataTable dt int column dt null dt.Rows.Count : 0 column column 6 6 : column//??ù????????????ò????????????×????à6???? dl.RepeatColumns column dl.RepeatDirection RepeatDirection.Horizontal dl.DataSource dt dl.DataBind protected void Page_Loadobject sender EventArgs e if IsPostBack ViewStatedt getDateTable DataListBindViewStatedt as DataTable protected void btnAdd_Clickobject sender EventArgs e DataTable dt ViewStatedt as DataTable if dt null DataRow dr dr dt.NewRow dr0 txtName.Text.Trim int money int.TryParsetxtMoney.Text out money dr1 money dt.Rows.Adddr DataListBinddt上一篇:IIS中使用ASP页面时出现500错误