Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
619 views

I've seen multiple questions related to this but still haven't seen a good answer.

Dates on the backend are in UTC, I want the front end to display them on the Clients Local timezone. However, the Client is displaying the UTC time.

I understand this is related to the way browsers handle dates, but my confusion is with what exactly happens  when you "bind" a DateTime object to a RadGrid. I've even tried binding an ISO formatted Date string to a GridDateTimeColumn to see if that resolved the issue (it didn't).

When I say "new Date(theText)" in JS I get the correct value, but it apparently doesn't bind like this. I've even tried using DateTimeOffset instead of DateTime.

The data is being bound on the Server Side NeedDataSource event.

What is the current best solution to this problem? Must I either take the users offset and convert on binding or convert the front end text using JavaScipt? OR is there a cover all solution to just convert ALL dates to client local?

Thanks

Attila Antal
Telerik team
 answered on 23 Dec 2021
1 answer
216 views

Hello,

When I filter on the RadDropDownTree then backspace everything I typed  in the filter field it expands all the nodes on the tree.

What I want it to do is collapse all the nodes as if I'm starting at the very beginning.

Peter Milchev gave me a nice working script from my last filter question.  I'm posting it here.  Perhaps it can be modified? 

Thanks!

--Clark

<script>
    var $T = Telerik.Web.UI;
    Telerik.Web.UI.RadDropDownTree.Manager.prototype._filterNodes = function (text) {
        var nodes = this._embeddedTree.get_allNodes(),
            count = nodes.length,
            regEx,
            i;
 
        if (this._filter == $T.DropDownTreeFilter.StartsWith)
            regEx = new RegExp("^\\s*" + $T.RadDropDownTree.Manager._regExEscape(text), "im");
        else
            regEx = new RegExp($T.RadDropDownTree.Manager._regExEscape(text), "gim");
 
        for (i = 0; i < count; i++) {
            var currentNode = nodes[i];
            var matchIsFound;
                   
            if (currentNode.get_level() !== 2) {
                matchIsFound = false;
            } else {
                matchIsFound = this._matchNode(currentNode, text, regEx);
            }
            if (matchIsFound) {
                this._handleVisibleParents(currentNode);
                this._filteredVisibleNodes.push(currentNode);
            }
            else {
                this._handleHiddenNode(currentNode);
            }
        }
 
        this._hideNodes(this._filteredHiddenNodes);
        this._showNodes(this._filteredVisibleNodes);
 
        this._filteredVisibleNodes = [];
        this._filteredHiddenNodes = [];
    }
</script>

 

 

Doncho
Telerik team
 answered on 21 Dec 2021
1 answer
190 views

Hi,

I am trying to perform an upload with no post back, so I am using the handler. Telerik  v4.0.30319

The code works, but for some reason it split the file and upload only 2MB of it. 

 public class myHandler : AsyncUploadHandler, System.Web.SessionState.IRequiresSessionState
    {

        protected override IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration, string tempFileName)
        {
            
            string targetFolder = context.Server.MapPath("~/Uploads/");
            string fileName = file.GetName();

            file.SaveAs(targetFolder + fileName);

            return CreateDefaultUploadResult<UploadedFileInfo>(file);
        }


    }

JS code

  <script type="text/javascript">
        function OnClientFileUploadFailed(sender, args) {

        }

        function OnClientValidationFailed(sender, args) {

        }
        var gridfileName = '';
        function OnClientFilesUploaded(sender, args) {
           
            GetgridIDfieldName(gridfileName);
        }
        function OnClientFilesUploading(sender, args) {
         
            gridfileName=args.get_fileName();
        }
    </script>

 

                                        <telerik:RadAsyncUpload  
                                            ID="RadAsyncUpload1"
                                            OnClientFileUploadFailed="OnClientFileUploadFailed"
                                            OnClientValidationFailed="OnClientValidationFailed"
                                            OnClientFilesUploaded="OnClientFilesUploaded"
                                            OnClientFileUploading="OnClientFilesUploading"
                                            HttpHandlerUrl="~/myHandler.ashx"
                                            TargetFolder="~/Uploads"
                                            DisableChunkUpload="true"
                                            MaxFileSize="10485760"
                                            RenderMode="Lightweight"
                                            runat="server">
                                        </telerik:RadAsyncUpload>

Note: The code do not create temp file at "\App_Data\RadUploadTemp"  it directly upload the file to the Uploads folder.

Any help is much appreciated.

Regards,

Omar

Omar
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 20 Dec 2021
0 answers
266 views

I am trying to upload a simple csv file with 6 columns via RadAsyncUpload. But everytime I try I get a 'File contains corrupted data' . But as soon as I convert the csv to xlsx. it uploads without issue. 

 

Is there a way to fix this?

Mark
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 20 Dec 2021
1 answer
424 views

I'm not getting an error and the alert shows the correct tab ID, any ideas why the tab is not hiding.

function HideHistoryTab(sender, e)
{
	var tabIndex = sender.get_activeTabIndex();
	if (tabIndex == 0 || tabIndex == 1)
	{
		var tabStrip = $find(_TabClientID);
		var tabs = tabStrip.get_tabs();
		//alert(tabs[3].get_id());
		tabs[3].set_visible(false);
	}
}

Vessy
Telerik team
 answered on 20 Dec 2021
1 answer
434 views

I am dealing with a scenario where in grid , whether user clicks on a row or uses up/down arrow in the grid to select a row, it should do a postback and update other fields on the page. During research I have found that EnablePostBackOnRowClick and AllowKeyboard Navigation cannot work at the same time. This is what I have :

<Selecting AllowRowSelect="true" />

 <ClientEvents OnRowSelected="GridRowSelected" OnRowMouseOver="RowMouseOver" />

 

  function GridRowSelected(sender, args) {

// do a post back to update other controls on the  page

}

 

Can someone please help me in achieving this? I have tried different methods explained in forum but nothing worked for me. In short, I want it to do a post back  when either user clicks on a row or make a selection using keyboard navigation and call this:

  void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)

{

}

 

Doncho
Telerik team
 answered on 20 Dec 2021
1 answer
304 views

Hi,

I'm trying to use the RowDrop method of the Radgrid to change the sort order in the database.  Each row in the database table has a "SortOrder" column to indicate the order in which items should appear. 

I want to allow the user to quickly change these orders.

Do you have any code samples that could easily do this?  The example provided online doesn't seem to address this.

Thank you!

 

Attila Antal
Telerik team
 answered on 17 Dec 2021
1 answer
708 views

I'm trying to remove the vertical scroll bar from a radgrid.  I'm not enabling paging and don't want to show the vertical scrolling. I only need the horizontal function.    Any help would be appreciated.   

 

Thanks

Doncho
Telerik team
 answered on 16 Dec 2021
1 answer
959 views

Hello,

 

is it possible to set the content-type of the file when uploading to Azure blob storage using radcloudupload?

 

 

Thanks

Peter Milchev
Telerik team
 answered on 15 Dec 2021
2 answers
7.7K+ views

Hello.

I'm trying to save files in DB, which should record the file as "BinaryData".

I'm using RadAsyncUpload, but when i upload the file i get the extension "System.IO.IOException: The process cannot access the file because it is being used by another process." and the file only gets loaded in the App_Data folder of my app, in an automatically created "RadUploadTemp" folder.

I've tried to disable the Path mentions in my SaveFile method, getting "Path not found error". Any of the available telerik demos is similar to my context. 

How do i solve this?


//my insert/update operations method
public void SaveFile(object sender, EventArgs e)
        {
            ListagemTimesheet model = new ListagemTimesheet();
            model.IDRecursoHumano = Convert.ToInt32(rdpInvestigadorE.Text);
            model.IDEstadoTimesheet = Convert.ToInt32(rcbEstado.SelectedValue);
            model.Observações = Obervaçoestxt.Text;
            model.AssinaturaTimesheet = txtAssinaturaTimesheet.Text;
            model.DataEnvio = DataEnvio.SelectedDate.Value;

            if (!string.IsNullOrEmpty(Ficheiro) && FileTipo != null)
            {
                model.Ficheiro = Path.GetFileNameWithoutExtension(Ficheiro);
                model.FileContent = fileBytes;
                model.FileTipo = Path.GetExtension(FileTipo);
            }
            if (!string.IsNullOrEmpty(FileID.Text) && Convert.ToInt32(FileID.Text) > 0)
            {
                model.ID = Convert.ToInt32(FileID.Text);
                listagembll.UpdateFile(model);
            }
            else
            {
                listagembll.InsertFile(model);
            }

//Ascx.Cs method

public void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
        {

            RadAsyncUpload1.Visible = false; //false
            var liItem = new HtmlGenericControl("li");
            Ficheiro = e.File.FileName; // sintaxe metodo
            FileTipo = e.File.ContentType;
            e.IsValid = true;
            e.File.InputStream.Position = 0;
            fileBytes = new byte[e.File.InputStream.Length];
            for (int totalBytesCopied = 0; totalBytesCopied < e.File.InputStream.Length; )
                totalBytesCopied += e.File.InputStream.Read(fileBytes, totalBytesCopied, Convert.ToInt32(e.File.InputStream.Length) - totalBytesCopied); //conversao para bytes
        }

//Ascx reference

<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" AllowedFileExtensions="xlsx,xlsm,xls,txt,pdf" EditFormColumnIndex="1" MultipleFileSelection="Disabled"  RenderMode="Lightweight" TargetFolder=""  OnFileUploaded="RadAsyncUpload1_FileUploaded" UploadedFilesRendering="BelowFileInput" >
                                        </telerik:RadAsyncUpload>
                                        <br />
                                        <span class="allowed-attachments">Formatos permitidos: <span class="allowed-attachments-list">pdf,xlsx,xlsm,xls,txt</span></span> &nbsp; </td>


 

Harlem98
Top achievements
Rank 1
Iron
Iron
Iron
 updated answer on 14 Dec 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?