Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
250 views
I'm investigating migrating from the RadUpload control to the RadAsyncUpload tool and am seeing some weird behaviors.

I have a RadAsyncUpload control on my web page and I've customized the TemporaryFolder in the Page_Load. I've also set up the OnFileUploaded method to do some custom work because we want to store a record of the file in our EFile database.

When I do a postback ... the OnFileUploaded method fires and I can see that the e.File.GetName() method returns the correct name of my file but if I'm monitoring the TemporaryFolder -- the file name appears as names like "25j2deve.qc3" and "y20yq3q3.nz1". So then when my code goes to move the file from the TemporaryFolder to our own internal EFolder -- I keep getting the file does not exist because I'm trying to move it based on a file name from the e.File.GetName() method.

I'm also confused by the documentation/tutorial because it uses a function to set the e.IsValid. The function is called CheckUploadedFileValidity().

Where is that function? Is that something I need to write on my own? Is that built into a Telerik library somewhere?

Do I need to be using the .SaveAs() method here like we did in the RadUpload tool? All I want to do is get a file into the temp folder and then I'll move it to the final location from there.

e.IsValid = !CheckUploadedFileValidity();



Plamen
Telerik team
 answered on 04 Mar 2013
1 answer
88 views
Hello,

Could someone confirm me that this issue still persist and I should go with the workaround suggested in the below thread.

http://www.telerik.com/community/forums/aspnet-ajax/docking/raddock-resizing-problem.aspx

Thanks,
Ramesh
Slav
Telerik team
 answered on 04 Mar 2013
5 answers
1.0K+ views
http://www.telerik.com/community/forums/aspnet-ajax/ajax/showing-border-for-radgrid-columns.aspx

Currently I want to use the WebBlue skin on my grid, but instead of having alternating colors I want a pure white grid with a few vertical black lines about every four columns.

The given example I found allows me to override the entire grid to make it all white, but when I try to set the CssClass in the ItemStyle of the GridBoundColumn nothing happens. I look in the source of the page, and it is there (on the <td cssclass="LeftBorderBlack">), the link for the css is there. I can't figure out for the life of me how to get some columns to have a border style on the left side, and all others to have none.

Any help is greatly appreciated. Thanks :)
Maria Ilieva
Telerik team
 answered on 04 Mar 2013
0 answers
79 views
Hi ,

I  use calender webpart in RadTabStrip, but when i add an item to calender , item  does not look properly. My item is on 28th day of month, but it  looks on top of the calender. How can i fix this problem?
Duygu
Top achievements
Rank 1
 asked on 04 Mar 2013
1 answer
58 views
Please review the attached image
Why radgrid generates such string after I press sorting or paging control??
Jayesh Goyani
Top achievements
Rank 2
 answered on 04 Mar 2013
1 answer
117 views
So I am trying to build a cascaded multiselect google like filtering. So far I have been successful in getting google like cascaded filter to work.

Also I have to set a default filter value which is working fine except that I also store the filter information in my session.

So now the issue is with the multi select. So I do get the multi select by enabling checkboxes on the Combo boxes in custom template.
Imports Telerik.Web.UI
Imports System.Data
Imports System.Data.SqlClient
Imports PTAV2.Data
Imports System.Linq
Imports System.Data.Linq
'Imports System.Linq.Dynamic
Imports System.Reflection
Imports System.ComponentModel
  
Public Class MyCustomFilteringColumn
    Inherits GridBoundColumn
  
    Public Shared ReadOnly Property ConnectionString() As String
        Get
            Return ConfigurationManager.ConnectionStrings("PTAv2ConnectionString").ConnectionString
        End Get
    End Property
  
    'RadGrid will call this method when it initializes the controls inside the filtering item cells
    Protected Overrides Sub SetupFilterControls(ByVal cell As TableCell)
        MyBase.SetupFilterControls(cell)
        cell.Controls.RemoveAt(0)
        Dim combo As New RadComboBox()
        combo.ID = ("RadComboBox1" & Convert.ToString(Me.UniqueName))
        combo.ShowToggleImage = False
        combo.Skin = "MetroRed"
        combo.EnableLoadOnDemand = True
        combo.AutoPostBack = True
        combo.MarkFirstMatch = True
        combo.Height = Unit.Pixel(100)
        combo.BackColor = Drawing.Color.LightGoldenrodYellow
        'combo.BorderColor = Drawing.Color.Red
        'combo.BorderWidth = Unit.Pixel(2)
        'combo.BorderStyle = BorderStyle.Double
        ' combo.CheckBoxes = True
        AddHandler combo.ItemsRequested, AddressOf Me.list_ItemsRequested
        AddHandler combo.SelectedIndexChanged, AddressOf Me.list_SelectedIndexChanged
        cell.Controls.AddAt(0, combo)
        cell.Controls.RemoveAt(1)
    End Sub
  
    'RadGrid will cal this method when the value should be set to the filtering input control(s)
    Protected Overrides Sub SetCurrentFilterValueToControl(ByVal cell As TableCell)
        MyBase.SetCurrentFilterValueToControl(cell)
        Dim combo As RadComboBox = DirectCast(cell.Controls(0), RadComboBox)
        If (Me.CurrentFilterValue <> String.Empty) Then
            combo.Text = Me.CurrentFilterValue
        End If
    End Sub
  
    'RadGrid will cal this method when the filtering value should be extracted from the filtering input control(s)
    Protected Overrides Function GetCurrentFilterValueFromControl(ByVal cell As TableCell) As String
        Dim combo As RadComboBox = DirectCast(cell.Controls(0), RadComboBox)
        Return combo.Text
    End Function
  
    Private Sub list_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
  
  
  
  
        DirectCast(o, RadComboBox).DataTextField = Me.DataField
        DirectCast(o, RadComboBox).DataValueField = Me.DataField
        Dim ProjectList As New DataTable
        ProjectList = ConvertToDataTable(LoadData())
        ProjectList.Select(PTAV2Session.FilterExpression)
        Dim view As DataView = New DataView(ProjectList)
        view.Sort = Convert.ToString(Me.UniqueName)
  
  
        view.RowFilter = PTAV2Session.FilterExpression
        Dim distinctValues As DataTable = view.ToTable(True, Convert.ToString(Me.UniqueName))
       
        DirectCast(o, RadComboBox).DataSource = distinctValues
        DirectCast(o, RadComboBox).DataBind()
    End Sub
  
    Private Sub list_SelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
        Dim filterItem As GridFilteringItem = DirectCast(DirectCast(o, RadComboBox).NamingContainer, GridFilteringItem)
        If (Me.UniqueName = "ProjectId" Or Me.UniqueName = "TotalApprovedCost") Then
            'this is filtering for integer column type
            filterItem.FireCommandEvent("Filter", New Pair("EqualTo", Me.UniqueName))
        Else
  
        End If
        'filtering for string column type
        filterItem.FireCommandEvent("Filter", New Pair("Contains", Me.UniqueName))
    End Sub
  
    Public Shared Function GetDataTable(ByVal query As String) As DataTable
        Dim conn As New SqlConnection(ConnectionString)
        Dim adapter As New SqlDataAdapter()
        adapter.SelectCommand = New SqlCommand(query, conn)
  
        Dim myDataTable As New DataTable()
  
        conn.Open()
        Try
            adapter.Fill(myDataTable)
        Finally
            conn.Close()
        End Try
        Return myDataTable
    End Function
  
    Protected Shared Function LoadData() As List(Of p_RetrieveProjectList_Result)
        Dim _iProjectRepository As New ProjectRepository
        Dim projectList As List(Of p_RetrieveProjectList_Result) = _iProjectRepository.RetrieveProjectList()
  
        Return projectList
  
    End Function
  
    Public Function ConvertToDataTable(Of T)(data As IList(Of T)) As DataTable
        Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(GetType(T))
        Dim table As New DataTable()
  
        For Each prop As PropertyDescriptor In properties
            table.Columns.Add(prop.Name, If(Nullable.GetUnderlyingType(prop.PropertyType), prop.PropertyType))
        Next
        For Each item As T In data
            Dim row As DataRow = table.NewRow()
            For Each prop As PropertyDescriptor In properties
                row(prop.Name) = If(prop.GetValue(item), DBNull.Value)
            Next
            table.Rows.Add(row)
        Next
        Return table
    End Function
End Class
Also I have set EnableLinqExpressions = false in my code. So when I select multiple values from the dropdown, I have 2 issues
1) Sometimes the filter test says "All items selected" or "2 items selected" instead of the actual filter values
2) Since the EnableLinqExpressions=false the query is like this where xyz like "value1,value2" So should I write a routine to break these values separted by commas as individual filter values with an OR statement.

I also tried by enableing the linq expressions and then the query is like this where xyz.contains("value1,value2"). I both cases results do not return anything. 

Please help .

Also was trying the dynamic Linq library. It had it own share of issues. I could not get it to work either.

Angel Petrov
Telerik team
 answered on 04 Mar 2013
1 answer
359 views
How to clear the entry added in autocompletebox from client side?
Princy
Top achievements
Rank 2
 answered on 04 Mar 2013
3 answers
435 views
This all started when I found myself having issues with the RadGrid export. I did a little research and developed the following solution:
  1. Find a suitable library to generate the Excel file (should be free)
  2. Find a suitable library to compress the generated file as they could be quite large (again, should be free)
  3. Develop a generic method for doing all of the above

The answer to #1 was ClosedXML developed by Manuel De Leon
The answer to #2 was to use the DotNetZipLib

#3 took a little work, but the result was an extender to IEnumerable:

public static String ToExport<dynamic> ( this IEnumerable<dynamic> DataList, String ExcelFileName )
{
var WorkBook = new XLWorkbook ();
var ws = WorkBook.Worksheets.Add ( "Sheet1" );
ws.Cell ( 1, 1 ).InsertTable ( DataList );
String FileName = Path.GetRandomFileName ();
FileName = Path.ChangeExtension ( FileName, "zip" );
String FullFileName = Path.Combine ( HttpContext.Current.Server.MapPath ( "~/Exports" ), FileName );

using ( MemoryStream wbStream = new MemoryStream () )
{
WorkBook.SaveAs ( wbStream );
wbStream.Seek ( 0, SeekOrigin.Begin );

using ( ZipFile Archive = new ZipFile ( FullFileName ) )
{
Archive.AddEntry ( ExcelFileName + ".xlsx", wbStream );
Archive.Save ();
}
}

return ( "~/Exports/" + FileName ).ToAbsoluteUrl ();
}

As you can see, I am creating an Excel 2007+ file and compressing it into a temporary zip file in a folder within the web site. I then return the URL for the file.

In the page, I set the source for a hidden iframe to the URL.

The other part of this is the communication from the client to the code behind. To do that, I use the PageMethods part of the RadScriptManager to call the method in the page code behind. This means that I will not have access to any page variables as it has to be a static method. In order to access the LinqDataSource query and any parameters it uses, I save them to Session variables in the Selecting event:

Session [ "DeviceBurnHoursPageDataSource" ] = this.GridDataSource;
Session [ "DeviceBurnHoursPageFilter" ] = this.ReportGrid.MasterTableView.FilterExpression;
Session [ "DeviceBurnHoursPageReportDate" ] = this.ReportDate;

And then in the page method:

IDataSource TheSource = ( IDataSource ) HttpContext.Current.Session [ "DeviceBurnHoursPageDataSource" ];
LinqDataSourceView TheView = TheSource.GetView ( "DefaultView" ) as LinqDataSourceView;
DateTime ReportDate = ( DateTime ) HttpContext.Current.Session [ "DeviceBurnHoursPageReportDate" ];
String Filter = ( String ) HttpContext.Current.Session [ "DeviceBurnHoursPageFilter" ];

if ( Filter != String.Empty )
{
String W = " && " + Filter.Replace ( " AND ", " && " );
TheView.Where += W;
}

TheView.WhereParameters [ "ReportDate" ].DefaultValue = ReportDate.ToString ( "MM/dd/yyyy" );
DataSourceSelectArguments Args = new DataSourceSelectArguments ();

return ( ( IEnumerable<dynamic> ) TheView.Select ( Args ) ).ToExport ( "Device Burn Hours " + ReportDate.ToString ( "yyyy-MM-dd" ) );

The returned file is ALL of the columns returned by the query in the order they are defined. In this case, it is suitable for creating the Pivot Table in Excel. If you are exporting from a RadGrid, you should end-up with a ready-to-use Excel file.

I am certain that there are more elegant ways of doing this, but it works for me.

Kostadin
Telerik team
 answered on 04 Mar 2013
5 answers
109 views
Several users here have expressed interest in modifying the main grid in my application so that they can set which columns to display and how wide they are.

I think I have enough of a handle on the grid to implement something like this but I was wondering if there were any demos along this line.  (To avoid re-inventing the wheel.) 
Eyup
Telerik team
 answered on 04 Mar 2013
6 answers
1.0K+ views
Hi Telerik Support,

I am having a problem with RadComboBox. I am not able to select the first item of RadComboBox programmatically. I have instantiated  a RadComboBox with 2 columns. I am giving user the ability to filter combo box based upon items present either in column 1 or 2. The search criteria may not necessarily appear in the beginning of the dropdown items, it may appear anywhere in the text. For example I have a dropdown with 2 columns with first column having "Project Engineer" and second "VAC-1001". My user types "1001" as search criteria and system brings one record, but that record (RadComboBoxItem) is not being selected.

I have set MarkFirstMatch property to "true". I tried setting SelectedItem to its text but getting below error:

"Property 'SelectedItem' is 'ReadOnly'."

I also tried using SelectedIndex, but that is also not working. Please help me select the first item. I am using 2010.2.713.35 verion of Telerik.Web.UI and Telerik.Web.Design.

If RadComboBox.Items.Count > 0 Then
 RadComboVacancyList.SelectedIndex = 0
End
If

Many thanks.
Boyan Dimitrov
Telerik team
 answered on 04 Mar 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?