I would like to turn the ID column of a dynamically created table into an edit button. Is this possible? I have seen plenty of documents on creating button columns, but I want to convert a column from text to a button column in the _ColumnCreated or covert each cell in the _PreRender.
Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles QueryRadGrid.PreRender Dim intColIndex As Integer Dim gridRow As GridDataItem For Each column As GridColumn In QueryRadGrid.MasterTableView.AutoGeneratedColumns If column.UniqueName = "ID" Then intColIndex = column.OrderIndex For Each gridRow In QueryRadGrid.MasterTableView.Items Dim editCol As GridButtonColumn = New GridButtonColumn editCol.ButtonType = GridButtonColumnType.LinkButton editCol.DataTextField = gridRow.Cells(intColIndex).Text ' How do I convert this cell??? 'gridRow.Cells(intColIndex) = ??? Next End If NextPrivate Sub QueryRadGrid_ColumnCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridColumnCreatedEventArgs) Handles QueryRadGrid.ColumnCreated Dim field As String Try field = e.Column.UniqueName If Not field = Nothing AndAlso field <> "" AndAlso field <> "ExpandColumn" Then If DataSet.Tables(TableName).Columns(field).ColumnName = "ID" Then e.Column.HeaderText = ""
DO SOMETHING HERE TO CONVERT COLUMNThere is a dropdownlist being populated in the OnItemDataBound event.
protected void RadGrid1_OnItemDataBound(object source, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem gEditableItem = (GridEditableItem)e.Item; //hit the framework and get a datatable DropDownList ddlEffectiveDate = (DropDownList)gEditableItem["efct_period_date"].FindControl("DdlEffectiveDate"); ddlEffectiveDate.DataSource = dt; dlEffectiveDate.DataTextField = "start_date"; ddlEffectiveDate.DataValueField = "period_id"; ddlEffectiveDate.DataBind(); ddlEffectiveDate.Items.Remove(ddlEffectiveDate.Items[0]); | <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="btnTest"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="btnTest" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" |
| Skin="Default"> |
| </telerik:RadAjaxLoadingPanel> |
| <asp:Button runat="server" Text="OK" ID="btnTest" /> |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| if (Page.IsPostBack) |
| { |
| throw new Exception("test"); |
| } |
| } |
Hello,
I'd like to persist the selected Items on client side. I've found an article that describes the solution for RadGrids: http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html .
I tried to apply this solution for RadTreeList. I've replaced the OnRowCreated, OnRowSelected, OnRowDeselected, OnGridCreated event handlers with OnItemCreated, OnItemSelected, OnItemDeselected, OnTreeListCreated event handlers. When the grid is created the OnItemCreated even handler fires and the connected javascript is invoked. When this script invokes the args.get_item().set_selected(true); method I receive a javascript error message the tells me that the this._owner._selectedItems is null. After debugging the script I found that the _owner is null. I thought when this event handler is fired all properties of the item has been set. It seems that I was wrong.
Could you tell me how I can change the selection of a item when the page is loaded or the node is expanded or the control is paginated?