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

Find Control FilterTemplate

2 Answers 312 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 21 Jun 2012, 01:19 PM
Hi i'm have this code:

<telerik:RadGrid ID="gridprod_paso1_tab2" runat="server" Skin="Office2010Blue"

OnGroupsChanging="agrupargridprod_paso1_tab2"
OnSortCommand="reordenargridprod_paso1_tab2" 
OnPageIndexChanged="cargarpagegridprod_paso1_tab2" 
OnPageSizeChanged="cambiopagesizegridprod_paso1_tab2"
OnItemCommand="cambioflitrogridprod_paso1_tab2"
OnItemDataBound="itemdataboundgridprod_paso1_tab2" 
OnPreRender="prerendercheckgridprod_paso1_tab2">
<PagerStyle Mode="NextPrevAndNumeric" CssClass="txt10333"/>
<AlternatingItemStyle BackColor="#EEEEEE" CssClass="txt10333"/>
<MasterTableView TableLayout="Fixed" AllowMultiColumnSorting="true" CssClass="txt10333">
<Columns>
<telerik:GridBoundColumn HeaderText="Marca de producto" Resizable="true" DataField="marca" UniqueName="marca" SortExpression="marca" FilterControlWidth="240">
<telerik:GridTemplateColumn AllowFiltering="True" HeaderText="Agregar" Groupable="false">
<FilterTemplate>
 <asp:CheckBox runat="server" id="checktodosel" AutoPostBack="true" OnCheckedChanged="seltodogridprod_paso1_tab2"/>
</FilterTemplate>

<ItemTemplate>
<asp:Label runat="server" ID="lblproductoID" Text='<%# Eval("productoID") %>' Visible="false"></asp:Label>
<asp:CheckBox runat="server" ID="checkselect" CssClass="txt11333" />
</ItemTemplate>
 <ItemStyle Width="80" VerticalAlign="Middle"/>
<HeaderStyle Width="80" />
</telerik:GridTemplateColumn>
</Columns>
<ItemStyle VerticalAlign="Top"/>
</MasterTableView>                                                                        
 <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true"></ClientSettings>                                                                      </telerik:RadGrid>


and this function

Protected Sub prerendercheckgridprod_paso1_tab2(ByVal sender As Object, ByVal e As EventArgs)
     Dim item As GridFilteringItem = TryCast(gridprod_paso1_tab2.MasterTableView.GetItems(GridItemType.FilteringItem)(0),                          GridFilteringItem)
    DirectCast(item.FindControl("checktodosel"), CheckBox).Checked = lblcheckgridprod_paso1_tab2.Text
End Sub

is easy find the checkbox "checktodosel" in event OnPreRender of the radgrid, my problem is that i don't know find this control filter outside this event, i need find it in another function that is called for another control, in my case a RadioButtonList in the event OnSelectedIndexChanged.

Thanks for your attention.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Jun 2012, 01:31 PM
Hello Juan,

Try the following code to access FilterTemplate in selectedindexchanged event of radiobuttonlist.
VB:
Protected Sub RadioButtonList1_SelectedIndexChanged(sender As Object, e As EventArgs)
    For Each item As GridFilteringItem In RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)
        Dim c As CheckBox = DirectCast(item.FindControl("checktodosel"), CheckBox)
    Next
End Sub

Thanks,
Princy.
0
Juan
Top achievements
Rank 1
answered on 25 Jun 2012, 08:55 PM
HI Princy, this solution helped me so much, thanks.
Tags
Grid
Asked by
Juan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Juan
Top achievements
Rank 1
Share this question
or