Hierarchy radgrid with checkbox

4 posts, 1 answers
  1. sahil
    sahil avatar
    35 posts
    Member since:
    Jul 2008

    Posted 12 Feb 2009 Link to this post

    i have a requirement:

    i want  a "Hierarchy  Radgrid with checkboxes" .
     now when i click on particular checkbox on radgrid in mastertable or detailview table ,
     its status is updated in database(true/false).

    all thing working on click of checkbox.

    Thanks in advance  for help/
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Feb 2009 Link to this post

    Hi Sahil,

    One suggestion will be to use a GridTemplateColumn witha CheckBox in its ItemTemplate. You can update the database with the current status of the CheckBox in the CheckChanged event.

    ASPX:
     <telerik:GridTemplateColumn UniqueName="TempCol" DataField="Discontinued" HeaderText="Discontinued" > 
                           <ItemTemplate> 
                               <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%#Eval("Discontinued") %>' AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" /> 
                           </ItemTemplate>  
                         </telerik:GridTemplateColumn> 

    CS:
       protected void CheckBox1_CheckedChanged(object sender, EventArgs e) 
        { 
            CheckBox chkbx = (CheckBox)sender; 
            GridDataItem item = (GridDataItem)chkbx.NamingContainer; 
            bool chkSatus= chkbx.Checked; 
           // perform Update operation 
        } 


    Thanks
    Shinu



  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. sahil
    sahil avatar
    35 posts
    Member since:
    Jul 2008

    Posted 15 Feb 2009 Link to this post

    hi

    can u please explain it more
    ..

    when i click on a particular checkbox of a radgrid , then checkchanged event is fire,

    and we get that particular checkbox,

    but when i use the update query , i want "category id column value" ..

    update tbcategorty set checkbox=@checkbox where categoryid=@categoryid

    from where i find the "category id" of a particular checkbox.??

    is i have to fire item command event for that??? 
  5. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Feb 2009 Link to this post

    Hi Sahil,

    You can access the CategoryID column value using the Column's UniqueName property in the CheckChanged event of the CheckBox.

    CS:
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)  
        {  
            CheckBox chkbx = (CheckBox)sender;  
            GridDataItem item = (GridDataItem)chkbx.NamingContainer;  
            bool chkSatus= chkbx.Checked;  
            // access the cell value using column's UniqueName property 
            string strCategoryid = item["columnUniqueName"].Text; 
           // perform Update operation  
        }  


    Thanks
    Shinu




Back to Top