Product Bundles
DevCraft
All Telerik .NET and Kendo UI JavaScript components and AI Tools in one package.
Kendo UI
Bundle of AI Tools plus four JavaScript UI libraries built natively for jQuery, Angular, React and Vue.
Build JavaScript UI
Javascript
Telerik
Build modern .NET business apps
.Net Web
Cross-Platform
Desktop
Reporting and Documents
AI for Developers & IT
Ensure AI program success
AI Coding
AI Engineering
Additional Tools
Enhance the developer and designer experience
Testing & Mocking
Debugging
UI/UX Tools
CMS
Free Tools
Support and Learning
Productivity and Design Tools
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
"server"
OnNeedDataSource
"RadGrid1_NeedDataSource"
AllowPaging
"true"
OnUpdateCommand
"RadGrid1_UpdateCommand"
OnInsertCommand
"RadGrid1_InsertCommand"
OnDeleteCommand
"RadGrid1_DeleteCommand"
>
MasterTableView
AutoGenerateColumns
"False"
DataKeyNames
"OrderID"
CommandItemDisplay
"Top"
GroupByExpressions
telerik:GridGroupByExpression
SelectFields
telerik:GridGroupByField
FieldAlias
"ShipName"
FieldName
></
</
GroupByFields
SortOrder
"Descending"
Columns
telerik:GridButtonColumn
CommandName
"Delete"
Text
UniqueName
"DeleteColumn"
ConfirmText
ConfirmDialogType
"RadWindow"
/>
telerik:GridBoundColumn
HeaderText
DataField
ReadOnly
"CustomerID"
telerik:GridEditCommandColumn
"EditCommandColumn"
public
static
DataTable dtTable;
SqlConnection SqlConnection =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"ConnectionString"
].ConnectionString);
SqlDataAdapter SqlDataAdapter =
SqlDataAdapter();
SqlCommand SqlCommand =
SqlCommand();
protected
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
dtTable =
DataTable();
try
SqlConnection.Open();
string
selectQuery =
"SELECT * FROM Orders"
;
SqlDataAdapter.SelectCommand =
SqlCommand(selectQuery, SqlConnection);
SqlDataAdapter.Fill(dtTable);
RadGrid1.DataSource = dtTable;
}
catch
(Exception ex)
RadGrid1.Controls.Add(
LiteralControl(
"Unable to insert Employee. Reason: "
+ ex.Message));
finally
//Close the SqlConnection
SqlConnection.Close();
RadGrid1_InsertCommand(
sender, GridCommandEventArgs e)
GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
CustomerID = (insertedItem[
].Controls[0]
as
TextBox).Text;
ShipName = (insertedItem[
//Open the SqlConnection
//Insert Query to insert into the database
insertQuery =
"INSERT into Orders(CustomerID,ShipName) values('"
+ CustomerID +
"','"
+ ShipName +
"')"
SqlCommand.CommandText = insertQuery;
SqlCommand.Connection = SqlConnection;
SqlCommand.ExecuteNonQuery();
e.Canceled =
true
RadGrid1_DeleteCommand(
//Code to delete
RadGrid1_UpdateCommand(
//Code to Update