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

May have encountered a bug with validation on RadMaskedTextbox with RequiredFieldValidator, where the textbox remains invalid despite a valid input being entered.

Steps to replicate:

- Enter a complete, valid number

- Click outside of textbox

- Click back into textbox and delete some numbers

- Click outside of textbox to get the validation message

- Now enter a complete, valid number again - still treated as invalid and error message remains displayed.

 Link to video screencast

 

Markup:

 

<h4>Telephone:</h4>
 
<telerik:RadMaskedTextBox ID="tbTelephone" runat="server" Width="164px" Skin="Silk" Mask="###########" RequireCompleteText="true" />
 
<asp:RequiredFieldValidator ID="rfvTelephone" runat="server" Display="Dynamic" CssClass="validation" Text="*Required" ControlToValidate="tbTelephone" />

 

Maria Ilieva
Telerik team
 answered on 23 Nov 2015
1 answer
243 views

Hi all,

How would I go about showing/hiding the CommandItem for a detail table from an external button in the code behind.Our webapp has a set of "new", "edit" & "save" buttons created in a masterpage which are enable/disabled based on the users access rights. I want to be able to allow a user to create a new record within a radgrid at both the master table and detail table level. I can enable the CommandItem for the master table but i cant do it for the detail tables. I've tried looping through the NestedTableView items but on a rebind the grid doesn't change

 

Thanks Matt

 

 

Eyup
Telerik team
 answered on 23 Nov 2015
1 answer
91 views

I have a problem with firefox, I'm using this event(OnClientCommandExecuting) to cancel some(not all) shortcuts and works perfectly with chrome, when i try with firefox works very well with the shorcuts, except for the Shift+Enter  when i press this key combination in firefox the event is not even fired, could you help me please?

 

function OnClientCommandExecuting(editor, args)
{
     var liTag = editor.getSelectedElement();
     var commandName = args.get_commandName();
 
     .....
}

Ianko
Telerik team
 answered on 23 Nov 2015
6 answers
477 views
I have the following code.

  <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderStyle-Width="50" EditImageUrl="~/images/edit.gif" /> 
 
more....grid.......code  
 
<EditFormSettings UserControlName="~/controls/Edit.ascx" EditFormType="WebUserControl">  
    <EditColumn UniqueName="EditCommandColumn1">  
    </EditColumn> 
</EditFormSettings> 

How do I pass the parameters in the grid like the column name, id, and date to the ascx page?

Thanks!
Eyup
Telerik team
 answered on 23 Nov 2015
3 answers
123 views

Hi,

After installing 2015.3.1111.45 I observed that RadComboBoxes with Filter=Contains setting will not fire after user deletes text and presses enter.

Scenario:

RadComboBox populated with data, with settings Filter="Contains".

When user selects item - event fires. When user deletes entered text and presses ENTER event does not fire.

 Basic markup:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
         
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadComboBox Filter="Contains" ID="RadComboBox1" runat="server" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged" AutoPostBack="true" DataSourceID="LinqDataSource1" DataTextField="du" DataValueField="id"></telerik:RadComboBox>
        <asp:LinqDataSource ID="LinqDataSource1" OnSelecting="LinqDataSource1_Selecting" runat="server"></asp:LinqDataSource>
        <asp:Label ID="lblResult" runat="server" Text=""></asp:Label>
    </div>
    </form>
</body>
</html>

 

Sample code with sample data. 

using System;
using System.Web.UI.WebControls;
using System.Linq;
using Telerik.Web.UI;
using System.Collections.Generic;
 
public partial class Default : System.Web.UI.Page
{
 
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        List<int> a = new List<int>();
 
        for(int i = 1; i < 10; i++)
        {
            a.Add(i);
        }
 
        var q = from b in a
                select new { id = b, du = "2 * " + b.ToString() };
 
        e.Result = q;
    }
 
    protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (RadComboBox1.Items.Any())
        {
            lblResult.Text = (Int32.Parse(RadComboBox1.SelectedValue)*2).ToString();
        }
    }
}
 â€‹

Expected behaviour:

 1. User selectes "2 * 2=" and result is shown as 4

2. User deletes selected text in ComboBox and presses ENTER. ComboBox should return to the first value on list ("2*1=") and show result of "2".

  

Also with the same build:

Bootstrap skin loses hover style for combobox list (meaning items on list do not show different background color when mouse is over particular item of this list).

 

Jacek

 

Magdalena
Telerik team
 answered on 23 Nov 2015
1 answer
568 views

I just want to post some of my code and have some eyes on it that may spot something I'm doing wrong. In general, there are just times where a user isn't able to upload a document. A second try usually works though. Literally no idea how to explain this.

 

The other problem I have is seemingly harder to deal with... Sometimes a document gets uploaded (seems to always be a .docx) and when trying to download the document Word attempts to open but says the file is corrupt. I am storing the documents as a VARBINARY(MAX) in sql server. The content type is getting stored as "application/vnd.openxmlformats-officedocument.wordprocessingml.document" which I believe is correct. The one odd thing I noticed one time is that... a particular document was uploaded.  I set a breakpoint when trying to download and saw the "content length" was a specific value. Well, I uploaded this same document to the system and when hitting that same breakpoint the content length value had changed. So one question I have is - does uploading the same document from a different machine (and perhaps a different user) really change the length of the byte array?! I wouldn't think so. I'm not sure if this is even relevant information to my problem but it was just something I noticed and couldn't account for why it happened. And for what its worth, whenever I upload a particular document myself that was a corrupted file after someone else had uploaded, the file is always fine for me. So it's not like the file itself is actually corrupted.

 

Any reason why the radasyncupload might be making these files corrupted? Or is there anything in my code that could explain it?

 

code for uploading:

foreach (UploadedFile File in ClientAgreementUpload.UploadedFiles)
            {
                try
                {
                    byte[] FileData = new Byte[File.ContentLength];
                    File.InputStream.Read(FileData, 0, (int)File.ContentLength);
                    Dictionary<string, object> DocParameters = new Dictionary<string, object>();
                    DocParameters.Add("PreviousDocumentId", DBNull.Value);
                    DocParameters.Add("RequestGroupId", RequestGroupId);
                    DocParameters.Add("Title", File.FileName.ToString());
                    DocParameters.Add("ContentType", File.ContentType.ToString());
                    DocParameters.Add("AgreementDocument", FileData);
                    DocParameters.Add("Comments", DocumentCommentsTextbox.Text);
                    DocParameters.Add("FinalExecuted", 0);
                    DocParameters.Add("SubmitBy", CommonClass.UserName(Request));
                    Session["id"] = CommonClass.Scalar("InsertDocument", ConfigurationManager.ConnectionStrings["ContractAdminConnection"].ToString(), DocParameters);
                }
                catch (Exception error)
                {
                    ...error handling stuff
                }
                
            }


CommonClass.Scalar looks like this:

public static object Scalar(string mySQL, string strConn, Dictionary<string, object> Parameters)
        {
            try
            {
                SqlConnection mySqlConnection = new SqlConnection(strConn);
                SqlCommand mySqlCommand = new SqlCommand(mySQL, mySqlConnection);
                mySqlCommand.CommandType = CommandType.StoredProcedure;
                foreach (KeyValuePair<string, object> Parameter in Parameters)
                {
                    var parameter = Parameter;
                    mySqlCommand.Parameters.Add(new SqlParameter(parameter.Key, parameter.Value));
                }
                object myObject = new object();
                mySqlConnection.Open();
                myObject = mySqlCommand.ExecuteScalar();
                mySqlConnection.Close();
                return myObject;
            }
            catch (System.Exception ex)
            {
                ...error handling stuff
            }
        }

code for downloading... 
protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary<string, object> Parameters = new Dictionary<string, object>();
            Parameters.Add("AgreementDocumentId", Request.QueryString["DownloadParameter"]);
            DataTable AgreementDocumentTable = CommonClass.Table("GetAgreementDocumentBinaryByRequestId", ConfigurationManager.ConnectionStrings["ContractAdminConnection"].ToString(), Parameters);

            Response.Clear();
            Response.Buffer = true;
            Response.Charset = "";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = AgreementDocumentTable.Rows[0]["ContentType"].ToString();
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + AgreementDocumentTable.Rows[0]["Title"].ToString());
            Response.AddHeader("Content-Length", ((byte[])AgreementDocumentTable.Rows[0]["AgreementDocument"]).Length.ToString());
            Response.Flush();
            Response.BinaryWrite((byte[])AgreementDocumentTable.Rows[0]["AgreementDocument"]);
            Response.End();
        }

CommonClass.Table is nothing special, just returns a datatable



Here is C# code for the initial call to download a doc: 
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Download", String.Format("GotoDownloadPage(\"./Download.aspx?DownloadParameter={0}\");", Convert.ToInt32(e.CommandArgument)), true);

here is the javascript code for downloading docs:
function GotoDownloadPage(urlString) {
            console.log(urlString);
            window.location = urlString;
        }
Peter Filipov
Telerik team
 answered on 23 Nov 2015
0 answers
67 views
I am using telerik libraries. While running my application against "Any CPU"  things are working file but it is failing for "x86" target. Any idea about this issue ?
Kuldeep
Top achievements
Rank 1
 asked on 23 Nov 2015
3 answers
171 views
Hi,

We are using the ASP.NET Ajax Treeview control for our navigation in sharepoint. We have bound the Treeview to the PublishingNavigation:PortalSiteMapDataSource  SiteMapProvider="CombinedNavSiteMapProvider".

Our problem is that in our navigation a number of links have manually been added to the navigation structure, these links all point to the same page. This means that if you click one of these links you navigate to the actual page BUT on the page loading all nodes that contain any of these extra links are expanded as well as the actual page that we have selected/navigated to.

Here is the control as implemented in our masterpage:

<telerik:RadTreeView ID="RadTreeView1"  
   runat="server"
   DataSourceID="ourdatasourcename" 
   Flow="Vertical" 
   EnableEmbeddedSkins="false"
   SkinsPath="~\Telerik\Skins"
   Skin="ourskinname"
   ClickToOpen="true"
   SingleExpandPath="True"
   MultipleSelect="False"
   AutoPostBack="true" 
   ExpandMode="ClientSide"
   ExpandDirection="Down"
   OnClientLoad="On_Load">
   </telerik:RadTreeView>


I have set the property SingleExpandPath="True" this works if the client opens a node - all other open nodes close but has no effect on the multiple expanded nodes on page load.

I have tried to utilize javascript and close all expanded nodes and then only expand the selected node via the OnClientLoad, but this client side event does not fire (I could do this on a button click event and it works, I also called this function via the body onLoad which did not work - nothing happened).

I then created a code behind file for the masterpage and in the Page_Load used the following function RadTreeview1.CollapseAllNodes(); this did not respond at all, thought the clientid was displayed.

protected

void Page_Load(object sender, EventArgs e)

 

{

 

RadTreeview1.CollapseAllNodes();

 

 

Response.Write("load " + RadTreeview1.ClientID);

 

 

}


I then found the article 

Server side events not fired when a Navigation control is bound via SiteMap DataSource

http://www.telerik.com/support/kb/aspnet-ajax/menu/server-side-events-not-fired-when-a-navigation-control-is-bound-via-sitemap-datasource.aspx

Fire server-side events when the control is bound to SiteMap DataSource.
If a Navigation control is bound to a SiteMapDataSource, the NavigateUrl property of the items will be set.
This effectively disables PostBacks (ItemClick/NodeClick/TabClick events, etc.) because the item navigates
to the particular URL rather than posting back

I then tried to follow this example using the following events

 

protected void RadTreeview1_OnNodeDataBound(object sender, RadTreeNodeEventArgs e)

 

{

e.Node.Attributes[

"NavigateUrl"] = e.Node.NavigateUrl;

 

e.Node.NavigateUrl =

"";

 

}

 

protected void RadTreeview1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)

 

{

 

Response.Redirect(e.Node.Attributes["NavigateUrl"].ToString());

 

 

 

}

 

Neither of these events seem to have any effect/do not fire.


We really need to stop this explosion of the treeview, and only have the selected node xepanded on the page load. Can you please help.

Vanessa



Varalakshmi
Top achievements
Rank 1
 answered on 21 Nov 2015
7 answers
960 views
Hi,
Can any one tell me how to persist the selected row even after post back when Allow multi row selection is false.
Any response will be really helpful.

Regards,
Antony K S
Harry
Top achievements
Rank 1
 answered on 21 Nov 2015
4 answers
603 views

Hi,

I want to embed the following HTML into a popup window, but I am unable to watch it fullscreen:

<iframe width="560" height="315" src="https://www.youtube.com/embed/sNIMCdVOHOM" frameborder="0" allowfullscreen></iframe>

This is due to internally telerik generates a window by using an iframe to load the content into, this iframe is missing the "allowfullscreen" attribute therefore the browser does not allow full screen.

How can I add an attribute to the iframe internally generated by telerik?

Chris

 

 

Chris
Top achievements
Rank 1
 answered on 21 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?