HI All
i need to get only the values of the rows for which checkbox is checked, i am getting null values for the checkbox checked value pls help me out
i have a radgrid with asp checkbox column in gridtemplate column
this is my code aspx page for radgrid
<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" DataKeyNames="TOKEN" EditMode="EditForms">
<Columns>
<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" AllowFiltering="false" ForceExtractValue="Always" >
<HeaderTemplate>
<asp:CheckBox id="Headercheck" runat="server" onclick="SelectAll(this);"></asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="Childcheck" runat="server" ></asp:CheckBox>
</ItemTemplate>
<HeaderStyle Width="3%" HorizontalAlign="Justify" />
<ItemStyle Width="3%" HorizontalAlign="Justify" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="TOKEN" Visible="false" UniqueName="TOKEN" ReadOnly="true" >
</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" EnablePostBackOnRowClick="true">
<Resizing AllowColumnResize="True" />
<Selecting AllowRowSelect="True" />
<ClientEvents OnFilterMenuShowing="OnFilterMenuShowing" ></ClientEvents>
</ClientSettings>
<FilterMenu EnableTheming="True">
<CollapseAnimation Type="None" />
<ExpandAnimation Type="None" />
</FilterMenu>
</telerik:RadGrid>
i have a button outside the radgrid, when i click the button it should get only the values checked in checkbox of radgrid
this is my code for button click event
protected void PushNtnBtn_Click1(object sender, EventArgs e)
{
foreach (GridDataItem item in M.MasterTableView.Items)
{
// bool isChecked = ((CheckBox)M.MasterTableView.FindControl("CheckBox1")).Checked;
CheckBox CheckBox1 = (CheckBox)item["CheckBoxTemplateColumn"].FindControl("Childcheck");
CheckBox c1 = item.FindControl("Childcheck") as CheckBox;
if (c1.Checked)
{
string token = item.GetDataKeyValue("TOKEN").ToString();
iPhnMainMethod(token);
}
}
}
here both checkbox1 and c1 are returning null values, pls help me out
i need to get only the values of the rows for which checkbox is checked, i am getting null values for the checkbox checked value pls help me out
i have a radgrid with asp checkbox column in gridtemplate column
this is my code aspx page for radgrid
<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" DataKeyNames="TOKEN" EditMode="EditForms">
<Columns>
<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" AllowFiltering="false" ForceExtractValue="Always" >
<HeaderTemplate>
<asp:CheckBox id="Headercheck" runat="server" onclick="SelectAll(this);"></asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="Childcheck" runat="server" ></asp:CheckBox>
</ItemTemplate>
<HeaderStyle Width="3%" HorizontalAlign="Justify" />
<ItemStyle Width="3%" HorizontalAlign="Justify" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="TOKEN" Visible="false" UniqueName="TOKEN" ReadOnly="true" >
</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" EnablePostBackOnRowClick="true">
<Resizing AllowColumnResize="True" />
<Selecting AllowRowSelect="True" />
<ClientEvents OnFilterMenuShowing="OnFilterMenuShowing" ></ClientEvents>
</ClientSettings>
<FilterMenu EnableTheming="True">
<CollapseAnimation Type="None" />
<ExpandAnimation Type="None" />
</FilterMenu>
</telerik:RadGrid>
this is my code for button click event
protected void PushNtnBtn_Click1(object sender, EventArgs e)
{
foreach (GridDataItem item in M.MasterTableView.Items)
{
// bool isChecked = ((CheckBox)M.MasterTableView.FindControl("CheckBox1")).Checked;
CheckBox CheckBox1 = (CheckBox)item["CheckBoxTemplateColumn"].FindControl("Childcheck");
CheckBox c1 = item.FindControl("Childcheck") as CheckBox;
if (c1.Checked)
{
string token = item.GetDataKeyValue("TOKEN").ToString();
iPhnMainMethod(token);
}
}
}
here both checkbox1 and c1 are returning null values, pls help me out