Hello Every One,
I'm find radgrid inside radbutton in RadGrid1_NeedDataSource
GridCommandItem commandItem = RadGrid2.MasterTableView.GetItems(GridItemType.CommandItem)[0] as GridCommandItem;
RadToolBar toolBar = commandItem.FindControl("RadToolBar2") as RadToolBar;
RadToolBarItem textItem = toolBar.FindItemByValue("HeaderDisplay");
RadButton LocationWise = textItem.FindControl("LocationWise") as RadButton;
Error Come Like That Index was outside the bounds of the array.
Thanks,
Mohamed
5 Answers, 1 is accepted
0
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Sep 2011, 10:28 AM
Hello,
Better to try do your code in itemDataBound.
let me know if any concern.
Thanks,
Jayesh Goyani
Better to try do your code in itemDataBound.
<CommandItemTemplate> <telerik:RadToolBar ID="RadToolBar1" runat="server"> <Items> <telerik:RadToolBarButton id="RadToolBarButton1" runat="server" Text="RadToolBarButton1" Value="RadToolBarButton1"> </telerik:RadToolBarButton> </Items> </telerik:RadToolBar> </CommandItemTemplate>protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridCommandItem) { GridCommandItem item = (GridCommandItem)e.Item; RadToolBar RadToolBar1 = item.FindControl("RadToolBar1") as RadToolBar; RadToolBarButton RadToolBarButton1 = RadToolBar1.FindItemByValue("RadToolBarButton1") as RadToolBarButton; // you can do your logic here } }let me know if any concern.
Thanks,
Jayesh Goyani
0
mohamed
Top achievements
Rank 1
answered on 10 Sep 2011, 01:26 PM
<CommandItemTemplate> <telerik:RadToolBar ID="RadToolBar2" runat="server" OnClientButtonClicking="onToolBarClientButtonClickingradgrid2"> <Items> <telerik:RadToolBarButton Text="Filter" CommandName="Filter" ImageUrl="../../images/Filter 3.gif"> </telerik:RadToolBarButton> <telerik:RadToolBarButton Text="Refresh" CommandName="RebindGrid" ImageUrl="../../images/Refresh.gif"> </telerik:RadToolBarButton> <telerik:RadToolBarButton runat="server" Value="HeaderDisplay"> <ItemTemplate> <table style="margin-left: 180px"> <tr> <td align="right"> <telerik:RadButton ID="LocationWise" AccessKey="1" runat="server" ButtonType="ToggleButton" ToggleType="Radio" AutoPostBack="true" GroupName="Radio" Text="Location" Checked="true"> </telerik:RadButton> </td> <td align="right"> <telerik:RadButton ID="SubConwise" AccessKey="2" runat="server" ButtonType="ToggleButton" ToggleType="Radio" AutoPostBack="true" GroupName="Radio" Text="Sub Contractor"> </telerik:RadButton> </td> </tr> </table> </ItemTemplate> </telerik:RadToolBarButton> </Items> </telerik:RadToolBar> </CommandItemTemplate>Refer the image see,
i bind record in second radgrid so that i find in needdatasource
protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { try { //GridCommandItem commandItem = RadGrid2.MasterTableView.GetItems(GridItemType.CommandItem)[0] as GridCommandItem; //RadToolBar toolBar = commandItem.FindControl("RadToolBar2") as RadToolBar; //RadToolBarItem textItem = toolBar.FindItemByValue("HeaderDisplay"); //RadButton LocationWise = textItem.FindControl("LocationWise") as RadButton; //if (LocationWise.Checked == true) //{ string locationmas = "select locationcode,locationplan, sum(estimatedistance) as estimatedistance, drawingno from dslocationmaster where status <> 'del' group by locationcode,locationplan,drawingno"; RadGrid2.DataSource = oDBClientADO.GetDataTable(locationmas); //} } catch (Exception ex) { } }Mohamed.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Sep 2011, 05:14 PM
Hello,
Please tell me what type of functionality you want.
Thanks,
Jayesh Goyani
Please tell me what type of functionality you want.
Thanks,
Jayesh Goyani
0
0
mohamed
Top achievements
Rank 1
answered on 24 Sep 2011, 06:47 AM
Problem Resolved ,
Using RadGrid2_PreRender
Thanks,
Mohamed.
Using RadGrid2_PreRender
Thanks,
Mohamed.