or
<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="progressLoader"> <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="Vertical" AllowSorting="true" AllowPaging="true" AllowCustomPaging="false" AutoGenerateColumns="false" EnableHeaderContextMenu="true" Skin="Default" PageSize="15" OnNeedDataSource="RadGrid1_NeedDataSource" > <ExportSettings> <Pdf FontType="Subset" PaperSize="A4" /> <Excel Format="Html" /> <Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" /> </ExportSettings> <MasterTableView CommandItemDisplay="Top" PagerStyle-AlwaysVisible="False" > <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle> <CommandItemTemplate> <asp:LinkButton ID="btn_save" runat="server" CommandName="saveGrid" ><asp:Image runat="server" ID="img_save" ImageUrl="~/_resources/images/icons/tick.png"/></asp:LinkButton> <asp:LinkButton ID="btn_excel" runat="server" CommandName="excel" ><asp:Image runat="server" ID="Image1" ImageUrl="~/_resources/images/icons/xls_grey.gif"/></asp:LinkButton> </CommandItemTemplate> </MasterTableView> <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True" EnablePostBackOnRowClick="False" AllowGroupExpandCollapse="True" > <Selecting AllowRowSelect="true" /> <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="False"> </Resizing> </ClientSettings> </telerik:RadGrid></telerik:RadAjaxPanel>Public Property Datasource() As DataTable Get Return _Datasource End Get Set(ByVal value As DataTable) _Datasource = value End Set End Property Public Property GridDataKeyNames() As String Get Return _GridDataKeyNames End Get Set(ByVal value As String) _GridDataKeyNames = value End Set End Property Public Property GridContextMenu() As Boolean Get Return _GridContextMenu End Get Set(ByVal value As Boolean) _GridContextMenu = value End Set End Property Public Property GridRowClick() As Boolean Get Return _GridRowClick End Get Set(ByVal value As Boolean) _GridRowClick = value End Set End Property Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ViewState("gridData") = sectionCache ViewState("GridDataKeyNames") = GridDataKeyNames ViewState("GridContextMenu") = GridContextMenu ViewState("GridRowClick") = GridRowClick Else sectionCache = ViewState("gridData") GridDataKeyNames = ViewState("GridDataKeyNames") GridContextMenu = ViewState("GridContextMenu") GridRowClick = ViewState("GridRowClick") End If If Not Cache(sectionCache) Is Nothing Then Datasource = Cache(sectionCache) Else Cache(sectionCache) = Datasource End If standardGrid() If Not IsPostBack Then Dim hdn_field As HiddenField = TryCast(Page.Master.FindControl("hdn_pageId"), HiddenField) dataGrid = New DataRadGrid dataGrid.pageId = New Guid(hdn_field.Value.ToString()) dataGrid.coreEntityId = Session.Item("RealId") Dim gridSettings As String = dataGrid.LoadSettings() If gridSettings <> "" Then Dim LoadPersister As New GridSettingsPersister(RadGrid1) LoadPersister.LoadSettings(gridSettings) End If End If End Sub Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource RadGrid1.MasterTableView.VirtualItemCount = Datasource.Rows.Count RadGrid1.DataSource = Datasource End SubProtected Sub standardGrid() If GridRowClick Then If GridDataKeyNames = "" Then GridDataKeyNames = "ROWCLICK" Else GridDataKeyNames += ",ROWCLICK" End If RadGrid1.ClientSettings.ClientEvents.OnRowClick = "RowClick" End If If GridDataKeyNames <> "" Then Dim dataKeyNamesArray() As String = GridDataKeyNames.Split(",".ToArray()) RadGrid1.MasterTableView.ClientDataKeyNames = dataKeyNamesArray RadGrid1.MasterTableView.DataKeyNames = dataKeyNamesArray End If If GridContextMenu Then RadGrid1.ClientSettings.ClientEvents.OnRowContextMenu = "RowContextMenu" End If Dim boundColumn As GridBoundColumn RadGrid1.MasterTableView.Columns.Clear() For Each column As DataColumn In Datasource.Columns If GridDataKeyNames <> "" Then If Not GridDataKeyNames.Contains(column.ColumnName.ToString()) Then If column.ColumnName.ToString().IndexOf("_HIDDEN") < 0 Then boundColumn = New GridBoundColumn RadGrid1.MasterTableView.Columns.Add(boundColumn) boundColumn.DataField = column.ColumnName boundColumn.HeaderText = column.ColumnName.Replace("_", " ") boundColumn.DataFormatString = "<nobr>{0}</nobr>" Else boundColumn = New GridBoundColumn RadGrid1.MasterTableView.Columns.Add(boundColumn) boundColumn.DataField = column.ColumnName boundColumn.HeaderText = column.ColumnName boundColumn.Visible = False End If End If Else If column.ColumnName.ToString().IndexOf("_HIDDEN") < 0 Then boundColumn = New GridBoundColumn RadGrid1.MasterTableView.Columns.Add(boundColumn) boundColumn.DataField = column.ColumnName boundColumn.HeaderText = column.ColumnName.Replace("_", " ") boundColumn.DataFormatString = "<nobr>{0}</nobr>" Else boundColumn = New GridBoundColumn RadGrid1.MasterTableView.Columns.Add(boundColumn) boundColumn.DataField = column.ColumnName boundColumn.HeaderText = column.ColumnName boundColumn.Visible = False End If End If Next End Sub <telerik:RadToolBar runat="server" ID="RadToolBar1" style="overflow:visible;" Skin="Telerik" Width="994px" Height="121px" onbuttonclick="RadToolBar1_ButtonClick"><CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> <Items> <telerik:RadToolBarButton> <ItemTemplate> <div style="padding-left:30px"> <asp:Image ID="imgo" ImageUrl="~/images/Picture3.png" runat="server" /> <asp:Image ID="imgMore" ImageUrl="~/images/Picture5.png" runat="server" /> <asp:TextBox ID="txtSearch" Width="500px" Height="40px" runat="server" /> <asp:ImageButton ID="btnCancel" runat="server" ImageUrl="~/images/Picture11.png" Text="Cancel" /> <asp:ImageButton ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="Search" ImageUrl="~/images/Picture12.png" /> <telerik:RadToolBarButton runat="server" IsSeparator="true"></telerik:RadToolBarButton> <asp:ImageButton ID="btnAttach" runat="server" ImageUrl="~/images/Picture13.png" Text="Add" /> <asp:ImageButton ID="btnAdd" runat="server" ImageUrl="~/images/Picture8.png" Text="Add" /> <asp:ImageButton ID="btnconfig" runat="server" ImageUrl="~/images/Picture9.png" Text="Config" /> <asp:ImageButton ID="btnCommitChanges" runat="server" ImageUrl="~/images/Save All 2.png" Text="Config" /> <telerik:GridTextBoxColumnEditor ID="textboxc" runat="server"></telerik:GridTextBoxColumnEditor> </div> </ItemTemplate> </telerik:RadToolBarButton> </Items> </telerik:RadToolBar>TextBox txtseach = new TextBox();txtseach = (TextBox)Page.FindControl("txtSearch");
private void ConfigureExcelExport() { //ExportExcel configuration settings //rgPostingBill.MasterTableView.Caption = "PostingNotice Billing Report"; RadGrid1.ExportSettings.FileName = "PostingNotice"; RadGrid1.ExportSettings.IgnorePaging = true; //RadGrid1.ExportSettings.HideStructureColumns = true; RadGrid1.MasterTableView.HierarchyDefaultExpanded = true; RadGrid1.ExportSettings.ExportOnlyData = true; RadGrid1.ExportSettings.OpenInNewWindow = true; } protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) { if (isExcelExport) { if (e.Item is GridNoRecordsItem) e.Item.Visible = false; if (e.Item is GridCommandItem) e.Item.Visible = false; //if (e.Item is GridNestedViewItem) // e.Item.Cells[0].Visible = false; //if (e.Item is GridDataItem) //{ // GridDataItem item = e.Item as GridDataItem; // foreach (GridColumn col in e.Item.OwnerTableView.RenderColumns) // if (!(col is GridBoundColumn)) // item[col.UniqueName].Visible = false; //} } }
Hi.
I'm have RadGrid with 2 DropDownColumns. Then i need third column with value, contains concatenated text-field(not value-field) from first 2 dropdown columns. How I can do it?