Telerik Forums
UI for ASP.NET AJAX Forum
38 answers
7.8K+ views

This sticky thread lists known issues and breaking changes introduced in the UI for ASP.NET AJAX releases.


Q3 2011 (Version number: 2011.3.1115)

Problem: When adding items to OData-enabled controls (RadMenu, RadTreeView, RadListBox, RadComboBox) through design time erroneous markup is applied to the control:

<telerik:RadListBox runat="server" ID="RadListBox1">
    <Items>
    </Items>
    <WebServiceSettings>
        <ODataSettings InitialContainerName="">
        </ODataSettings>
    </WebServiceSettings>
</telerik:RadListBox>

Please note the added ODataSettings section. It will cause JavaScript errors on the page.

Solution: Remove the ODataSetting section and the issue will vanish. The problem is also fixed in the Q3 SP1 release, version number 2011.3.1305
Attila Antal
Telerik team
 updated answer on 05 Mar 2024
1 answer
606 views

When I run my project I'm getting this error

Could not load file or assembly 'Telerik.Web.UI' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

In my web.config I checked that the version in the web.config is the same as the version I'm using in references

<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2020.2.617.45" newVersion="2020.2.617.45" />

 

Vessy
Telerik team
 answered on 22 Oct 2021
1 answer
4 views
I was curious if anyone could point me in the right direction on how to show a webpage within telerik controls. I am not sure where to start on this and cant seem to find any relevant information.
Rumen
Telerik team
 answered on 23 Jul 2024
1 answer
17 views

Dear All,

I'm using radcontextmenu with radgrid. Normally right click event on all rows of radgrid is showing menus. It is ok. But after i drag and group roomtype column, some rows right click event is showing radcontextmenus and some rows right click event is showing browser default menus. When i debug in browser, showing "TypeError: Cannot read properties of undefined (reading 'getDataKeyValue')"  in  RadGridID.get_masterTableView().get_dataItems()[currentSelectedRowIndex].getDataKeyValue("ReservationKey")) of javascript file. I searched in google, but not found. Please ask me. What I need to change or code?

.aspx

<telerik:RadGrid ID="RadGrid1" EnableViewState="true" ViewStateMode="Enabled" GridLines="None" MasterTableView-GroupLoadMode="Server"
    runat="server" ShowStatusBar="false" AllowSorting="true" ShowGroupPanel="true" ShowFooter="true"
    OnNeedDataSource="grdReservation_NeedDataSource" OnSortCommand="grdReservation_SortCommand" OnItemDataBound="grdReservation_ItemDataBound" OnItemCommand="grdReservation_ItemCommand">
    <MasterTableView AutoGenerateColumns="false" DataKeyNames="ReservationKey" ItemStyle-Wrap="true" Width="100%" GroupsDefaultExpanded="false"
        ClientDataKeyNames="ReservationKey,Status,Remark,SubFolioBalance">
        <Columns>            
            <telerik:GridBoundColumn DataField="Status" HeaderStyle-Width="25px" SortExpression="Status" UniqueName="Status">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ReservationType" HeaderStyle-Width="25px" SortExpression="ReservationType" UniqueName="Type">
            </telerik:GridBoundColumn>                      
            <telerik:GridBoundColumn DataField="Company" HeaderStyle-Width="160px" HeaderText="Group Name/Company" SortExpression="Company" ItemStyle-Wrap="false"
                UniqueName="GroupNameCompany">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="RoomType" HeaderText="RoomType" SortExpression="RoomType" HeaderStyle-Width="80px"
                UniqueName="RoomType">
            </telerik:GridBoundColumn>            
            <telerik:GridBoundColumn DataField="Balance" HeaderStyle-Width="70px" HeaderText="Balance" SortExpression="Balance" ItemStyle-HorizontalAlign="Right"
                UniqueName="Balance">
            </telerik:GridBoundColumn>            
        </Columns>
        <NoRecordsTemplate>
            No Records
        </NoRecordsTemplate>
    </MasterTableView>
    <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" AllowDragToGroup="true" EnableRowHoverStyle="true" AllowGroupExpandCollapse="false"  AllowRowsDragDrop="true">
        <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
        <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false" ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" />
        <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="380px" SaveScrollPosition="true" />
        <ClientEvents OnRowDblClick="rowDblClick" OnRowSelected="OnRwSelected" OnRowMouseOver="OnRowMouseOver" OnRowContextMenu="rowContextMenu" />
    </ClientSettings>
</telerik:RadGrid>
<telerik:RadContextMenu ID="RadContextMenu1" runat="server" EnableRoundedCorners="true" RenderMode="Lightweight" SkinID="MinimalSetOfTools" CssClass="centered-editor" Width="300px" EnableShadows="true"
    OnClientItemClicking="onContextMenuItemClick"
    OnClientShowing="onClientContextMenuShowing">
    <DefaultGroupSettings ExpandDirection="Auto" Flow="Vertical" />
</telerik:RadContextMenu>

 

<script src="../JavaScripts/util/Utilities.js" type="text/javascript"></script>
<script src="../JavaScripts/util/WrapperRadGrid.js" type="text/javascript"></script>
<script src="../JavaScripts/bal/Reservation.js" type="text/javascript"></script>
<script src="../../JavaScripts/lib/jquery.blockUI.min.js" type="text/javascript"></script>

<script type="text/javascript">

function ReloadSelectedRow() {
    var grid = $find("<%=grdReservation.ClientID%>");
    var master = grid.get_masterTableView();

    var scrollArea = document.getElementById(grid.get_element().id + "_GridData");
    var row = master.get_selectedItems()[0];
    currentSelectedRowIndex = row.get_itemIndex();
    GlobalObjectControls.ResKey = row.getDataKeyValue("ReservationKey");
    if (row) {
        if ((row.get_element().offsetTop - scrollArea.scrollTop) + row.get_element().offsetHeight + 20 > scrollArea.offsetHeight) {
            //scroll down to selected row                     
            scrollArea.scrollTop = scrollArea.scrollTop + ((row.get_element().offsetTop - scrollArea.scrollTop) +
                row.get_element().offsetHeight - scrollArea.offsetHeight) + row.get_element().offsetHeight + 150;
        }
        //if the position of the the selected row is above the viewable grid area  
        else if ((row.get_element().offsetTop - scrollArea.scrollTop) < 0) {
            //scroll the selected row to the top                   
            scrollArea.scrollTop = row.get_element().offsetTop;
        }
    }
}

</script>

 <script type="text/javascript" id="commonMethods">
     var GlobalObjectControls = {};

     Sys.Application.add_load(
         function loadHandler() {
             Sys.Application.remove_load(loadHandler);             
             ReloadSelectedRow();
         });

</script>

<script>

function rowContextMenu(sender, eventArgs) {
    currentSelectedRowIndex = eventArgs.get_itemIndexHierarchical();    
    eventArgs.get_tableView().selectItem(eventArgs.get_itemIndexHierarchical());
    var menu = GlobalObjectControls.ContextMenu;    
    var evt = eventArgs.get_domEvent();
    menu.show(evt);
    evt.cancelBubble = true;
    evt.returnValue = false;
    if (evt.stopPropagation) {
        evt.stopPropagation();
        evt.preventDefault();
    }
}

function OnRwSelected(sender, args) {
    GlobalObjectControls.ResKey = args.getDataKeyValue('ReservationKey');
    currentSelectedRowIndex = args.get_itemIndexHierarchical();        
}

function onClientContextMenuShowing(sender) {    
    enabledisableMenuItems();
}

function enabledisableMenuItems() {
    var menu = GlobalObjectControls.ContextMenu;
    alert("ok" + currentSelectedRowIndex);    // this is ok, index is showing
   

var reservationkey = GlobalObjectControls.GridReservation.get_masterTableView().get_dataItems([currentSelectedRowIndex]

.getDataKeyValue("ReservationKey");  // this row is showing error "can't read properties of undefined

 

    var status = GlobalObjectControls.GridReservation.get_masterTableView().get_dataItems()[currentSelectedRowIndex].getDataKeyValue("Status");
    var reservationType = getReservationType();

menu.enable();

}

function onContextMenuItemClick(sender, args) {

}

</script>

Vasko
Telerik team
 answered on 19 Jul 2024
1 answer
11 views

I am having issues calling the asset_SN value from a grid that does have a value (see picture) and feel my syntax is wrong as it states there isnt an object and when I look at portion of file output it is blank in the debugger (attached error code).

Frontend:
<telerik:RadGrid ID="RadGrid" runat="server" RenderMode="Auto" AllowPaging="True"  OnItemDataBound="RadGrid_ItemDataBound" OnNeedDataSource="RadGrid_NeedDataSource" 
    OnItemCommand="RadGrid_ItemCommand" OnItemCreated="RadGrid_ItemCreated" OnDeleteCommand="RadGrid_ItemDeleted" AllowSorting="true" AllowFilteringByColumn="true" 
    FilterType="HeaderContext" EnableHeaderContextMenu="True" EnableHeaderContextFilterMenu="True">   



<telerik:GridBoundColumn DataField="asset_SN" FilterControlAltText="Filter asset_SN column" HeaderText="Serial Number" SortExpression="asset_SN" UniqueName="asset_SN"></telerik:GridBoundColumn>


Backend: 
Dim assetSN As String = TryCast(editedItem.FindControl("asset_SN"), TextBox).Text

Error:

System.NullReferenceException: 'Object reference not set to an instance of an object.'

TryCast(..., System.Web.UI.WebControls.TextBox) returned Nothing.


Vasko
Telerik team
 answered on 19 Jul 2024
1 answer
59 views

Greetings all,

I have just discovered the margin properties in the PDFSettings sub-category of the RadClientExportManager.

Using the left & right margins, I could address some of my concerns as to how close the edge of the export comes to the edge of the displayed area, I cannot seem to make the bottom margin value work. 

Across my exports, I am using:

        RadClientExportManager1.PdfSettings.MarginLeft = "15"
        RadClientExportManager1.PdfSettings.MarginRight = "15"
        RadClientExportManager1.PdfSettings.MarginBottom = "30"

Can anyone let me know if there is a problem in setting the bottom margin, or any of the margins? Or even how the inner workings of the control handles blank space or padding around the indicated div?

Thanks in advance! 

Adam
Top achievements
Rank 1
Iron
 answered on 15 Jul 2024
1 answer
8 views

Hello,

Is any standard method to disable edit in the HTML mode available?

HTML mode must be visible to show output code, but now allowed for users to edit using it, only using Design.

Thank you.

Rumen
Telerik team
 updated answer on 12 Jul 2024
1 answer
10 views

Hello, At this time 3 edit modes are available. I wanted to add "Preview Accepted" mode, which will work like Preview + will show content as already Accepted. Because it is very helpful for user to be sure that after Accept all will be fine.

Alternative option to show button in the View tab of the RibbonBar, but Mode toolbox div is more preferable place.

Thank you.

Rumen
Telerik team
 answered on 11 Jul 2024
1 answer
17 views

Good evening,

I'm trying to export a RadGrid to xlsx using RadGrid_ItemCommand and RadGrid.ExportToExcelCommandName.

I have a template column:

<telerik:GridTemplateColumn HeaderText="Column1" SortExpression="Column1" DataField="Column1" UniqueName="Column1" ColumnGroupName="Column1Data" AllowFiltering="false">
<EditItemTemplate>
<telerik:RadTextBox ID="txtColumn1" runat="server" RenderMode="Lightweight" MaxLength="6" Width="200px" Text='<%# Bind("Column1") %>' />
<asp:RequiredFieldValidator ID="reqColumn1" runat="server" ControlToValidate="txtColumn1" CssClass="standard-text" ErrorMessage="RequiredFieldValidator" Text="This field is required" />
</EditItemTemplate>
<ItemTemplate>
 <%#DataBinder.Eval(Container.DataItem, "Column1", "{0:@}")%>
</ItemTemplate>
</telerik:GridTemplateColumn>

It contains up to 6 alphanumeric characters e.g.:


When the value 07E3 is exported to xlsx (and there are other similar values that give this behaviour) it is exporting as Scientific format:

What can be done to make sure it is displayed as Text format in Excel, without having to use an Excel template file?

Kind regards,

Richard

Vasko
Telerik team
 answered on 11 Jul 2024
2 answers
16 views

I was curious if there was a way to add a radcombobox with load on demand abilities within an exisiting radgrid. I really just need to have it that when you start typing it will then populate any items that start with the letter/numbers you are typing dynamically. For example, if I typed Batt it would autofill Battery or if I had done Serial Number it would populate all that apply. I have seen it outside of a grid but not within. In the picture below would like to have the asset_type autofill options from database that are in the asset_type column.  Any examples would be great.


Imports System.Data
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.Web.UI
Imports System.Configuration
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI

Partial Class RadGridEditCustomValidatorVB
    Inherits Page

    ' Page Load event
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            RadGrid.Rebind()
        End If
    End Sub

    ' Bind the grid to the data source
    Protected Sub RadGrid_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs)
        RadGrid.DataSource = GetGridSource()
    End Sub

    ' Get data from the database
    Private Function GetGridSource() As DataTable
        Dim dataTable As New DataTable()

        ' Get the connection string from the web.config file
        Dim connectionString As String = ConfigurationManager.ConnectionStrings("Data_WarehouseConnectionString_PRODUCTION").ConnectionString
        Using connection As New SqlConnection(connectionString)
            Dim query As String = "SELECT [ID], [Asset_type], [PortalID], [asset_SN], [asset_model], [Maint_Date], [Fill_qty], [asset_location], [Active_indicator], [Asset_Notes] FROM [data_warehouse].[dbo].[ATracker]"
            Using command As New SqlCommand(query, connection)
                Using adapter As New SqlDataAdapter(command)
                    adapter.Fill(dataTable)
                End Using
            End Using
        End Using

        Return dataTable
    End Function

    Protected Sub RadGrid_ItemCreated(sender As Object, e As GridItemEventArgs)
        If e.Item.IsInEditMode Then
            Dim item As GridEditableItem = TryCast(e.Item, GridEditableItem)

            ' Add validator for Asset_type (Non-nullable)
            Dim assetTypeEditor As GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("Asset_type"), GridTextBoxColumnEditor)
            AddRequiredFieldValidator(assetTypeEditor.TextBoxControl, "Asset Type")

            ' Add validator for PortalID (Non-nullable)
            Dim portalIDEditor As GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("PortalID"), GridTextBoxColumnEditor)
            AddRequiredFieldValidator(portalIDEditor.TextBoxControl, "PortalID")

            ' Add validator for asset_sn (Non-nullable)
            Dim assetSNEditor As GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("asset_SN"), GridTextBoxColumnEditor)
            AddRequiredFieldValidator(assetSNEditor.TextBoxControl, "Asset Serial Number")

            ' Add validator for asset_model (Non-Nullable)
            Dim assetModelEditor As GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("asset_model"), GridTextBoxColumnEditor)
            AddRequiredFieldValidator(assetModelEditor.TextBoxControl, "Asset Model")

            ' Add validator for asset_location (Nullable)
            Dim assetLocEditor As GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("asset_location"), GridTextBoxColumnEditor)
            AddRequiredFieldValidator(assetLocEditor.TextBoxControl, "Location")

            ' Add validator for Fill_qty (Nullable but must be numeric if provided)
            Dim fillQtyEditor As GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("Fill_qty"), GridTextBoxColumnEditor)
            AddNumericValidator(fillQtyEditor.TextBoxControl, "Fill Quantity")

            Dim buttonName As String = If(TypeOf item Is IGridInsertItem, "PerformInsertButton", "UpdateButton")
            TryCast(item.FindControl(buttonName), Button).ValidationGroup = "gridFormValidation"
        End If
    End Sub

    Private Sub AddRequiredFieldValidator(textBox As TextBox, fieldName As String)
        Dim validator As New CustomValidator()
        validator.ID = "CustomValidator_" & fieldName.Replace(" ", "_")
        validator.ControlToValidate = textBox.ID
        validator.ValidateEmptyText = True
        validator.ErrorMessage = String.Format("* {0} is required", fieldName)
        validator.ForeColor = Color.OrangeRed
        validator.ClientValidationFunction = "requiredFieldValidation"
        validator.ValidationGroup = "gridFormValidation"
        AddHandler validator.ServerValidate, AddressOf RequiredField_ServerValidate
        textBox.Parent.Controls.Add(validator)
    End Sub

    Private Sub AddNumericValidator(textBox As TextBox, fieldName As String)
        Dim validator As New CustomValidator()
        validator.ID = "CustomValidator_" & fieldName.Replace(" ", "_")
        validator.ControlToValidate = textBox.ID
        validator.ValidateEmptyText = False
        validator.ErrorMessage = String.Format("* {0} must be numeric", fieldName)
        validator.ForeColor = Color.OrangeRed
        validator.ClientValidationFunction = "numericFieldValidation"
        validator.ValidationGroup = "gridFormValidation"
        AddHandler validator.ServerValidate, AddressOf NumericField_ServerValidate
        textBox.Parent.Controls.Add(validator)
    End Sub

    Protected Sub RequiredField_ServerValidate(source As Object, args As ServerValidateEventArgs)
        args.IsValid = Not String.IsNullOrWhiteSpace(args.Value)
    End Sub

    Protected Sub NumericField_ServerValidate(source As Object, args As ServerValidateEventArgs)
        Dim result As Decimal
        args.IsValid = Decimal.TryParse(args.Value.Trim(), result)
    End Sub

    Protected Sub RadGrid_ItemCommand(sender As Object, e As GridCommandEventArgs)
        If e.CommandName = RadGrid.UpdateCommandName Or e.CommandName = RadGrid.PerformInsertCommandName Then
            If Page.IsValid Then
                Dim editableItem As GridEditableItem = TryCast(e.Item, GridEditableItem)

                'Runs Validation Code from RequiredField_ServerValidate and NumericField_ServerValidate
                Dim txtAssetType As TextBox = CType(editableItem("Asset_type").Controls(0), TextBox)
                Dim txtPortalID As TextBox = CType(editableItem("PortalID").Controls(0), TextBox)
                Dim txtSerialNum As TextBox = CType(editableItem("asset_SN").Controls(0), TextBox)
                Dim txtFillQty As TextBox = CType(editableItem("Fill_qty").Controls(0), TextBox)
                Dim rdpMaintDate As RadDatePicker = CType(editableItem("Maint_Date").Controls(0), RadDatePicker)
                Dim txtLocation As TextBox = CType(editableItem("asset_location").Controls(0), TextBox)
                Dim txtModel As TextBox = CType(editableItem("asset_model").Controls(0), TextBox)
                Dim chkActive As CheckBox = CType(editableItem("Active_indicator").Controls(0), CheckBox)
                Dim txtNotes As TextBox = CType(editableItem("Asset_Notes").Controls(0), TextBox)

                Dim objConnection As SqlConnection
                Dim strSQL As String


                objConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("Data_WarehouseConnectionString_PRODUCTION").ConnectionString)

                'Testing DB connection
                'objConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("masterConnectionString").ConnectionString)

                'Determine if we are updating or inserting
                If e.CommandName = RadGrid.UpdateCommandName Then
                    strSQL = "UPDATE [data_warehouse].[dbo].[ATracker] SET [Asset_type] = @asset_type, [PortalID] = @PortalID, [asset_SN] = @AssetSN, [Fill_qty] = @FillQty, [Maint_Date] = @MaintDate, [asset_location] = @Location, [asset_model] = @Model, [Active_indicator] = @Active, [Asset_Notes] = @Notes WHERE [ID] = @ID"
                Else
                    strSQL = "INSERT INTO [data_warehouse].[dbo].[ATracker] ([Asset_type], [PortalID], [asset_SN], [Fill_qty], [Maint_Date], [asset_location], [asset_model], [Active_indicator], [Asset_Notes]) VALUES (@asset_type, @PortalID, @AssetSN, @FillQty, @MaintDate, @Location, @Model, @Active, @Notes)"
                End If

                'Add parameters to the SQL command
                Dim cmd As New SqlCommand(strSQL, objConnection)
                cmd.Parameters.Add("@asset_type", SqlDbType.VarChar, 20).Value = txtAssetType.Text
                cmd.Parameters.Add("@ID", SqlDbType.Int).Value = If(e.CommandName = RadGrid.UpdateCommandName, editableItem.GetDataKeyValue("ID"), DBNull.Value)
                cmd.Parameters.Add("@PortalID", SqlDbType.VarChar, 10).Value = txtPortalID.Text
                cmd.Parameters.Add("@AssetSN", SqlDbType.VarChar, 20).Value = txtSerialNum.Text
                cmd.Parameters.Add("@FillQty", SqlDbType.Int).Value = If(String.IsNullOrEmpty(txtFillQty.Text), DBNull.Value, Convert.ToInt32(txtFillQty.Text))
                cmd.Parameters.Add("@MaintDate", SqlDbType.Date).Value = If(rdpMaintDate.SelectedDate Is Nothing, DBNull.Value, rdpMaintDate.SelectedDate)
                cmd.Parameters.Add("@Location", SqlDbType.VarChar, 20).Value = txtLocation.Text
                cmd.Parameters.Add("@Model", SqlDbType.VarChar, 20).Value = txtModel.Text
                cmd.Parameters.Add("@Active", SqlDbType.Bit).Value = chkActive.Checked
                cmd.Parameters.Add("@Notes", SqlDbType.VarChar, -1).Value = txtNotes.Text

                Try
                    objConnection.Open()
                    cmd.ExecuteNonQuery()
                Catch ex As Exception
                    System.Console.WriteLine(ex.ToString())
                Finally
                    objConnection.Close()
                End Try

                RadGrid.Rebind()
            Else
                e.Canceled = True
            End If
        End If
    End Sub


    'CANT GET THIS TO TRIGGER
    Protected Sub RadGrid_ItemDeleted(sender As Object, e As GridCommandEventArgs)
        If e.CommandName = RadGrid.DeleteCommandName Then
            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

            If item IsNot Nothing Then
                ' Find the hidden field in the grid data item where ID is bound
                Dim atID As Integer = Convert.ToInt32(item.OwnerTableView.DataKeyValues(item.ItemIndex)("ID"))

                Dim objConnection As SqlConnection
                Dim strSQL As String

                objConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("Data_WarehouseConnectionString_PRODUCTION").ConnectionString)

                ' SQL command to delete the record where ID matches
                strSQL = "DELETE FROM [data_warehouse].[dbo].[ATracker] WHERE [ID] = @ID"

                Dim cmd As New SqlCommand(strSQL, objConnection)
                cmd.Parameters.Add("@ID", SqlDbType.Int).Value = atID

                Try
                    objConnection.Open()
                    cmd.ExecuteNonQuery()
                Catch ex As Exception
                    System.Console.WriteLine(ex.ToString())
                Finally
                    objConnection.Close()
                End Try
            End If

            RadGrid.Rebind()
        End If
    End Sub


    'Show a dropdown list of the asset types in the database

    Protected Sub RadGrid_ItemDataBound(sender As Object, e As GridItemEventArgs)
        If e.Item.IsInEditMode Then
            Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem)

            If Not (TypeOf e.Item Is IGridInsertItem) Then
                Dim combo As RadComboBox = DirectCast(item.FindControl("Asset_type"), RadComboBox)

                Dim preselectedAsset As New RadComboBoxItem()
                preselectedAsset.Text = item("Asset_type").Text
                preselectedAsset.Value = item("Asset_type").Text
                combo.Items.Insert(0, preselectedAsset)
            End If
        End If
    End Sub



End Class

    <form id="form1" runat="server">
        <telerik:RadStyleSheetManager ID="RadStyleSheetManager2" runat="server"></telerik:RadStyleSheetManager>
        <telerik:RadScriptManager ID="RadScriptManager2" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"></telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid" runat="server" AllowPaging="True" Width="800px"
            OnNeedDataSource="RadGrid_NeedDataSource" OnItemCommand="RadGrid_ItemCommand" onitemdatabound="RadGrid_ItemDataBound"
            OnItemCreated="RadGrid_ItemCreated" OnDeleteCommand="RadGrid_ItemDeleted" Skin="MetroTouch">
            <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
            <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataKeyNames="ID">
                <RowIndicatorColumn ShowNoSortIcon="False"></RowIndicatorColumn>
                <ExpandCollapseColumn ShowNoSortIcon="False"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID" Visible="False"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Asset_type" FilterControlAltText="Filter Asset_type column" HeaderText="Asset_type" SortExpression="Asset_type" UniqueName="Asset_type" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="PortalID" FilterControlAltText="Filter PortalID column" HeaderText="PortalID" SortExpression="PortalID" UniqueName="PortalID"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="asset_SN" FilterControlAltText="Filter asset_SN column" HeaderText="Serial Number" SortExpression="asset_SN" UniqueName="asset_SN"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="asset_model" FilterControlAltText="Filter asset_model column" HeaderText="Model" SortExpression="asset_model" UniqueName="asset_model"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="asset_location" FilterControlAltText="Filter asset_location column" HeaderText="Location" SortExpression="asset_location" UniqueName="asset_location"></telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="Maint_Date" FilterControlAltText="Filter Maint_Date column" HeaderText="Date of Service" SortExpression="Maint_Date" UniqueName="Maint_Date"></telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn DataField="Fill_qty" FilterControlAltText="Filter Fill_qty column" HeaderText="Fill Qty (Gallons)" SortExpression="Fill_qty" UniqueName="Fill_qty"></telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="Active_indicator" DataType="System.Boolean" FilterControlAltText="Filter Active_indicator column" HeaderText="Active?" SortExpression="Active_indicator" UniqueName="Active_indicator"></telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Asset_Notes" FilterControlAltText="Filter Notes column" HeaderText="Notes" SortExpression="Asset_Notes" UniqueName="Asset_Notes"></telerik:GridBoundColumn>
                    <telerik:GridEditCommandColumn EditText="Edit" />
                    <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this record?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" CommandName="Delete" Text="Delete" />
                                  

                </Columns>
               
            </MasterTableView>
        </telerik:RadGrid>
    </form>

Rumen
Telerik team
 answered on 10 Jul 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Michael
Top achievements
Rank 2
Iron
Wilfred
Top achievements
Rank 1
Alexander
Top achievements
Rank 2
Iron
Iron
Matthew
Top achievements
Rank 1
Iron
ibra
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Michael
Top achievements
Rank 2
Iron
Wilfred
Top achievements
Rank 1
Alexander
Top achievements
Rank 2
Iron
Iron
Matthew
Top achievements
Rank 1
Iron
ibra
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?