ASP.NET - Check box in Telerik Radgrid control
Asked By sushma on 02-Aug-11 01:22 AM
Hi sir/Madam,
Ihave a code of Checkbox in telerik radgrid control, and i have a delete button outside the radgrid. i need to check the checkboxes in the radgrid and on selecting the checkbox i should delete the items in the radgrid using the delete button which is outside the radgrid. here i am getting error as object reference is not set to instance so please can any one solve this error. here is my code
Delete button code:
protected void btnDelete_click(object sender, EventArgs e)
{
Button btn = new Button();
string struserid = string.Empty;
foreach (GridDataItem row in rgScheduleStatus.Items)
{
int intuserid = Convert.ToInt32(row.Cells[6].Text);
if (row.ItemType == GridItemType.Item)
{
CheckBox deletechkbox = (CheckBox)row.FindControl("chkSelect");
if (deletechkbox.Checked)
{
struserid += intuserid + ",";
ScheduleStatusUI Deletebox = new ScheduleStatusUI();
btn = (Button)row.FindControl("btndelete");
btn.Attributes.Add("OnClick", " return DeleteConfirmation('" + Deletebox.DeleteScheduleStatusUI(Convert.ToInt32(row.OwnerTableView.DataKeyValues[row.RowIndex]["StudentHistoryPrintID"].ToString() + struserid)) + "')");
}
}
}
}
Ravi S replied to sushma on 02-Aug-11 01:24 AM
Hi
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| CheckBox chkbx = (CheckBox)item["columnUniqueName"].Controls[0]; |
| chkbx.Checked = true; |
| } |
| } |
sushma replied to Ravi S on 02-Aug-11 01:27 AM
Hi,
I have the checkbox in header also, i need to delete the all checkbox items when you click the header.
can you send the full code for that please.
Ravi S replied to sushma on 02-Aug-11 01:33 AM
Hi
You can access the control by accessing the HeaderItem as shown below.
C#:
refer the link also
http://www.telerik.com/community/forums/aspnet/grid/deleting-multiple-row-using-checkbox-on-radgrid.aspx
http://www.codeproject.com/Answers/220826/delete-checked-gridview-rows.aspx#answer3
sushma replied to Ravi S on 02-Aug-11 01:37 AM
Hi,
But i want the function of delete which is outside the radgrid. when i click the header checkbox in radgrid using the delete button outside the grid it should delete the items present in the grid.
Jitendra Faye replied to sushma on 02-Aug-11 03:03 AM
Change you code like this-
if (row.ItemType == GridItemType.Item)
{
CheckBox deletechkbox = (CheckBox)row.FindControl("chkSelect");
if(deletechkbox !=null)
{
if (deletechkbox.Checked)
{
struserid += intuserid + ",";
ScheduleStatusUI Deletebox = new ScheduleStatusUI();
btn = (Button)row.FindControl("btndelete");
btn.Attributes.Add("OnClick", " return DeleteConfirmation('" + Deletebox.DeleteScheduleStatusUI(Convert.ToInt32(row.OwnerTableView.DataKeyValues[row.RowIndex]["StudentHistoryPrintID"].ToString() + struserid)) + "')");
}
}
}

Hi All, I have telerik radgrid contains the checkboxes in header part also, i want to check and uncheck the checkboxes. if check the header thn it should check all the checkboxes and if uncheck 1 checkbox also it should uncheck the header checkbox. how can i server side. can any 1 send the code for this, here is the code of radgrid <telerik:GridTemplateColumn HeaderText = "Delete" HeaderStyle-CssClass = "tal la" ItemStyle-CssClass = "tal la" UniqueName = "chkschedulestatus"> <HeaderTemplate
Hi All, I have a delete button outside the radgrid control when i check the checkboxes in the radgrid, using the delete button i shoul delete the checkboxes, can any one send the code for this problem. You can hide the CheckBox of RadGrid, Use this code- protected void BtnHide_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1 didnt understand this error so please can u solve this error. Hi All, I have telerik radgrid contains the checkboxes in header part also, i want to check and uncheck the
RadComboBox control on checkedchanged C# .NET 06-Jun-13 10:02 AM I have a RadGrid contains Checkboxes and a combobox. What I want to do is to find the RadCombobox Control inside the radGrid on chkMenu_CheckedChange < telerik : GridTemplateColumn UniqueName = "AccessID" SortExpression = "AccessName" Allowfiltering = "false" Visible = "false"> < ItemTemplate > < asp : Label runat = "server" ID lblID" Text = ' <%# Eval("AccessID") %> ' Visible = "false" / > < / ItemTemplate > < EditItemTemplate > < telerik : RadTextBox runat = "server" Width = "500px" ID = "txtAccessID" Text = ' <%# Eval("AccessID") %> ' Visible = "false" / > < table > < tr > < td td > Department: < / td > < td valign = "top"> < asp : HiddenField ID = "hdnDept" runat = "server" Value = ' <%# Eval("DepartmentID") %> ' / > < telerik : RadComboBox ID = "ddlDepartmentID" runat = "server" Width = "500px" Visible = "false"> < Items > < telerik : RadComboBoxItem Text = "" / > < / Items > < / telerik : RadComboBox > < / td > < / tr > < / table > < / EditItemTemplate > < / telerik : GridTemplateColumn > protected void chkMenu_CheckedChange( object source, EventArgs e) { / / Code
Telerik gridview checkboxes do not work after filteration. Forms.elements.length = 0 in java script to check whether check whether an item is selected or not. This may look something like this: .aspx <telerik:RadGrid ID = "RadGrid1" runat = "server" DataSourceID = "AccessDataSource1" GridLines = "None" AllowMultiRowSelection = "true"> <ExportSettings> <Pdf FontType = "Subset" PaperSize here is sample code of telerick control in grid, which serve the same purpose. <% Html. Telerik ().Grid<FileModel> () .Name( " filelist" ) .DataKeys(key = > key.Add(x = > x.FullPath)) .Columns(columns = > { columns.Bound this helps Regards D keywords: OrderBy, DataBinding, Render, Status, Format, java script, checkbox, grid description: telerik grid checkbox selection not working after filtering records Telerik gridview checkboxes do not work after filteration. Forms.elements.length = 0 in
what is the difference between a telerik radgrid and datagrid? Can I have a hyperlink column in a TELERIK RADGRID ?If so how? DataGrid is the control of ASP.NET and telerik is a third party tool which can use in our asp.net application. What the telerik provide that you can check its demo site: http: / / demos.telerik.com / aspnet-ajax / grid
Hi. . . How to Restrict Duplicate updates in Telerik RadGrid in asp.net Thanks in advance description: Duplicates Checking in Telerik RadGrid Hi. . . How to Restrict Duplicate updates in Telerik RadGrid in asp.net Thanks in advance 06-Jun-13 09
Hi all, Can any one send the javascript code for checkbox in radgrid and that javascript code should be called at server side. here is the radgrid code <telerik:RadGrid runat = "server" ID = "rgScheduleStatus" AutoGenerateColumns = "false" GridLines = "None" OnItemDataBound = "rgScheduleStatus_ItemDataBound" AllowPaging = "true" PageSize = "3" OnPageIndexChanged PageButtonCount = "3" Position = "TopAndBottom" / > <MasterTableView CssClass = "table_12" DataKeyNames = "StudentHistoryPrintID" TableLayout = "Auto" RowIndicatorColumn-ShowSortIcon = "true"> <Columns> <telerik:GridTemplateColumn HeaderText = "Delete" HeaderStyle-CssClass = "tal la" ItemStyle-CssClass = "tal la" UniqueName = "chkschedulestatus"> <HeaderTemplate> <asp HeaderTemplate> <ItemTemplate> <asp:HiddenField runat = "server" ID = "hdnStudentHistoryPrintID" / > <asp:CheckBox runat = "server" ID = "chkSelect" / > < / ItemTemplate> < / telerik:GridTemplateColumn> < / Columns> < / MasterTableView> < / telerik:RadGrid> Use this code for select all and delete code in
hi, how can we update parent row in hierarchal telerik radgrid when updating child row? As per now, it is only updating the child row [detailtableview columns in parent row also needs to be updated and this is not happening as RadGrid.Rebind() function is not working as expected in my case. Please help if someone have used radgrid for such requirements. Thanks in advance These are a couple of good links that would guide you through updating parent row in hierarchial telerik radgrid when updating child row http: / / www.telerik.com / community / forums / winforms / gridview / iterating-the-child