| <telerik:GridBoundColumn DataField="Noviembre" Aggregate="Sum" HeaderStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" DataType="System.Decimal" |
| FooterAggregateFormatString="{0:N2}" FooterStyle-Font-Bold="true"> |
| <HeaderStyle HorizontalAlign="Right" /> |
| <ItemStyle HorizontalAlign="Right" /> |
| <FooterStyle HorizontalAlign="Right" /> |
| </telerik:GridBoundColumn> |
| CultureInfo ci = new CultureInfo("es-PE"); |
| ci.NumberFormat.CurrencyNegativePattern = 14; |
| System.Threading.Thread.CurrentThread.CurrentCulture = ci; |
| Dim editor As Control = CreateDhtmlEditor("editor") |
| Label1.Controls.Add(editor) 'Add control to label |
| 'Find RadEditor and add Ajax to component |
| Dim RadEd As Telerik.WebControls.RadEditor = CType(Page.FindControl("editor"),Telerik.WebControls.RadEditor) |
| RadAjaxManager1.AjaxSettings.AddAjaxSetting(btnOpenTemplate, CType(RadEd, Telerik.WebControls.RadEditor), AjaxLoadingPanel1) |
| RadAjaxManager1.AjaxSettings.AddAjaxSetting(btnOpenTemplate, CType(RadEd, Telerik.WebControls.RadEditor), AjaxLoadingPanel1) |
| 'add client side event |
| RadEd.OnClientLoad="OnClientLoad" |
| function OnClienLoad(editor) |
| { |
| alert('Editor'); |
| } |
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="nestedviewtemplate.aspx.vb" |
| Inherits="_Default" %> |
| <%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" %> |
| <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| </head> |
| <body class="BODY"> |
| <form runat="server" id="mainForm" method="post"> |
| <telerik:RadScriptManager runat="server" ID="ScriptManager1"> |
| </telerik:RadScriptManager> |
| <!-- content start --> |
| <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> |
| <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" |
| AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" PageSize="5" |
| GridLines="None" ShowGroupPanel="true"> |
| <PagerStyle Mode="NumericPages"></PagerStyle> |
| <MasterTableView DataKeyNames="customerid" AllowMultiColumnSorting="True"> |
| <NestedViewTemplate> |
| <telerik:RadGrid runat="server" ID="nestedgrid" OnNeedDataSource="onneeddatasource_nestedgrid" |
| ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false" OnItemCreated="nested_Created" |
| OnItemCommand="Onitemcommand_nestedgrid_jahoor"> |
| <MasterTableView ShowHeader="true" AutoGenerateColumns="true" AllowPaging="true" |
| PageSize="7"> |
| <Columns> |
| <telerik:GridEditCommandColumn> |
| </telerik:GridEditCommandColumn> |
| </Columns> |
| <EditFormSettings EditFormType="Template"> |
| <FormTemplate> |
| <asp:ImageButton ID="imgb" runat="server" CommandName="go" /> |
| <asp:Button ID="btn1" runat="server" CommandName="buttonclicked" /> |
| <asp:DropDownList ID="ddl1" runat="server"> |
| </asp:DropDownList> |
| </FormTemplate> |
| </EditFormSettings> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </NestedViewTemplate> |
| <NestedViewSettings > |
| <ParentTableRelation> |
| <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" /> |
| </ParentTableRelation> |
| </NestedViewSettings> |
| <Columns> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings AllowDragToGroup="true" /> |
| </telerik:RadGrid> |
| <!-- content end --> |
| </form> |
| </body> |
| Imports Telerik.Web.UI |
| Imports System |
| Imports System.Data |
| Imports System.Data.SqlClient |
| Imports System.Web.UI.WebControls |
| Imports System.Configuration |
| Partial Class _Default |
| Inherits System.Web.UI.Page |
| Dim ConnString As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString |
| Protected Sub nestedgrid_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) |
| Dim btn As Button |
| Dim ddl As DropDownList |
| If e.Item.ItemType = GridItemType.EditFormItem And e.Item.IsInEditMode Then |
| Dim edititem As GridEditFormItem = CType(e.Item, GridEditFormItem) |
| ddl = CType(edititem.FindControl("ddl1"), DropDownList) |
| btn = CType(edititem.FindControl("btngo"), Button) |
| ddl.DataSource = dsddl() |
| ddl.DataTextField = "ShipName" |
| ddl.DataValueField = "OrderID" |
| ddl.DataBind() |
| End If |
| End Sub |
| Public Function myds() As DataSet |
| Dim conn As SqlConnection = New SqlConnection(ConnString) |
| Dim adapter As SqlDataAdapter = New SqlDataAdapter |
| adapter.SelectCommand = New SqlCommand("SELECT TOP 10 OrderID, ShipName, ShipAddress FROM Orders", conn) |
| Dim myDataSet As DataSet = New DataSet |
| conn.Open() |
| Try |
| adapter.Fill(myDataSet, "Orders") |
| adapter.SelectCommand = New SqlCommand("SELECT OrderID, Quantity FROM [Order Details]", conn) |
| adapter.Fill(myDataSet, "OrderDetails") |
| Finally |
| conn.Close() |
| End Try |
| Return myDataSet |
| End Function |
| Public Function dsddl() As DataSet |
| Dim conn As SqlConnection = New SqlConnection(ConnString) |
| Dim adapter As SqlDataAdapter = New SqlDataAdapter |
| Dim myDataSet As DataSet = New DataSet |
| conn.Open() |
| Try |
| adapter.SelectCommand = New SqlCommand("SELECT TOP 10 OrderID, ShipName FROM Orders", conn) |
| adapter.Fill(myDataSet, "OrderDetails") |
| Finally |
| conn.Close() |
| End Try |
| Return myDataSet |
| End Function |
| Protected Sub nestedgrid_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) |
| If e.CommandName = "Go" Then |
| Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) |
| Dim editItem As GridEditFormItem = DirectCast(item.EditFormItem, GridEditFormItem) |
| Dim doptdown As DropDownList = DirectCast(editItem.FindControl("ddl1"), DropDownList) |
| Dim value As String = doptdown.SelectedItem.Text |
| Response.Write(value) |
| End If |
| End Sub |
| Public Function GetDataTable(ByVal query As String) As DataTable |
| Dim ConnString As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString |
| Dim conn As SqlConnection = New SqlConnection(ConnString) |
| Dim adapter As SqlDataAdapter = New SqlDataAdapter |
| adapter.SelectCommand = New SqlCommand(query, conn) |
| Dim table1 As New DataTable |
| conn.Open() |
| Try |
| adapter.Fill(table1) |
| Finally |
| conn.Close() |
| End Try |
| Return table1 |
| End Function |
| Public Sub onneeddatasource_nestedgrid(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs) |
| Dim grid As RadGrid = DirectCast(source, RadGrid) |
| ' Populate the grid |
| grid.DataSource = GetDataTable("SELECT * FROM orders") |
| End Sub |
| Protected Sub Onitemcommand_nestedgrid_jahoor(ByVal source As Object, ByVal e As GridCommandEventArgs) |
| ' Throw New NotImplementedException() |
| Dim item As GridDataItem |
| If e.CommandName = "go" Then |
| If e.Item.ItemType = GridItemType.Item Then |
| item = CType(e.Item, GridDataItem) |
| Dim ddl As DropDownList = CType(item.EditFormItem.FindControl("ddl1"), DropDownList) |
| 'ddlEventStatus = CType(itemEdit.FindControl("ddlEventStatus"), DropDownList) |
| Response.Write(ddl.SelectedItem.Text) |
| End If |
| End If |
| End Sub |
| Protected Sub nested_Created(ByVal sender As Object, ByVal e As GridItemEventArgs) |
| Dim ddl As DropDownList |
| If e.Item.ItemType = GridItemType.EditFormItem And e.Item.IsInEditMode Then |
| Dim edititem As GridEditFormItem = CType(e.Item, GridEditFormItem) |
| ddl = CType(edititem.FindControl("ddl1"), DropDownList) |
| ddl.DataSource = dsddl() |
| ddl.DataTextField = "ShipName" |
| ddl.DataValueField = "OrderID" |
| ddl.DataBind() |
| End If |
| End Sub |
| Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource |
| RadGrid1.DataSource = GetDataTable("Select * from customers") |
| End Sub |
| End Class |
| radChart.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 45; |
| radChart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black; |
| radChart.PlotArea.XAxis.AxisLabel.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Bottom; |
| radChart.PlotArea.XAxis.AxisLabel.Appearance.Position.Auto = false; |
| radChart.PlotArea.XAxis.AxisLabel.Appearance.Position.X = 200; |
| radChart.PlotArea.XAxis.AxisLabel.Appearance.Position.Y = 125; |
| Message: Sys.ArgumentNullException: Value cannot be null. |
| Parameter name: panelsCreated[2] |
Thanks
Datta Navatre
Dependant combos on grid
Is possible to have dependant combos on a grid that are bound server side?
What I want to happen is somehow rebind the DataSource when another combo box in the grid changes.
So for example Combo A was Continents and Combo B was counties I would want to filter the country list (Combo B) depending on what is selected in the continents (Combo A). I can’t see any server events that fire upon selecting a combo within a grid.
Note that to further complicate things my columns are dynamically created.
Any help would be much appreciated!!!
Below is a shortened extract of my code:-
protected void uxResults_ItemDataBound(object sender, GridItemEventArgs e)
{
GridDropDownListColumnEditor
combo = null;
editMan = editedItem.EditManager;
GridDataItem item = (GridDataItem)e.Item;
if (e.Item is GridEditableItem )
{
if ((e.Item as GridEditableItem).IsInEditMode)
{
combo = editMan.GetColumnEditor(dr["Column Name"].ToString()) as GridDropDownListColumnEditor;
combo.DataSource = ApplyFilter(item, combo, dr, ds);
combo.DataBind();
}
}
}