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

Reg: Rad Grid Row Click check box problem

3 Answers 203 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mani
Top achievements
Rank 1
mani asked on 08 Aug 2010, 06:02 AM

# Problem 1

 

  Requirement:

Note: I am using Telerik 2008 version
                     
When I click the Radgird Row that time Check box checked. If I click the same row again that row check box is unchecked.

 

             Note: Now I can able to only check box checked process. But I am not able do it check box unchecked process.

 

Steps to Replicate: (note: Client side scripts)

                    1. Generate the RadGrid with check box

                    2. Click the RadGrid Row. The check box Checked fine. (Note: you want to click row and not directly checkbox ok...)

                        3. Again I click the same row Click. The Checkbox is unchecked. (I Want do it unchecked. I Mean I want to need reverse process.

 

Reference: See the Problem1.jpg image

 

# Problem 2

Requirement:

              I want to select multiple row checkbox through Radgrid row click.

              Note: But now, I am not able to click more then one row check box. I want to click more then one Row check box through row click.

 

Steps to Replicate: (note: Client side scripts)

                        1. Generate the RadGrid with check box

                        2. Click any row now the check box is checked. Now click another one row.  The current row checkbox only checked. As per requirement we want to check box  two row check box.  Which is going to smilar….

 

Reference: See the Problem2.jpg image



<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   
  <telerik:RadCodeBlock ID="dsafdsa" runat="server">
 
    <script language="javascript" type="text/javascript">
    
    
function RowClick(rowIndex)

 {

   // alert("Click on row with index: " + rowIndex);

    return false; //cancel the postback request set with ClientSettings -> EnablePostBackOnRowClick = true

 }


 function RowSelecting(sender, args) {
     
     var id = args.get_id();
     var inputCheckBox = $get(id).getElementsByTagName("input")[0];
     if (!inputCheckBox || inputCheckBox.disabled) {
         //cancel selection for disabled rows
         args.set_cancel(true);
     }
     if (inputCheckBox.checked == true) {
         inputCheckBox.checked = false;
     }
     else
     {
         inputCheckBox.checked =true;
     }
    
 }
 function RowDeselecting(sender, args) {
     alert("Deselect");
     var id = args.get_id();
     var inputCheckBox = $get(id).getElementsByTagName("input")[2];
     if (!inputCheckBox || inputCheckBox.disabled) {
         //cancel selection for disabled rows
         args.set_cancel(true);
     }
     inputCheckBox.checked = false;
 }

    </script>
    </telerik:RadCodeBlock>
    
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
    <div>
    
        <telerik:RadComboBox ID="RadComboBox1" Runat="server">
        </telerik:RadComboBox>
    <asp:HiddenField ID="HiddenField2" runat="server" />    
        
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid1" runat="server"
            AllowPaging="True" PageSize="10" Width="97%"   AllowMultiRowSelection="True"
            GridLines="None">
            <PagerStyle Mode="NumericPages" />
             <ClientSettings EnableRowHoverStyle="true">
                <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true"   EnableDragToSelectRows="true"/>
                <ClientEvents OnRowClick="RowSelecting" />
                
            </ClientSettings>
            <MasterTableView>
                <Columns>
                    <telerik:GridClientSelectColumn>
                    </telerik:GridClientSelectColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    
    </div>
    </form>
</body>
</html>

Please provide me solutions for this problem. if you have any source code please send to me......

Thanks & Regards
G. Manikandan

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Aug 2010, 02:20 PM
Hello Mani,

You can select multiple rows after setting the AllowMultiRowSelection property of the grid to true. Later on, you can unselect a row by holding the Crtl key and clicking the row. You don't need this if you have GridClientSelectColumn added. The second grid in the following online example demonstrates how to achive the desired functionality:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx

I hope this helps.

Regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
mani
Top achievements
Rank 1
answered on 10 Aug 2010, 06:09 PM
Hi
        Thanks for quick response. I tried what is give you advice. The code is working fine in Q3 2009. but now i am using in my project Q2 2008. The same coding is not working in Q2 2008. and also Q2 2008 is not supported for UseClientSelectColumnOnly="true". But it is supported for q3 2009 only . I want to need for solution for this problem in q2 2008.

 Requirement is:
                   1. We need to check and unchecked rad grid check box through row click event  in client side scripts(note: I can able to do check box checked. but i am not able do  unchecked in Q2 2008 Telerik
                    2. I need to select multiple check box in rad grid through row click in Client side scripts(note: I can able to select multiple check box through row click in Q3 2009(use: args.set_cancel(true)). But i am not able same process in Q2 2008.
                    3. If i did above functionality through args.set_cancel(true); event. I am not able to check the check box through directly click . and also i am not able to select the multiple check box through row header check box.
Please provide the solution for above problem in Q2 2008 Telerik DLL
 Note: Please see the image. And attachment for sample coding and please all the q2 Telerik DLL

.
source code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   
  <telerik:RadCodeBlock ID="dsafdsa" runat="server">
 
    <script language="javascript" type="text/javascript">
    
    
function RowClick(rowIndex)

 {

   // alert("Click on row with index: " + rowIndex);

    return false; //cancel the postback request set with ClientSettings -> EnablePostBackOnRowClick = true

 }


 function RowSelecting(sender, args) {
     
     var id = args.get_id();
     var inputCheckBox = $get(id).getElementsByTagName("input")[0];
     if (!inputCheckBox || inputCheckBox.disabled) {
         //cancel selection for disabled rows
         args.set_cancel(true);
     }
     if (inputCheckBox.checked == true) {
         inputCheckBox.checked = false;
     }
     else
     {
         inputCheckBox.checked =true;
     }
    
 }
 function RowDeselecting(sender, args) {
     alert("Deselect");
     var id = args.get_id();
     var inputCheckBox = $get(id).getElementsByTagName("input")[2];
     if (!inputCheckBox || inputCheckBox.disabled) {
         //cancel selection for disabled rows
         args.set_cancel(true);
     }
     inputCheckBox.checked = false;
 }

    </script>
    </telerik:RadCodeBlock>
    
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
    <div>
    
        <telerik:RadComboBox ID="RadComboBox1" Runat="server">
        </telerik:RadComboBox>
    <asp:HiddenField ID="HiddenField2" runat="server" />    
        
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid1" runat="server"
            AllowPaging="True" PageSize="10" Width="97%"   AllowMultiRowSelection="True"
            GridLines="None">
            <PagerStyle Mode="NumericPages" />
             <ClientSettings EnableRowHoverStyle="true">
                <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true"   EnableDragToSelectRows="true"/>
                <ClientEvents OnRowClick="RowSelecting" />
                
            </ClientSettings>
            <MasterTableView>
                <Columns>
                    <telerik:GridClientSelectColumn>
                    </telerik:GridClientSelectColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    
    </div>
    </form>
</body>
</html>

Thanks
G. Manikandan
0
Pavlina
Telerik team
answered on 11 Aug 2010, 03:22 PM
Hello Mani,

Please, have in mind that the RadGrid control does not support the desired functionality, also if you try to implement it manually via JavaScript this will not work in some scenarios. The functionality which you try to achieve stands against the RadGrid build-in selection logic. The default model, for selection, does not allow to implement the custom functionality which you want. However you could try the following approach:  

Instead of GridClientSelectColumn you could try using the GridTemplateColumn and add into it the CheckBox. When the user clicks on the row you could check the checkbox form the template column and change the row's background, instead of using the build-in selection of the RadGrid.

Sincerely yours,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
mani
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
mani
Top achievements
Rank 1
Share this question
or