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

get hidden or unvisible values from a radgrid

2 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kranthi
Top achievements
Rank 1
Kranthi asked on 04 Jul 2012, 03:33 PM
Hi all can anyone come up with a solution for getting the hidden/unvisible values from a radgrid which is binded dynamically ..

my requirement is to get hidden values of the particular checked rows in the checkbox when a button is clicked
under button_click event i need to retrieve the values which are hidden or kept visible=false which is binded to radgrid dynamically from .cs page..

this is my aspx page

            <telerik:RadGrid ID="M" runat="server" Width="99%" AllowPaging="True" EnableViewState="False"
                GridLines="None" meta:resourcekey="MResource1" AllowFilteringByColumn="true"
                OnInit="GridControl_Init" EnableLinqExpressions="false" 
                EnableEmbeddedSkins="false" AutoGenerateColumns="False">
                <HeaderContextMenu EnableEmbeddedSkins="True">
                </HeaderContextMenu>
                <FilterMenu Skin="Nediso" EnableEmbeddedSkins="false">
                </FilterMenu>
                <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" AlwaysVisible="true" />
                <MasterTableView Width="100%" EnableViewState="False" AllowFilteringByColumn="true">
                
                <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                <Columns>  
                     <telerik:GridTemplateColumn  AllowFiltering="false" AutoPostBackOnFilter="false" HeaderStyle-Width="5%" ItemStyle-Width="5%" >
                    <HeaderStyle Width="3%" HorizontalAlign="Justify" />
                    <ItemStyle Width="3%" HorizontalAlign="Justify" />
                    <HeaderTemplate>
                    <input type="checkbox" runat="server" value="check" ID="checkbox"    />
                    </HeaderTemplate>
                    <ItemTemplate>
                    <asp:CheckBox runat="server" AutoPostBack="false" Width="5%" ID="checkbox2" />
                    </ItemTemplate>
                    </telerik:GridTemplateColumn>




                     <telerik:GridBoundColumn DataField="TOKEN" Visible="false" UniqueName="TOKEN" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FIRST NAME" HeaderText="FIRST NAME" UniqueName="FIRST NAME">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="LAST NAME" HeaderText="LAST NAME" UniqueName="LAST NAME">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="STATUS" HeaderText="STATUS" UniqueName="STATUS">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DESIGNATION" HeaderText="DESIGNATION" UniqueName="DESIGNATION">
                    </telerik:GridBoundColumn>
                    </Columns>
                    <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" Position="TopAndBottom" />
                    
                </MasterTableView>
                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" EnableRowHoverStyle="True">
                    <Resizing AllowColumnResize="True" />
                    <Selecting AllowRowSelect="True" />                    
                    <ClientEvents OnFilterMenuShowing="OnFilterMenuShowing"></ClientEvents> 
                    </ClientSettings>
                <FilterMenu EnableTheming="True">
                    <CollapseAnimation Type="None" />
                    <ExpandAnimation Type="None" />
                </FilterMenu>
            </telerik:RadGrid>

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 04 Jul 2012, 05:00 PM
Hello,

<telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn UniqueName="Leg" HeaderText="Leg1">
                        <ItemTemplate>
                            <asp:Label ID="lbLeg1" runat="server" Visible="false" />
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" Visible="false" UniqueName="ID">
                    </telerik:GridBoundColumn>
protected void Button2_Click(object sender, EventArgs e)
        {
            GridDataItem item = (sender as Button).NamingContainer as GridDataItem;
            string str1 = item["ID"].Text;
            CheckBox CheckBox1 = item.FindControl("CheckBox1") as CheckBox;
            Label lbLeg1 = item.FindControl("lbLeg1") as Label;
            // Access control here
        }


Thanks,
Jayesh Goyani
0
Kranthi
Top achievements
Rank 1
answered on 05 Jul 2012, 03:12 PM
hi Jayesh Goyani thanks for ur post,

sorry but i dint get ur code what it exactly meant to be, my requirement is such that when i click on the button i need to get the hidden column values whose checkbox is checked, i have a checkbox column for everyrow , i need to get those values of which the checkboxes are checked...

help me out for mutliple checkboxes check too....
Tags
Grid
Asked by
Kranthi
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Kranthi
Top achievements
Rank 1
Share this question
or