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

[Solved] RadGrid Item Template Data Binding

1 Answer 448 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DK
Top achievements
Rank 2
DK asked on 27 Jul 2009, 08:47 AM
HI
I have Radgrid with hierarchy.
Now i have checkbox as item template in master detail view as well in detail table view.
how can i bind the checkbox with the dataset.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Jul 2009, 05:46 AM
Hi DK,

I hope you are trying to bind the CheckBox in the ItemTemplate of a GridTemplateColumn with boolean value. If so try with the following approach.

CS:
 // binding the Grid with DataSet
 protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    { 
         string connectionstring = "Data Source=inc156.softinc.com; Initial Catalog=NorthWind;User ID=sa; Password=softinc"
         SqlConnection conn = new SqlConnection(connectionstring); 
         
            conn.Open(); 
            SqlDataAdapter adp = new SqlDataAdapter("SELECT ProductName,ProductID,SupplierID, Discontinued FROM Products", conn); 
            DataSet ds = new DataSet(); 
            adp.Fill(ds); 
            RadGrid1.DataSource = ds; 
            conn.Close(); 
             
    } 

ASPX:
 
 <telerik:GridTemplateColumn UniqueName="CheckTemp" HeaderText="CheckBoxColumn"  > 
               <ItemTemplate> 
                   <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%#Bind("Discontinued") %>' /> 
               </ItemTemplate> 
  </telerik:GridTemplateColumn> 


Regards
Princy

Tags
Grid
Asked by
DK
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or