Create DataGrid data column/Template column/button events manually + simple data manipulation class (asp.net)
Source: Internet
Author: User
1 Create a DataGrid data column/Template column/button action class:
Using System;
Using System.Collections;
Using System.ComponentModel;
Using System.Data;
Using System.Data.SqlClient;
Using System.Drawing;
Using System.Web;
Using System.Web.SessionState;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.HtmlControls;
Namespace WebTest
{
<summary>
Summary description of the DataGridColumn.
</summary>
public class Datagridcols
{
public void DataGridColumn ()
{
//
TODO: Add constructor logic here
//
}
public static void Createcols (System.Web.UI.WebControls.DataGrid datagrid1,string datafield,string headertext,int i)
{
BoundColumn cm=new BoundColumn ();
Cm. Datafield=datafield;
Cm. Headertext=headertext;
Cm. Headerstyle.width=i;
DATAGRID1.COLUMNS.ADD (CM);
}
public static void Createbutton (System.Web.UI.WebControls.DataGrid datagrid1,string commandname,string strText)
{
ButtonColumn bc=new ButtonColumn ();
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service