Here is a link my recent, but also current problem: Recent RadGrid post relative to this.
In the interum I have created a function to store the checked boxes and retrieve the ID's for said checks.
I have added teleriks code for ItemCreated and ItemPreRender (see below);
My new error is "Unable to cast object of type 'Telerik.Web.UI.RadGrid' to type 'Telerik.Web.UI.GridDataItem'", so what gives.
Even with my new method, to track each check and uncheck, no data fills the RadGrid. Actually, the grid shows up with only the header column showing.
Another minor problem is when I fill the last RadGrid with data (forced), if I check the select all check box nothing happens, yet if check the internal rows they select all...I can't seem to figure this issue.
Here is how I pull and convert, keep track of the checks and changes to my data;
Any help with all or some would be greatly appreciated.
Thanks,
-Ryan
In the interum I have created a function to store the checked boxes and retrieve the ID's for said checks.
I have added teleriks code for ItemCreated and ItemPreRender (see below);
Protected Sub RG2_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RG2.ItemCreated |
If TypeOf e.Item Is GridDataItem Then |
AddHandler e.Item.PreRender, AddressOf RG2_ItemPreRender |
End If |
End Sub |
Protected Sub RG2_ItemPreRender(ByVal sender As Object, ByVal e As EventArgs) |
CType(CType(sender, GridDataItem)("CheckBoxTemplateColumn").FindControl("chkbxFacility"), CheckBox).Checked = CType(sender, GridDataItem).Selected |
End Sub |
Even with my new method, to track each check and uncheck, no data fills the RadGrid. Actually, the grid shows up with only the header column showing.
Another minor problem is when I fill the last RadGrid with data (forced), if I check the select all check box nothing happens, yet if check the internal rows they select all...I can't seem to figure this issue.
Here is how I pull and convert, keep track of the checks and changes to my data;
For Each ID As String In facilityID |
IDList += ID & "," |
Next |
IDList.Remove(IDList.LastIndexOf(","), 1) |
'Track the checks |
Dim facilityID As New List(Of String) |
For Each dataItem As GridDataItem In RG3.MasterTableView.Items |
If CType(dataItem.FindControl("chkbxFacility"), CheckBox).Checked = True Then |
facilityID.Add(dataItem.OwnerTableView.DataKeyValues(dataItem.ItemIndex)("FacilityID").ToString()) |
End If |
Next |
Return facilityID |
'function for any changes or additions |
If (CType(sender, CheckBox)).Checked Then |
For Each dataItem As GridDataItem In RG2.MasterTableView.Items |
CType(dataItem.FindControl("chkbxFacility"), CheckBox).Checked = True |
dataItem.Selected = True |
Next |
Else |
For Each dataItem As GridDataItem In RG2.MasterTableView.Items |
CType(dataItem.FindControl("chkbxFacility"), CheckBox).Checked = False |
dataItem.Selected = False |
Next |
End If |
'Make alternate call to FillDepartment to recognize any changes to the facility check box list |
FillDepartment(RG2_GetFacilityIDs) |
Any help with all or some would be greatly appreciated.
Thanks,
-Ryan