We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Possibilities of datasource

Thread ID:





143703 Apr 1,2019 03:24 PM UTC Apr 2,2019 07:18 AM UTC ASP.NET Web Forms 1
Tags: Grid
Asked On April 1, 2019 03:24 PM UTC

Is possible to load SqlDataSource for to button  on grid? 

Vignesh Natarajan [Syncfusion]
Replied On April 2, 2019 07:18 AM UTC

Hi Guadalupe, 
Thanks for using Syncfusion products. 
Query: “Is possible to load SqlDataSource for to button  on grid? 
From your query, we suspect that you need to update the dataSource of Grid on button click using SqlDataSource. We have achieved your requirement using EJ Button OnClick event. 
Kindly refer the code example and sample for your reference.  
<ej:Button ID="Button" runat="server" Type="Button" Text="Update Sql DataSource" Size="Large" Width="80px" OnClick="Button_Click"> 
     <ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" > 
                <ej:Column Field="OrderID" HeaderText=" Order ID" IsPrimaryKey="True" TextAlign="Right" Width="75"> 
                 .   .   . 
            DataTable dt = new DataTable("Order"); 
        protected void Page_Load(object sender, EventArgs e) 
        protected void dataBind() 
                SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLConnectionString"].ToString()); 
                dt = new DataTable("Order"); 
                SqlCommand cmd = new SqlCommand(); 
                cmd.Connection = myConnection; 
                cmd.CommandText = "select * from Orders"; 
                cmd.CommandType = CommandType.Text; 
                SqlDataAdapter da = new SqlDataAdapter(); 
                da.SelectCommand = cmd; 
                if (myConnection.State == ConnectionState.Closed) 
                OrdersGrid.DataSource = Syncfusion.JavaScript.Utils.DataTableToJson(dt); 
        protected void Button_Click(object sender, Syncfusion.JavaScript.Web.ButtonEventArgs e) 
Please get back to us if you need any further assistance 
Vignesh Natarajan. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon