Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
192 views
Hello there.

I am trying to get separate client validation messages for AsyncUpload depending upon whether it was a fail due to filesize or extention type.

At the moment i can only get a generic message using :

 function validationFailed(sender, eventArgs) {
              
            //var RadProgressArea1 = $('#<%= RadProgressArea1.ClientID %>');
//             $.each(sender, function(i, n) {
//                            alert("Name: " + i + ", Value: " + n);
//                        });    
            $("#errorHolder").append("<p>Validation failed for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
        }

I want seperate messages for those two cases.

i have also tried to not specify maxfilesize in asyncupload and catch filesize error in 

function ClientProgressUpdating(sender, args)  {
           
           if(args.get_data().fileSize > 3145728)
           {                          
                sender.deleteFileInputAt(0);
                  $("#errorHolder").append("<p>file size if more than max for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
//                if(confirm("Are you sure"))
//                {
//                   //validationFailed(sender, args);
//                   return false;
//                     $("#errorHolder").append("<p>Validation failed for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
//                }
               
           }
//            
        }

it stops the fileupload but hangs at the screen where the progress bar is not moving forward and doesnt set the error message label

Thank you for helping.
Peter Filipov
Telerik team
 answered on 24 Jun 2011
3 answers
371 views
Hello,

I've been struggling with this problem for many hours now.  Basically I'm interested in finding out how to have resizable detail table columns which don't mess up the grid size and scrolling when you resize them.

I've attached a small demo that shows the problem.  If you expand a detail record and then resize a column in it, the grid basically loses scrolling and resizes itself.  I have not enabled resize grid on column resize.

Help would be very much appreciated!  If there is a demo out there somewhere that shows resizable columns in a hierarchy that would be helpful as well.  I cannot find any demo on the Telerik site which shows hierarchy and resizable columns at the same time!

<%@ 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>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <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>
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0"
        GridLines="None" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource"
        Skin="Vista" Width="800px">
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            <Resizing AllowColumnResize="True" />
        </ClientSettings>
        <MasterTableView>
            <DetailTables>
                <telerik:GridTableView runat="server">
                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column column" HeaderText="DetailCol0"
                            UniqueName="column">
                            <HeaderStyle Width="300px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column1 column" HeaderText="DetailCol1"
                            UniqueName="column1">
                            <HeaderStyle Width="300px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column2 column" HeaderText="DetailCol2"
                            UniqueName="column2">
                            <HeaderStyle Width="300px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column3 column" HeaderText="DetailCol3"
                            UniqueName="column3">
                            <HeaderStyle Width="300px" />
                        </telerik:GridBoundColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </telerik:GridTableView>
            </DetailTables>
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn FilterControlAltText="Filter column column" HeaderText="MasterCol0"
                    UniqueName="column">
                    <HeaderStyle Width="300px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn FilterControlAltText="Filter column1 column" HeaderText="MasterCol1"
                    UniqueName="column1">
                    <HeaderStyle Width="300px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn FilterControlAltText="Filter column2 column" HeaderText="MasterCol2"
                    UniqueName="column2">
                    <HeaderStyle Width="300px" />
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>
    </telerik:RadGrid>
    </form>
</body>
</html>

public partial class Default : System.Web.UI.Page
{
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        List<string> theList = new List<string> { "a", "b", "c" };
        RadGrid1.DataSource = theList;
    }
 
    protected void RadGrid1_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
    {
        List<string> theList2 = new List<string> { "d", "e", "f" };
        e.DetailTableView.DataSource = theList2;
    }
}
Niall
Top achievements
Rank 1
 answered on 24 Jun 2011
1 answer
149 views
I'm using the RadAsyncUpload on a webform that have several components to perform certain operations. Initially, when I load the file, the FileUploaded is fired on the first postback as expected, and the file is copied to the intended directory in the server. This is my code for this part:

protected void AsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
        {
            using (Stream stream = e.File.InputStream)
            {
                bool fileSaved = false;
                Random objRand = new Random();
                while (!fileSaved)
                {
                    string strUploadFileName = "~/tmp/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
 
                    if (!File.Exists(Server.MapPath(strUploadFileName)))
                    {
                        byte[] xlsData = new byte[stream.Length];
                        stream.Read(xlsData, 0, (int)stream.Length);
 
                        FileStream fs = new FileStream(Server.MapPath(strUploadFileName), FileMode.Create, FileAccess.ReadWrite);
                        BinaryWriter bw = new BinaryWriter(fs);
                        bw.Write(xlsData);
                        bw.Close();
 
                        ViewState["currXLFile"] = Server.MapPath(strUploadFileName);
                        //read contents now...
                        LoadData();
 
                        fileSaved = true;
                    }               
                 
                }              
                 
            }
        }


The problem is that there are other components that fire the postback event on the same page after the file upload, which fires over and over again the FileUploaded event, with the big problem that after the second time it postbacks it generates an exception at this line:

using (Stream stream = e.File.InputStream)

Which has sense since the file was copied already on the first postback, so the InputStream is not usable anymore. Can you recommend me a way to make sure that this line is excuted only when a file was actually uploaded and not on every single postback event? hopefully something more elegant of what I did for now: just putting a try-catch block and ignoring the error.

Thanks,
Peter Filipov
Telerik team
 answered on 24 Jun 2011
6 answers
215 views
Hi all
I am developing an ASP.NET MVC application. I have radScheduler in one page connected to a web service which pulls appoinments from the database. There are different appoinment types and there is one appoinment which can be moved across time slots. I need to show that appoinment in the scheduler when the page is loaded(initially and dynamically with other client side events). In order to do that I need to set "TimelineView-StartTime" property. It is a serverside property and I cannot find the corresponding JavaScript property. Since this is an MVC application I cannot set the property within server side tags. Could you please tell me how to set this "TimelineView-StartTime" property in ASP.NET MVC application dynamically? I cannot find the corresponding JavaScript property.
Thanks in advance
Kushil
Veronica
Telerik team
 answered on 24 Jun 2011
3 answers
248 views
When a user clicks on a hyperlink inside the grid it opens up a rad window, if the passing value has apostrophe ( ' ) in the text field, a js error is thrown. How to overcome this problem.

Thanks

Jessy
Marin Bratanov
Telerik team
 answered on 24 Jun 2011
4 answers
163 views
I have code like this

<Columns>
                        <telerik:GridBoundColumn DataField="TaskID" HeaderText="taskID"
                           UniqueName="TaskID" Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="TaskName" HeaderText="ชื่องาน"
                           UniqueName="TaskName">
                            <FilterTemplate>
                                <telerik:RadComboBox ID="RadComboBox1" Runat="server"
                                    ShowToggleImage="False" Skin="Vista" AutoPostBack="True"
                                    MarkFirstMatch="True" EnableLoadOnDemand="true"
                                    onitemsrequested="RadComboBox1_ItemsRequested"
                                    onselectedindexchanged="RadComboBox1_SelectedIndexChanged">
                                </telerik:RadComboBox>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>
                        <telerik:GridEditCommandColumn>
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn CommandName="Delete"
                            ConfirmText="Do you want to delete this item?" ConfirmTitle="Delete"
                            Text="Delete" UniqueName="column1">
                        </telerik:GridButtonColumn>
                    </Columns>


In this code I add "RadComboBox1" to FilterTemplate on GridBoundColumn name "ชื่องาน" on Design page on aspx

but I don't want to add this control like this. I want to add this control using Code Behind help me please.
Jadesada
Top achievements
Rank 1
 answered on 24 Jun 2011
3 answers
555 views
Hi,

I ha a RadTreeview like this
<telerik:RadTreeView ID="RadTreeView_CommonControls" runat="server" 
    Skin="Windows7" OnClientDoubleClick="SetPlaceHolders">
      <Nodes>
 <telerik:RadTreeNode Text="Text Controls">
  <Nodes>
<telerik:RadTreeNode Text="Text Area" Value="<Text Area></Text Area>"></telerik:RadTreeNode>
<telerik:RadTreeNode Text="Regards Template" Value="<Regards></Regards>"></telerik:RadTreeNode>
<telerik:RadTreeNode Text="Intro Template" Value="<Intro></Intro>"></telerik:RadTreeNode>
 <telerik:RadTreeNode Text="Sat Intro Template"  Value="<About Sat></About Sat>"></telerik:RadTreeNode>
</Nodes>
</telerik:RadTreeNode>
<telerik:RadTreeNode Text="Audio Controls">
 <Nodes>
<telerik:RadTreeNode Text="Embed Audio" Value="<Embed Audio></Embed Audio>"></telerik:RadTreeNode>
<telerik:RadTreeNode Text="Upload Audio" Value="<Upload Audio></Upload Audio>"></telerik:RadTreeNode>
<telerik:RadTreeNode Text="Upload BGM" Value="<Upload BGM></Upload BGM>"></telerik:RadTreeNode>                                                        
 </Nodes>
</telerik:RadTreeNode>
<telerik:RadTreeNode Text="Video Controls">
 <Nodes>
  <telerik:RadTreeNode Text="Embed Video"  Value="<Embed Video></Embed Video>"></telerik:RadTreeNode>
<telerik:RadTreeNode Text="Upload Video"  Value="<Embed Video></Embed Video>"></telerik:RadTreeNode>
<telerik:RadTreeNode Text="Upload Video and Audio"  Value="<Embed Video></Embed Video>"></telerik:RadTreeNode>                                                        
</Nodes>
</telerik:RadTreeNode>                                                    
    </Nodes>
</telerik:RadTreeView>

I am trying to access the selected node value and text when i double click on node

Javascript function
function SetPlaceHolders(sender, args) {
        var TreeView = $find("<%=RadTreeView_CommonControls.ClientID%>");
        var SelectedNode_Tree = TreeView.get_selectedNode();
        SelectedNode_Tree = TreeView.SelectedNode;
        debugger;
          
    }

var SelectedNode_Tree = TreeView.get_selectedNode(); //This is displaying Null
        SelectedNode_Tree = TreeView.SelectedNode; // This raising as Undefined


Will u please help me to fnd out this?
Plamen
Telerik team
 answered on 24 Jun 2011
1 answer
204 views
Hi,
I am using a rad grid. I have added custom template columns dynamically. On template column i am having a custom multiselect combobox (RadComboBox with CheckBox and Label inside ItemTemplate).

How can i access the combo selected value on post back due to save buton click.
if possible send me sample solution with dynamically created multiselect ComboBox.

I am using following code snnipet for custom combobox:

public class CustomDDLItemTemplate : ITemplate
{

    ListItemType templateType;
    string ColName = "AppName";

    /// <summary>
    /// Create the template
    /// </summary>
    /// <param name="container"></param>
    public void InstantiateIn(Control container)
    {      
        CheckBox checkBox = new CheckBox();
        Label lblDisplayText = new Label();      

        checkBox.ID = "checkBox";
        checkBox.Attributes.Add("onclick", "onCheckBoxClick(this,'"+ container.ClientID +"');");
        
        lblDisplayText.ID = "label";
        lblDisplayText.DataBinding += new EventHandler(this.Label_DataBind);

        // Create a new HtmlGenericControl.
        HtmlGenericControl NewControl = new HtmlGenericControl("div");

        // Set the properties of the new HtmlGenericControl control.      
        NewControl.Attributes.Add("onclick", "StopPropagation(event);");

        // Add the new HtmlGenericControl to the Controls collection of the PlaceHolder control. 
        container.Controls.Add(NewControl);

        NewControl.Controls.Add(checkBox);
        NewControl.Controls.Add(lblDisplayText);              
        break; 
    }

    public void Label_DataBind(Object sender, EventArgs e)
    {
        Label lbl = (Label)sender;
        RadComboBoxItem radCombo = (RadComboBoxItem)lbl.NamingContainer;     
        lbl.Text = DataBinder.Eval(radCombo.DataItem, ColName).ToString();
    }

  
}


Helen
Telerik team
 answered on 24 Jun 2011
3 answers
109 views
I'm using a RadToolTipManager and setting the body of my Tooltip in the .Text property (serverside).

I then add lots of tables cells to the TargetControls collection.

All works fine.

However, I want to call some javascript functions triggered by jQuery event listeners attached to elements with a known id within my Tooltip markup - e.g. a button.

This is only working for the Tooltip shown on the first table cell I hover over.

Looking at the source code, I see that a separate ToolTip is generated for EVERY cell I hover over.

This means the same id's appear multiple times - not only is this bad HTML but my triggers only work on the first one.

Is there a way to force the RadToolTipManager to only ever create one Tooltip and show that every time?

Thanks
Marin Bratanov
Telerik team
 answered on 24 Jun 2011
1 answer
71 views
Hi,

I want use this control. Is telerik provide this one. Please see the attachment. There is one text box with two button to select numeric value.

Regards,
Reyaz
Georgi Tunev
Telerik team
 answered on 24 Jun 2011
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?