Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Web
Mobile
Document Management
Desktop
Reporting
Testing & Mocking
CMS
UI/UX Tools
Debugging
Free Tools
Support and Learning
Productivity and Design Tools
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
"server"
AutoGenerateColumns
"true"
Visible
"false"
onneeddatasource
"RadGrid1_NeedDataSource"
></
>
asp:LinkButton
"LinkButton1"
onclick
"LinkButton1_Click"
Text
"Orders"
"LinkButton2"
"LinkButton2_Click"
"Employee"
string
Bind =
.Empty;
public
static
connection = WebConfigurationManager.ConnectionStrings[
"NorthwindConnectionString3"
].ConnectionString;
SqlConnection conn =
new
SqlConnection(connection);
SqlCommand SqlCommand =
SqlCommand();
protected
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
if
(Bind ==
)
selectQuery1 =
"select top 10 OrderID,CustomerID from Orders"
;
SqlDataAdapter adapter1 =
SqlDataAdapter(selectQuery1, conn);
DataTable dt1 =
DataTable();
conn.Open();
adapter1.Fill(dt1);
conn.Close();
RadGrid1.DataSource = dt1;
}
selectQuery2 =
"select top 10 EmployeeID,LastName from Employees"
SqlDataAdapter adapter2 =
SqlDataAdapter(selectQuery2, conn);
DataTable dt2 =
adapter2.Fill(dt2);
RadGrid1.DataSource = dt2;
LinkButton1_Click(
sender, EventArgs e)
RadGrid1.Visible =
true
RadGrid1.Rebind();
LinkButton2_Click(