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

Programitically set a "ClientSelectColumn" to "checked"

4 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 1
Bruce asked on 19 Mar 2009, 01:06 PM

I have the following in my ASPX page
   <Columns>
    <telerik:GridClientSelectColumn Reorderable="False"  UniqueName="ClientSelectColumn">
    </telerik:GridClientSelectColumn>
    <telerik:GridTemplateColumn HeaderText="Units On Order" UniqueName="unqUnitsOnOrder" ItemStyle-HorizontalAlign="Right">
     <ItemTemplate>
      <asp:TextBox ID="txtUnitsOnOrder"  MaxLength="5" runat="server" Width="60px" Text='<%# String.Format("{0:#,##0}", DataBinder.Eval(Container.DataItem,"UnitsOnOrder")) %>' />
     </ItemTemplate>
     <EditItemTemplate>
      <asp:TextBox ID="txtUnitsOnOrderUpd" runat="server" Width="60px"  Text='<%# DataBinder.Eval(Container.DataItem,"UnitsOnOrder") %>' />
     </EditItemTemplate>
    </telerik:GridTemplateColumn>
    </Columns>

I use the following to modify a grid page at runtime

   Public Sub radGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
        If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then
            Dim txtUnitsOnOrder As TextBox = DirectCast(e.Item.FindControl("txtUnitsOnOrder"), TextBox)
            txtUnitsOnOrder.Style("text-align") = "right" '
         End If

    End Sub

What code do I add to have a specific "ClientSelectColumn" "checked" when a grid page is displayed?

4 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 19 Mar 2009, 01:27 PM
Hello Bruce,

You can use this method to select an individual item, and this one to select all items.
The client side select column checkboxes will be automatically selected.
I hope this helps.

Best wishes,
Yavor
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bruce
Top achievements
Rank 1
answered on 19 Mar 2009, 01:41 PM
I don't think that will help - it looks like javascript and I need something in the "codebehind".

What I 'm trying to do is to save (in a session variable) the items checked on a page so that the user can select multiple items on multiple pages, and leave the items checked as the user changes pages (so if the user goes to a page that previously had items checked,they will still be checked).  In the codebehind, when I process a grid page, I want to "check" those rows which had previously been checked.
0
Yavor
Telerik team
answered on 23 Mar 2009, 01:58 PM
Hi Bruce,

From the server, you can reference the checkboxes directly, within the cells where they are hosted.
Additionally, the following article demonstrates how to persist the user selection.
I hope this information helps.

Sincerely yours,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Bruce
Top achievements
Rank 1
answered on 23 Mar 2009, 11:12 PM
Thanks - I've solved the problem.
Tags
Grid
Asked by
Bruce
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Bruce
Top achievements
Rank 1
Share this question
or