H
HP
hi,
I have a problem with my datagrid paging code, I dont know what's wrong with
that, here is what i got as the error:
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID myDataGrid when AllowPaging is set to true and the selected
datasource does not implement ICollection.
Here is my code:
<script runat="server" language="Jscript">
function Page_Load(sender:Object, e:EventArgs) {
if (!Page.IsPostBack) {
BindData()
}
}
function BindData() {
var ds = new DataSet;
var strSQL = new String;
strSQL = "SELECT * FROM pubs ORDER BY name"
var DBConnection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:/web/data.mdb")
var DBCommand = new OleDbCommand(strSQL, DBConnection)
DBConnection.Open();
var DBReader = DBCommand.ExecuteReader();
myDataGrid.DataSource = DBReader
myDataGrid.DataBind()
}
function myDataGrid_PageChanger(sender:Object,
eataGridPageChangedEventArgs) {
myDataGrid.CurrentPageIndex = e.NewPageIndex;
BindData()
}
</script>
Thanks a lot
I have a problem with my datagrid paging code, I dont know what's wrong with
that, here is what i got as the error:
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID myDataGrid when AllowPaging is set to true and the selected
datasource does not implement ICollection.
Here is my code:
<script runat="server" language="Jscript">
function Page_Load(sender:Object, e:EventArgs) {
if (!Page.IsPostBack) {
BindData()
}
}
function BindData() {
var ds = new DataSet;
var strSQL = new String;
strSQL = "SELECT * FROM pubs ORDER BY name"
var DBConnection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:/web/data.mdb")
var DBCommand = new OleDbCommand(strSQL, DBConnection)
DBConnection.Open();
var DBReader = DBCommand.ExecuteReader();
myDataGrid.DataSource = DBReader
myDataGrid.DataBind()
}
function myDataGrid_PageChanger(sender:Object,
eataGridPageChangedEventArgs) {
myDataGrid.CurrentPageIndex = e.NewPageIndex;
BindData()
}
</script>
Thanks a lot