This is a migrated thread and some comments may be shown as answers.

Catching with Telerik RadGrid

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Botero
Top achievements
Rank 1
David Botero asked on 04 Apr 2010, 10:53 PM

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();
        }
    }

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 08 Apr 2010, 04:52 PM
Hello David,

Thank you for your submission.

Please modify your code-library according the guidelines posted here:
Using the Code Library

Best regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
David Botero
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or