Home > SQL Development > about datagrid.columns.headertext(had source code)

about datagrid.columns.headertext(had source code)



<i><b>Originally posted by : GuoYong (chenggy@163.net)</b></i><br />Source code<br />Dim strsql As String<br />strsql = System.Configuration.ConfigurationSettings.AppSett ings("server")<br />Dim cn As New OleDbConnection(strsql)<br />cn.Open()<br />strsql = "select cu_cust_code,cu_eng_name,cu_chn_name from e_customer where cu_center_code='" & DDL2.SelectedItem.Value & "'"<br />Dim ap As New OleDbDataAdapter(strsql, cn)<br />Dim ds As New DataSet()<br />ap.Fill(ds, "e_customer")<br />DataGrid1.DataSource = ds.Tables(0).DefaultView<br />DataGrid1.ShowHeader = True<br />DataGrid1.AllowPaging = True<br />DataGrid1.PageSize = 6<br />1 DataGrid1.Columns(0).HeaderText = "Cust. Code"<br />2 DataGrid1.Columns(1).HeaderText = "English Name"<br />3 DataGrid1.Columns(2).HeaderText = "Chinese Name"<br />DataGrid1.DataBind()<br /><br />System error message<br />line 1 error<br />index out of range<br />System.ArgumentOutOfRangeException<br /><br />why?help me please

    
Guest


<i><b>Originally posted by : Mohammad Jamous (jamouss@hotmail.com)</b></i><br />hi there<br /><br />try to change the column header in the dataset instaed of grid like this<br />************************<br />objChannels.DS(0).Columns(0).ColumnName = "English Name"<br />*************************<br />or you can use tableStyle approach, but it need<br />some orderd code.<br /><br />by the way i can send u an example how to use TableStyle.<br /><br />------------<br />GuoYong at 5/21/2002 10:42:42 PM<br /><br />Source code<br />Dim strsql As String<br />strsql = System.Configuration.ConfigurationSettings.AppSett ings("server")<br />Dim cn As New OleDbConnection(strsql)<br />cn.Open()<br />strsql = "select cu_cust_code,cu_eng_name,cu_chn_name from e_customer where cu_center_code='" & DDL2.SelectedItem.Value & "'"<br />Dim ap As New OleDbDataAdapter(strsql, cn)<br />Dim ds As New DataSet()<br />ap.Fill(ds, "e_customer")<br />DataGrid1.DataSource = ds.Tables(0).DefaultView<br />DataGrid1.ShowHeader = True<br />DataGrid1.AllowPaging = True<br />DataGrid1.PageSize = 6<br />1 DataGrid1.Columns(0).HeaderText = "Cust. Code"<br />2 DataGrid1.Columns(1).HeaderText = "English Name"<br />3 DataGrid1.Columns(2).HeaderText = "Chinese Name"<br />DataGrid1.DataBind()<br /><br />System error message<br />line 1 error<br />index out of range<br />System.ArgumentOutOfRangeException<br /><br />why?help me please

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved