Requirements |
|
RadControls 2010 | |
.NET 3.5 |
|
Visual Studio 2008 |
|
programming language C# |
|
browser support |
all browsers supported by RadControls |
PROJECT DESCRIPTION
Catching with Telerik RadGrid for better performance.
private void fncInitGridData() {
try
{
TimeSpan ts = new TimeSpan(1,0,0);
dtTable = new DataTable();
string selectQuery;
SqlConnection.Open();
selectQuery = "SELECT * FROM viewMaterialPrices";
SqlDataAdapter.SelectCommand = new SqlCommand(selectQuery, SqlConnection);
SqlCommandBuilder cmdBldr = new SqlCommandBuilder(SqlDataAdapter);
SqlDataAdapter.Fill(dsDataSet, tableName);
DataColumn qty = new DataColumn();
qty.DataType = System.Type.GetType("System.Double");
qty.ColumnName = "qty";
qty.DefaultValue = 1;
DataColumn subtotal = new DataColumn();
subtotal.DataType = System.Type.GetType("System.Double");
subtotal.ColumnName = "subtotal";
subtotal.Expression="unit_price*qty";
dsDataSet.Tables[0].Columns.Add(qty);
dsDataSet.Tables[0].Columns.Add(subtotal);
Cache["Materials"] = dsDataSet.Tables[0];
Cache.Insert("Materials", dsDataSet.Tables[0], null, Cache.NoAbsoluteExpiration, ts);
RadGrid1.DataSource = (DataTable)Cache["Materials"];
//RadGrid1.DataSource = dsDataSet.Tables[0];
SqlConnection.Close();
}
finally {
SqlConnection.Close();
}
}