实现如何调整DataGrid列宽

实现如何调整DataGrid列宽_第1张图片
1.html

< HTML >
    
< HEAD >
        
< title > DragDataGrid title >
        
< meta  name ="GENERATOR"  Content ="Microsoft Visual Studio .NET 7.1" >
        
< meta  name ="CODE_LANGUAGE"  Content ="C#" >
        
< meta  name ="vs_defaultClientScript"  content ="JavaScript" >
        
< meta  name ="vs_targetSchema"  content ="http://schemas.microsoft.com/intellisense/ie5" >
        
< LINK  href ="xpTable.css"  type ="text/css"  rel ="stylesheet" >
    
HEAD >
    
< body  ms_positioning ="GridLayout" >
        
< form  id ="Form1"  method ="post"  runat ="server" >
            
< asp:DataGrid  id ="DataGrid1"  runat ="server"  Font-Size ="9pt"  CellPadding ="4"  style ="BEHAVIOR:url(draggrid.htc)"
                BorderColor
="#CC9966"  BorderStyle ="None"  BorderWidth ="1px"  BackColor ="White" >
                
< SelectedItemStyle  Font-Bold ="True"  ForeColor ="#663399"  BackColor ="#FFCC66" > SelectedItemStyle >
                
< ItemStyle  ForeColor ="#330099"  BackColor ="White" > ItemStyle >
                
< HeaderStyle  Font-Bold ="True"  ForeColor ="#FFFFCC"  BackColor ="#990000" > HeaderStyle >
                
< FooterStyle  ForeColor ="#330099"  BackColor ="#FFFFCC" > FooterStyle >
                
< PagerStyle  HorizontalAlign ="Center"  ForeColor ="#330099"  BackColor ="#FFFFCC" > PagerStyle >
            
asp:DataGrid >  
        
form >
    
body >
HTML >
2.cs
public   class  DragDataGrid : System.Web.UI.Page
    
{
        
protected System.Web.UI.WebControls.DataGrid DataGrid1;
        
private string constring="";
        
private void Page_Load(object sender, System.EventArgs e)
        
{
            
string sql="select * from testgrid";
            DataSet ds
=GetDataSet(sql);
            
this.DataGrid1.DataSource=ds;
            
this.DataGrid1.DataBind();
        }


        
GetDataSet

        
Web Form Designer generated code
    }
3.源代码下载 /Files/singlepine/draggridcol.rar
 

你可能感兴趣的:(DataGrid,datagrid,stylesheet,dataset,string,generator,sql)