Programitically set a "ClientSelectColumn" to "checked"

5 posts, 0 answers
  1. Bruce
    Bruce avatar
    33 posts
    Member since:
    Oct 2006

    Posted 19 Mar 2009 Link to this post

    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?

  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 19 Mar 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bruce
    Bruce avatar
    33 posts
    Member since:
    Oct 2006

    Posted 19 Mar 2009 Link to this post

    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.
  5. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 23 Mar 2009 Link to this post

    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.
  6. Bruce
    Bruce avatar
    33 posts
    Member since:
    Oct 2006

    Posted 23 Mar 2009 Link to this post

    Thanks - I've solved the problem.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017