Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
58 views
Hi 
I need two horizontal bar with multiple plotarea inside the bar as shown in the attached image
Nikolay
Telerik team
 answered on 06 Aug 2013
2 answers
119 views
Hello, i have a problem with RadHtmlChart . In several cases it does not visualize simple data. By the link (http://www.4shared.com/zip/VwnV4RZf/RadHtmlChartErr2013.html)  you can download simple project where i reproduce the problem. All the logic related to problem is inplemented in the default.aspx.cs 
There is a data file attached a to which the link had been made where the problem reproduces and there is a data file also where the problem does not reproduce.

Best Regards.
Stamo Gochev
Telerik team
 answered on 06 Aug 2013
1 answer
114 views
Hi!
Can i use for "image" mode operation server side api and "canvas" mode use canvas?
that is
for http://clip2net.com/clip/m116377/1375370570-clip-4kb.jpg
use server api
and for
http://clip2net.com/clip/m116377/1375370636-clip-2kb.jpg
use canvas mode
Vessy
Telerik team
 answered on 06 Aug 2013
3 answers
63 views
Hi,
I need to use DefaultFilterFunction  but inside the RadFilterTextFieldEditor tag but it is showing error as the text editor does not have a public property "DefaultFilterFunction "
Konstantin Dikov
Telerik team
 answered on 06 Aug 2013
4 answers
217 views
Hi Everyone,
I Have lot of RadGrids in site, and about 20% have this issue: column lines are not fit to column headers. Can anyone help with this ?
I saw, that if in grid is lot of data, headers are moved. If I limit records to show, radgrid displays data properly. Is any property, which i have to set?

I have attached sample screenshot.
R
Top achievements
Rank 1
 answered on 06 Aug 2013
3 answers
351 views
Hi,

I have a radwindow in the aspx. During runtime how can I add a content template to it?

Thanks
Tia
Princy
Top achievements
Rank 2
 answered on 06 Aug 2013
4 answers
245 views
Hi,

I have a treelist control with load on demand enabled. I need to expand items to first level for which i used " ExpandToLevel(1) " . Things were fine when i was having the older version of telerik. I recently upgraded it to the latest version and found this issue. On initial load things are fine. When i try to expand any item all the expanded levels and the buttons for expanding are lost and only the first level items are seen. For more information reg the problem pls check the sample code below.
protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RadTreeList1.ExpandToLevel(1);               
            }           
        }
 
        protected void RadTreeList1_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
        {
            RadTreeList1.DataSource = GetDataTable("SELECT * FROM TestItems WHERE ParentID IS NULL", null);
        }
 
        protected void RadTreeList1_ChildItemsDataBind(object sender, TreeListChildItemsDataBindEventArgs e)
        {
            int id = Convert.ToInt32(e.ParentDataKeyValues["ID"].ToString());
            SqlParameter param = new SqlParameter();
            param.ParameterName = "@ID";
            param.Value = id;
            e.ChildItemsDataSource = GetDataTable("SELECT * FROM TestItems WHERE ParentID = @ID", param);
        }
 
        private DataTable GetDataTable(string query, SqlParameter param)
        {
            SqlConnection conn = new SqlConnection(ConnString);
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand command = new SqlCommand(query, conn);
 
            if (param != null)
            {
                command.Parameters.Add(param);
            }
            adapter.SelectCommand = command;
            DataTable myDataTable = new DataTable();
 
            conn.Open();
            try
            {
                adapter.Fill(myDataTable);
            }
            finally
            {
                conn.Close();
            }
 
            return myDataTable;
        }
 
        private void ConvertEmptyValuesToDBNull(Hashtable values)
        {
            List<object> keysToDbNull = new List<object>();
 
            foreach (DictionaryEntry entry in values)
            {
                if (entry.Value == null || (entry.Value is String && String.IsNullOrEmpty((String)entry.Value)))
                {
                    keysToDbNull.Add(entry.Key);
                }
            }
 
            foreach (object key in keysToDbNull)
            {
                values[key] = DBNull.Value;
            }
        }
 
        private void ExecuteNonQuery(string commandText, Hashtable parameters)
        {
            SqlConnection conn = new SqlConnection(ConnString);
            SqlCommand command = new SqlCommand(commandText, conn);
 
            foreach (DictionaryEntry entry in parameters)
            {
                command.Parameters.AddWithValue(entry.Key.ToString(), entry.Value);
            }
 
            conn.Open();
            try
            {
                command.ExecuteNonQuery();
            }
            finally
            {
                conn.Close();
            }
        }

Thanks,
Karthik
Pavlina
Telerik team
 answered on 06 Aug 2013
7 answers
299 views

In my aspx page, when user click a "Preview" button in radtoolbar it will redirect to another page with querystring. but i get the following error

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

I had already tried to use both scriptblock and codeblock, but it doen't work

<%@ Page Title="" Language="VB" MasterPageFile="~/LRDB.master" AutoEventWireup="false" CodeFile="SIMPER_details.aspx.vb" Inherits="TrainingAdmin_SIMPER_details" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
       .table_photo
        {
            width: 100px;
            height: auto;
        }
 
      .table_content
      {
          width: 400px;
          }
             
            .table_header
            {
                width: 282px;
                height: 15px;
                background-color: #E7EEF6;
            }
             
       .style6
    {
        width: 392px;
        height: 15px;
        background-color: #E7EEF6;
        font-weight: 700;
    }
             
       </style>
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
       <script type="text/javascript">
           //        var lastClickedItem = null;
           //        var clickCalledAfterRadprompt = false;
           //        var clickCalledAfterRadconfirm = false;
           //        function onClientButtonClicking(sender, args) {
           //            if (args.get_item().get_text() == "Create SIMPER") {
           //                if (!clickCalledAfterRadconfirm) {
           //                    args.set_cancel(true);
           //                    lastClickedItem = args.get_item();
           //                    radconfirm("Are you sure you want to create?", confirmCallbackFunction);
           //                }
           //            }
           //            else if (args.get_item().get_text() == "Delete") {
           //                if (!clickCalledAfterRadconfirm) {
           //                    args.set_cancel(true);
           //                    lastClickedItem = args.get_item();
           //                    radconfirm("Are you sure you want to delete?", confirmCallbackFunction);
           //                }
           //            }
 
           //        }
 
           //        function confirmCallbackFunction(args) {
           //            if (args) {
           //                clickCalledAfterRadconfirm = true;
           //                lastClickedItem.click();
           //            }
           //            else
           //                clickCalledAfterRadconfirm = false;
           //            lastClickedItem = null;
           //        }
 
           //        OnClientButtonClicking = "onClientButtonClicking"
 
           function ShowSIMPER(id) {
               var wnd = window.radopen("SIMPER_view.aspx?SIMPER_ID=" + id + "&UserID=0", "SIMPER_PDF");
               wnd.SetSize("700", "700");
               wnd.moveTo("250", "140");
               //return false;
           }
        </script>
    </telerik:RadScriptBlock>
 
 
 
    <telerik:RadWindowManager runat="server" ID="rwm1">
    </telerik:RadWindowManager>
     
 
 
    <%--<telerik:RadToolBar ID="RadToolBar1" runat="server" Width="100%" Skin="Windows7" OnClientButtonClicking="onClientButtonClicking" >--%>
 
    <telerik:RadToolBar ID="rtbMenu" runat="server" Width="100%" Skin="Windows7">
        <Items>
            <telerik:RadToolBarButton Value="Preview" Text="Preview SIMPER" Width="150px" Enabled="false"  />
            <telerik:RadToolBarButton IsSeparator="true" />
            <telerik:RadToolBarButton Value="Refresh" Text="Refresh" Width="80px"  CausesValidation="false" />
            <telerik:RadToolBarButton IsSeparator="true" />
            <telerik:RadToolBarButton Value="Back" Text="Back" Width="80px"  CausesValidation="false"/>
            <telerik:RadToolBarButton Value="BackSeparator" IsSeparator="true" />
        </Items>
    </telerik:RadToolBar>
    <telerik:RadFormDecorator ID="RpFormDecorator" runat="server" Skin="Windows7" DecoratedControls="All" EnableRoundedCorners="true" /> 
 
   
 
 
           <div id="content_function" class="content_function" >
 
 
   
 
 
                              <div style="margin-left:5px;">
                              <table cellpadding="1" width="1000" style="vertical-align:top">
                              <tr>
                              <td align="left" valign="top" class="style6">Name
                              </td>
                              <td align="left" valign="top" class="table_content">
                              <asp:Label ID="lb_name" runat="server"></asp:Label>
                              </td>
                              <td align="left" valign="top" class="table_content" rowspan="8">
                                <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" ImageUrl="../images/blank_photo.jpg"
                                               Width="100px" ResizeMode="Fit" AlternateText="No picture available" style="border-style:dotted;"
                                               CssClass="preview" AutoAdjustImageControlSize="false"></telerik:RadBinaryImage>
                                                     </td>
                              </tr>
                              <tr>
                              <td align="left" valign="top" class="style6">Gender
                              </td>
                              <td align="left" valign="top" class="table_content">
                              <asp:Label ID="lb_gender" runat="server"></asp:Label>
                              </td>
                              </tr>                             
                              <tr>
                              <td align="left" valign="top" class="style6">Department
                              </td>
                              <td align="left" valign="top" class="table_content">
                              <asp:Label ID="lb_dept" runat="server"></asp:Label>
                              </td>
                              </tr>
                               
                              <tr>
                              <td align="left" valign="top" class="style6"> </td>
                              <td align="left" valign="top" class="table_content">
                                   </td>
                              </tr>
                               
                              <tr>
                              <td align="left" valign="top" class="style6"><span class="style4">Required
                                  information if create SIMPER:</span> </td>
                              <td align="left" valign="top" class="table_content">
                                   </td>
                              </tr>
                               
                              <tr>
                              <td align="left" valign="top" class="style6">Valid From<br />
                                  </td>
                              <td align="left" valign="top" class="table_content">
                                  <telerik:RadDatePicker ID="RadDatePicker_ValidFrom" Runat="server"
                                      Culture="en-US" MinDate="1/1/1900">
                                  </telerik:RadDatePicker>
                                  <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please enter Valid From." ControlToValidate="RadDatePicker_ValidFrom"></asp:RequiredFieldValidator>
                              </td>
                              </tr>
                               
                              <tr>
                              <td align="left" valign="top" class="style6">Valid Till<br />
                                  </td>
                              <td align="left" valign="top" class="table_content">
                                  <telerik:RadDatePicker ID="RadDatePicker_ValidTill" Runat="server" 
                                      Culture="en-US" MinDate="1/1/1900">
 
                                  </telerik:RadDatePicker>
                                  <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter Valid Till." ControlToValidate="RadDatePicker_ValidTill"></asp:RequiredFieldValidator>
                                  <asp:CompareValidator ID="dateCompareValidator" runat="server" ControlToValidate="RadDatePicker_ValidTill" ControlToCompare="RadDatePicker_ValidFrom"
                                    Operator="GreaterThanEqual" Type="Date" ErrorMessage="Valid Till date must be equal or greater than Valid From date - please correct dates." Display="Dynamic">
                                </asp:CompareValidator>
                              </td>
                              </tr>
                               
                              </table>
                              <br />
                                  <br />
                                  License Obtained<br />
                                  <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="LDS_License"
                                      AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" PageSize="20"
                                      CellSpacing="0" GridLines="None" Width="1000">
                                <MasterTableView DataSourceID="LDS_License" AutoGenerateColumns="False" DataKeyNames="License_To_Operate_ID" OverrideDataSourceControlSorting="true">
                                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
                                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
 
                                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
 
                                    <Columns>
 
                                        <telerik:GridBoundColumn DataField="db_dictionary_license.license_type"
                                            FilterControlAltText="Filter License_Number column" HeaderText="License Type"
                                            SortExpression="db_dictionary_license.license_type" UniqueName="license_type">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="db_dictionary_license.license_name"
                                            FilterControlAltText="Filter License Name column" HeaderText="License Name"
                                            SortExpression="db_dictionary_license.license_name" UniqueName="license_name">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="License_Number"
                                            FilterControlAltText="Filter License_Number column" HeaderText="License Number"
                                            SortExpression="License_Number" UniqueName="License_Number">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="License_Issuer"
                                            FilterControlAltText="Filter License_Issuer column" HeaderText="License Issuer"
                                            SortExpression="License_Issuer" UniqueName="License_Issuer">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Valid_From" DataType="System.DateTime"
                                            FilterControlAltText="Filter Valid_From column" HeaderText="Valid From"
                                            SortExpression="Valid_From" UniqueName="Valid_From" DataFormatString="{0: dd-MMM-yyy}">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Valid_Till" DataType="System.DateTime"
                                            FilterControlAltText="Filter Valid_Till column" HeaderText="Valid Till"
                                            SortExpression="Valid_Till" UniqueName="Valid_Till" DataFormatString="{0: dd-MMM-yyy}">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Issue_date" DataType="System.DateTime"
                                            FilterControlAltText="Filter Issue_date column" HeaderText="Issue Date"
                                            SortExpression="Issue_date" UniqueName="Issue_date" DataFormatString="{0: dd-MMM-yyy}">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="License_ID" Display="false"
                                            FilterControlAltText="Filter License_ID column" HeaderText="License_ID"
                                            UniqueName="License_ID" AllowFiltering="false" >
                                        </telerik:GridBoundColumn>
 
                                    </Columns>
 
                                <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                                </EditFormSettings>
 
                                <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                                </MasterTableView>
 
                                <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
                                <FilterMenu EnableImageSprites="False"></FilterMenu>
                                                                  </telerik:RadGrid>
                                                                  <asp:LinqDataSource ID="LDS_License" runat="server" EntityTypeName=""
                                                                      ContextTypeName="dcLRDBDataContext" TableName="db_Employee_Licenses"
                                                                      Where="UserID == @UserID && tmpRecord != @tmpRecord">
                                                                      <WhereParameters>
                                                                          <asp:QueryStringParameter Name="UserID" QueryStringField="UserID"
                                                                              Type="Int32" />
                                                                          <asp:Parameter DefaultValue="Y" Name="tmpRecord" Type="Char" />
                                                                      </WhereParameters>
                                                                  </asp:LinqDataSource>
 
                                                                  <br /><br /><br />
                                                                  Existing SIMPER Card<br />
                                                                  <telerik:RadGrid ID="RadGrid2" runat="server" AllowFilteringByColumn="True"
                                                                      AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"  OnItemCreated="RadGrid2_ItemCreated"
                                                                      CellSpacing="0" DataSourceID="LDS_SIMPER" GridLines="None" Width="400" onitemcommand="RadGrid2_ItemCommand">
                                                                      <ClientSettings EnablePostBackOnRowClick="true">
                                            <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" /> 
                                        </ClientSettings>
 
                                <MasterTableView DataKeyNames="SIMPER_ID" DataSourceID="LDS_SIMPER">
                                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
                                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
 
                                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
 
                                    <Columns>
                                                <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false">
                                                    <ItemTemplate>
                                                        <asp:HyperLink ID="ViewLink" runat="server" Text="View"></asp:HyperLink>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn DataField="Valid_From" DataType="System.DateTime"
                                            FilterControlAltText="Filter Valid_From column" HeaderText="Valid From"
                                            SortExpression="Valid_From" UniqueName="Valid_From" DataFormatString ="{0: dd-MMM-yyyy}">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Valid_Till" DataType="System.DateTime"
                                            FilterControlAltText="Filter Valid_Till column" HeaderText="Valid Till"
                                            SortExpression="Valid_Till" UniqueName="Valid_Till" DataFormatString ="{0: dd-MMM-yyyy}">
                                        </telerik:GridBoundColumn>
                                    </Columns>
 
                                <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                                </EditFormSettings>
 
                                <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                                </MasterTableView>
 
                                <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
                                <FilterMenu EnableImageSprites="False"></FilterMenu>
                                                                  </telerik:RadGrid>
 
                                        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                                        <Windows>
                                            <telerik:RadWindow ID="SIMPER_PDF" runat="server" Title="View SIMPER Card" Height="700px"
                                                Width="710px" Left="50px" ReloadOnShow="true" ShowContentDuringLoad="false" VisibleStatusBar="false"
                                                Modal="false">
                                            </telerik:RadWindow>
                                        </Windows>
                                        </telerik:RadWindowManager>
 
                                                                  <asp:LinqDataSource ID="LDS_SIMPER" runat="server"
                                                                      ContextTypeName="dcLRDBDataContext" EntityTypeName=""
                                                                      TableName="db_Employee_Simper_Records" Where="UserID == @UserID and parent_id == null">
                                                                      <WhereParameters>
                                                                          <asp:QueryStringParameter Name="UserID" QueryStringField="UserID"
                                                                              Type="Int32" />
                                                                      </WhereParameters>
                                                                  </asp:LinqDataSource>
                                                                  <br />
 
                                                              </div>
 
                                       </div>
                                       </asp:Content>

Code Behind

Imports Telerik.Web.UI
Imports System.Collections
Imports System
 
Partial Class TrainingAdmin_SIMPER_details
    Inherits System.Web.UI.Page
    Private Shared prevPage As String = String.Empty
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            prevPage = Request.UrlReferrer.ToString()
            If Request.QueryString("UserID") <> String.Empty Then
                Dim dc As New dcLRDBDataContext
                Dim res = (From a In dc.db_Employee_Details _
                           Where a.UserID = Request.QueryString("UserID").ToString _
                           From b In dc.db_Departments _
                           .Where(Function(fb) fb.DeptID = a.Dept_ID) _
                           .DefaultIfEmpty() _
                           Select New With { _
                               a.Employee_Display_Name, b.Department, a.Employee_ID, a.Gender, a.Photo _
                                                                  } _
                           ).FirstOrDefault
 
                If Not IsNothing(res) Then
                    lb_name.Text = res.Employee_Display_Name
                    lb_dept.Text = res.Department
                    lb_gender.Text = res.Gender
                    If Not IsNothing(res.Photo) Then
                        RadBinaryImage1.DataValue = res.Photo.ToArray
                    End If
                End If
 
                'Dim res2 = (From a In dc.db_Dictionary_Licenses Where a.License_ID = Request.QueryString("LicenseID").ToString).FirstOrDefault
                'If Not IsNothing(res2) Then
                '    lb_license.Text = res2.License_Name
                'End If
 
                'staff_photo.Src = ConfigurationManager.AppSettings("PhotoPath") & GetEmployeeIDByUserID(Request.QueryString("UserID")).ToString & ".jpg"
                'If System.IO.File.Exists(Server.MapPath(staff_photo.Src)) = True Then
                '    staff_photo.Src = staff_photo.Src
                'Else
                '    staff_photo.Src = ConfigurationManager.AppSettings("PhotoPath") & "/blank_staff_photo.jpg"
                'End If
 
                dc.Dispose()
 
            End If
        End If
    End Sub
    Protected Sub rtbMenu_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles rtbMenu.ButtonClick
        If e.Item.Value = "Back" Then
            Response.Redirect(prevPage)
            'Response.Redirect("~/TrainingAdmin/SIMPER.aspx")
        ElseIf e.Item.Value = "Create" Then
            If CreateSIMPER() = True Then
                Response.Redirect("~/TrainingAdmin/SIMPER_details.aspx?UserID=" & Request.QueryString("UserID"))
            Else
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "alert('Error! SIMPER Card cannot create.');", True)
            End If
        ElseIf e.Item.Value = "Preview" Then
            Dim url = "~/TrainingAdmin/SIMPER_view.aspx?SIMPER_ID=0&UserID=" & Request.QueryString("UserID") _
                      & "&From=" & RadDatePicker_ValidFrom.SelectedDate & "&To=" & RadDatePicker_ValidTill.SelectedDate
            'ScriptManager.RegisterStartupScript(Page, GetType(Page), "OpenWindow", _
            '                                    "window.open('" & url & "','_blank','status=0,toolbar=0,menubar=0,location=0,scrollbars=0,resizable=0,width=710,height=700');", True)
 
            Dim windowManager As New RadWindowManager()
            Dim window1 As New RadWindow()
            ' Set the window properties  
            window1.NavigateUrl = url
            window1.ID = "RadWindow1"
            window1.Height = 750
            window1.Width = 740
            window1.Top = 140
            window1.Left = 250
 
            window1.AutoSize = False
            window1.VisibleTitlebar = True
            window1.VisibleStatusbar = False
            window1.VisibleOnPageLoad = True
            ' Set this property to True for showing window from code  
            windowManager.Windows.Add(window1)
            Me.Form.Controls.Add(window1)
 
        ElseIf e.Item.Value = "Refresh" Then
            Response.Redirect("~/TrainingAdmin/SIMPER_details.aspx?userID=" & Request.QueryString("UserID"))
 
        End If
    End Sub
 
    Protected Function CreateSIMPER() As Boolean
        Dim confirm As Boolean = False
        Dim dc As New dcLRDBDataContext
 
        Dim simperid As Integer = 0
 
        If RadGrid1.Items.Count > 0 Then
            Dim newRecord1 As New db_Employee_Simper_Record
 
            dc.db_Employee_Simper_Records.InsertOnSubmit(newRecord1)
            newRecord1.UserID = Request.QueryString("UserID").ToString
            newRecord1.Valid_From = RadDatePicker_ValidFrom.SelectedDate
            newRecord1.Valid_Till = RadDatePicker_ValidTill.SelectedDate
            newRecord1.Project_ID = HttpContext.Current.Session("SelectedPID").ToString
            newRecord1.LastUpdateDate = DateTime.Now
            newRecord1.LastUpdateBy = HttpContext.Current.Session("UserID")
            dc.SubmitChanges()
            simperid = newRecord1.SIMPER_ID
 
            For Each row As GridDataItem In RadGrid1.Items
                Dim lic_id As String = row("License_ID").Text
                Dim lic_no As String = row("License_Number").Text
                Dim lic_type As String = row("License_Type").Text
                Dim lic_name As String = row("license_name").Text
                Dim lic_issuer As String = row("License_Issuer").Text
                Dim lic_v_from As DateTime = row("Valid_From").Text
                Dim lic_v_till As DateTime = row("Valid_Till").Text
                Dim lic_issue_date As DateTime = row("Issue_date").Text
 
                dc.insertEmployeeSIMPER(simperid, Request.QueryString("UserID").ToString, HttpContext.Current.Session("SelectedPID").ToString, _
                                        lic_id, lic_no, lic_name, lic_type, lic_issuer, lic_v_from, lic_v_till, lic_issue_date,
                                        DateTime.Now, HttpContext.Current.Session("UserID").ToString)
            Next
 
            confirm = True
            dc.Dispose()
        Else
            confirm = False
        End If
 
        Return confirm
    End Function
 
    Protected Sub RadGrid1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.DataBound
        'No License obtained
        If RadGrid1.Items.Count = 0 Then
            rtbMenu.FindItemByValue("Preview").Enabled = False
        Else
            rtbMenu.FindItemByValue("Preview").Enabled = True
        End If
    End Sub
 
    Protected Sub RadGrid2_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
        If TypeOf e.Item Is GridDataItem Then
            Dim editLink As HyperLink = DirectCast(e.Item.FindControl("ViewLink"), HyperLink)
            editLink.Attributes("href") = "javascript:void(0);"
            editLink.Attributes("onclick") = [String].Format("return ShowSIMPER('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("SIMPER_ID"), e.Item.ItemIndex)
        End If
    End Sub
 
    Protected Sub RadGrid2_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
 
        If e.CommandName = "RowClick" Then
 
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            'Dim strId1 As String = item.GetDataKeyValue("UserID").ToString()
            'Response.Redirect("~/TrainingAdmin/SIMPER_details.aspx?UserID=" & strId1)
 
            'Dim editLink As HyperLink = DirectCast(e.Item.FindControl("ViewLink"), HyperLink)
            item.Attributes("href") = "javascript:void(0);"
            item.Attributes("onclick") = [String].Format("return ShowSIMPER('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("SIMPER_ID"), e.Item.ItemIndex)
 
        End If
 
    End Sub
End Class


Maria Ilieva
Telerik team
 answered on 06 Aug 2013
3 answers
265 views
Hello,

I am trying to dynamically delete and all the items in a combobox and then reload it with new items. Here is the code,

function addNewItems(selectRef, optionsArray, valuesArray) 
{                   
var combo = document.getElementById("ddlVehicleMake_Input");                   
combo.get_items().clear();                   
for (var idx = 0; idx < optionsArray.length; idx++) {         
              if (valuesArray == ""
{
                          var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                          comboItem.set_text(optionsArray[idx]);
                          combo.trackChanges();
                          combo.get_items().add(comboItem);
                      } else {                           var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                          comboItem.set_text(optionsArray[idx]);  
                         combo.trackChanges();
                          combo.get_items().add(comboItem);
                      }                   }                   
combo.commitChanges();               }

It fails at combo.get_items().clear(); throwing an error that method is not supported by the object. I think making the following reference should be enough.
Am I missing any references? OR how do I go about it?

Thanks!

Nencho
Telerik team
 answered on 06 Aug 2013
1 answer
261 views
Hi,

I am trying to avoid same file being selected more than one time. I have seen posts and replies such as
http://www.telerik.com/community/forums/aspnet-ajax/async-upload/avoid-duplicate-in-asyncupload-multiple-drag-and-drop.aspx
but when multiple file is selected (not drag/drop but selection from file dialog) all those functions are failing. Mostly, they miss the duplicate item at index 0. I have tried many other ways but could not figure out a solid and reliable way to achieve this.

Please note that I am also handling the file removed event and do some external stuff there, and I either need to find a way for one the scenarios below: 

* catch and cancel duplicates when file is selected (before uploading etc.), in which case I do not need the file removed handler (since file was not actually selected, it was cancelled) 

or

* catch duplicates at files uploaded event, and remove them from file list, properly calling file removed event

When single file is selected, previously suggested functions work fine, but when 6-8 files selected, problems show up.

Please advise.

Thanks.
Hristo Valyavicharski
Telerik team
 answered on 06 Aug 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?