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

GridClientSelectColumn issue

4 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PPSDevs
Top achievements
Rank 1
PPSDevs asked on 16 Nov 2009, 07:46 PM
I have a RadGrid in which I am using GridClientSelectColumn. This column always appears as checkbox no matter what I set in its ButtonType property. How can I change the look of the column to PushButton or LinkButton. I am using 2009 Q1 controls for ASPNET AJAX.

-Manjeet

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Nov 2009, 04:59 AM
Hello,

GridClientSelectColumn displays a check box control for each cell in the column. If you want to show LinkButton/PushButton for selecting rows, then use GridButtonColumn with its CommandName set to "Select" or "Deselect":

aspx:
 
<Columns> 
   <telerik:GridButtonColumn Text="Select" CommandName="Select"></telerik:GridButtonColumn> 
   <telerik:GridButtonColumn Text="Deselect" CommandName="Deselect"></telerik:GridButtonColumn> 
</Columns>  

Regards,
Shinu.
0
Jeremy Mann
Top achievements
Rank 1
answered on 03 Dec 2009, 02:50 PM
I'm in the same situation, and this suggestion does not work for me.

I continue to get the postback event fired even though I've tried to disable it. My radgrids ClientEvents.OnRowSelected event is not being triggerd with the above suggestion. I need the functionality of the GridClientSelectColumn as a linkbutton (text apposed to checkbox) and possibly an Icon. If I use a GridClientSelectColumn w/ checkboxes everything works as expected only using the undesired checkboxes.

I looked at doing it as a TemplateColumn, but I still need the clientside row selection Object that exists when using GridClientSelectColumn.

How do I get a linkbutton to fire the ClientEvents.OnRowSelected event ?

0
Jeremy Mann
Top achievements
Rank 1
answered on 03 Dec 2009, 03:17 PM
I found the answer in another post.  I was getting ahead of myself. I needed to listen for the command which occures before the time is selected in order to select it.

Telerik Answer & Sample Code

set the onCommand event in the clientevents section of the radgrid to "RadGridCommand" and then use the following :

<telerik:GridButtonColumn Text="Select" CommandName="Select" /> 

 <script type="text/javascript">                                         
                    function RadGridCommand(sender, args) 
                    {                         
                        if (args.get_commandName() == "Delete"
                        { 
                            args.set_cancel(true); 
                            //item index 
                            var itemIndex = args.get_commandArgument(); 
                        } 
                        if (args.get_commandName() == "Select"
                        { 
                            args.set_cancel(true); 
                            sender.get_masterTableView() 
                            sender.get_masterTableView().selectItem(args.get_commandArgument()); 
                            alert(args.get_commandArgument()); 
                        } 
                    } 
                </script> 
0
PPSDevs
Top achievements
Rank 1
answered on 03 Dec 2009, 03:22 PM

Jeremy,

What I ended up doing is, add a template coulmn with a label control and it's text set to "Select". Then I defined a CssClass for this label to appear like a link button. That solved my purpose. I can click the label control and still fire ClientEvents.RowSelectedEvent.

Here is what I have in aspx file for RadGrid ....

 

<Columns>

 

 

  <telerik:GridTemplateColumn>

 

 

    <ItemTemplate>

 

 

      <asp:Label ID="lblSelect" runat="server" Text="Select" ToolTip="Select a Contact" CssClass="action-link" />

 

 

    </ItemTemplate>

 

 

  </telerik:GridTemplateColumn>

 

 

  <!-- Other columns Here -->
</
Columns>

And here is my style definition for "action-link" ...

.action-link

 

{

 

  margin: 2px 5px 2px 5px;

 

 

  padding: 2px 5px 2px 5px;

 

 

  width: 100px;

 

 

  text-align: center;

 

 

  text-decoration: underline;

 

 

  font-family: Verdana, Arial, Geneva, Helvetica, sans-serif;

 

 

  font-weight: normal;

 

 

  font-size: 11px;

 

 

  color: Black;

 

 

  cursor: hand;

 

}

You may want to change the font settings according to your project.

Hope this helps.

Tags
Grid
Asked by
PPSDevs
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jeremy Mann
Top achievements
Rank 1
PPSDevs
Top achievements
Rank 1
Share this question
or