332

 public class ColumnTemplate : ITemplate
    {
        string columnName = "/";
        public ColumnTemplate(string colname)
        {
            columnName = colname;
        }

        public void InstantiateIn(Control container)
        {
            LiteralControl l = new LiteralControl();
            l.ID = "topicname";
            l.Text = columnName;
            l.DataBinding += new EventHandler(this.OnDataBinding);
            container.Controls.Add(l);
        }
        //



 

        public void OnDataBinding(object sender, EventArgs e)
        {
            LiteralControl l = (LiteralControl)sender;
            GridViewRowcontainer = (GridViewRow)l.NamingContainer;   //update TAG
            l.Text = ((DataRowView)container.DataItem)[columnName].ToString();
        }



 

    }

你可能感兴趣的:(332)