Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
132 views
Hi there,
      Im working on a collection of data in a grid. I want to set the first row of the grid selected on page-load. If anyone got any ideas please be kind enough to share.

Thanks
Savyo
Shinu
Top achievements
Rank 2
 answered on 22 May 2012
1 answer
173 views
Hey Guys,
I'm hoping you can help me out here with some ugly ajavscript errors I'm getting.
I have a usercontrol which houses an asyncupload control for uploading an image and displaying a preview.
The control works great when inserted into a page stand-alone.  Even several side by side work great.

I now have the need to dynamically load in a variable number of these into a second control according to some configuration logic.
They are added to a placeholder and reloaded with every postback to stop them disappearing.

I am testing with two controls being loaded in.  They appear to load in fine, but only one will work correctly.  Which one works depends on which you use first.  Either one, stays functional until you try and use the second, which then gives the following javascript errors as soon as you click on a file in the file chooser and try to open:

w.Content is undefined
[Break On This Error]  
 
w.Content.Page.MarshalUploads();
 
Teleri...e2c54c1 (line 30193)
Unhandled Error in Silverlight Application Failed to Invoke: _onFilesSelected. at System.Windows.Browser.ScriptObject.Invoke(String name, Object[] args) at UploadPrototype.EventManager.FilesSelected(Int32 filesCount) at UploadPrototype.MainPage.OpenDialog() at UploadPrototype.MainPage.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

Here is the source of the controls being loaded:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ImageUploader.ascx.cs" Inherits="ArtsHub.Controls.ImageUploader" %>
<telerik:RadAjaxPanel ID="rapImageUpload" runat="server" LoadingPanelID="alpLoadingPanel" RenderMode="Inline">
    <telerik:RadBinaryImage ID="imgMainImage" runat="server" ResizeMode="Fit" />
    <telerik:RadAsyncUpload ID="rauMainImage" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" OnFileUploaded="rauMainImage_FileUploaded" />
</telerik:RadAjaxPanel>
<telerik:RadAjaxLoadingPanel ID="alpLoadingPanel" runat="server" />
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
 
    function <%= this.ClientID %>_ClientFileUploaded(sender, eventArgs) {
       var rap = $find("<%= rapImageUpload.ClientID %>");
       rap.ajaxRequest();
    }
 
 
</script>
</telerik:RadCodeBlock>

And the code behind :

public partial class ImageUploader : System.Web.UI.UserControl
{
 
    public RadAsyncUpload UploaderControl { get { return rauMainImage; } }
    public RadBinaryImage BinaryImageControl { get { return imgMainImage; } }
    public Images.ImageFactory.ImageTypes ImageType { get; set; }
    public Globals.SectionIds SectionId { get; set; }
    public string ImageURL { get; set; }
    public int Width { get; set; }
    public int Height { get; set; }
    public string[] AllowedFileExtensions { get; set; }
 
    protected void Page_Init(object sender, EventArgs e)
    {
        UploaderControl.OnClientFileUploaded = this.ClientID + "_ClientFileUploaded";
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
 
            //rauMainImage.AllowedFileExtensions = AllowedFileExtensions;
        }
 
        // Get Preview Image
        if (imgMainImage.DataValue == null && ImageURL != "" && ImageURL != null)
        {
            imgMainImage.ImageUrl = ImageURL;
            imgMainImage.Width = System.Web.UI.WebControls.Unit.Pixel(Width);
            imgMainImage.Height = System.Web.UI.WebControls.Unit.Pixel(Height);
        }
 
    }
 
 
    protected void rauMainImage_FileUploaded(object sender, FileUploadedEventArgs e)
    {
        try
        {
            if (e.IsValid)
            {
                imgMainImage.Width = System.Web.UI.WebControls.Unit.Pixel(Width);
                imgMainImage.Height = System.Web.UI.WebControls.Unit.Pixel(Height);
 
                // Update preview
                using (Stream stream = e.File.InputStream)
                {
                    byte[] imageData = new byte[stream.Length];
                    stream.Read(imageData, 0, (int)stream.Length);
                    imgMainImage.DataValue = imageData;
                    imgMainImage.AlternateText = e.File.FileName;
                }
 
                // Do upload
                IListing thisItem;
 
                switch (SectionId)
                {
                    case Globals.SectionIds.News:
                        thisItem = ContentMain.GetContentMain(ContentMain.GetContentId);
                        break;
                    case Globals.SectionIds.Jobs:
                        thisItem = Job.GetJob(Job.GetJobId);
                        break;
                    case Globals.SectionIds.Classifieds:
                        thisItem = null;
                        break;
                    case Globals.SectionIds.Events:
                        thisItem = null;
                        break;
                    case Globals.SectionIds.MembersResumes:
                        thisItem = MemberResume.GetMemberResume(MemberResume.GetMemberResumeId, null, true);
                        break;
                    case Globals.SectionIds.Directory:
                    default:
                        thisItem = null;
                        break;
 
                }
 
                thisItem.UploadListingImage(e.File, ImageType);
            }
        }
        catch (Exception ex)
        {
            BLL.Emailing.Emailing.EmailBug("Error in ImageUploader.rauMainImage_FileUploaded!", "Section" + SectionId.ToString() + "<br>Error:" + ex.Message.ToString());
        }
 
 
    }
 
}

Any help is greatly appreciated.

Thanks
Peter Filipov
Telerik team
 answered on 22 May 2012
1 answer
78 views

I want to read the Header text of child grid and then use it in displaying alert for specific row.
Below is my codeBehind Code:

Telerik.Web.UI.GridColumn col = null;
            col = rgdLabTest.MasterTableView.DetailTables[0].Columns.FindByUniqueNameSafe("StartAge");
            if (col != null)
            {
                StartAgeCaption = col.HeaderText;
            }

         And in javascript i am using:
if (document.getElementById(id) != null && document.getElementById(id).value == "") {
                    var control = $("#" + id + "_text");
                    var message = '<%=BariAnalyticsEHR.Utility.ContentFetcher.GetValidationMessage("MANDATORY_1", BariAnalyticsEHR.BOL.Classes.EHRSessions.Culture)%>';
                    jAlert(message.replace("#caption#", "<%= StartAgeCaption %>"), control[0].id, null, function (r) {
                        if (r == true) {
                            $("#" + control[0].id).focus();
                        }
                    });
                    return false;
                }

StartAgeCaption value is assigend successfully in the codebehind but in javascript i am not getting that value. Its empty.

Vasil
Telerik team
 answered on 22 May 2012
6 answers
196 views
Hai,

I have grid with data which binds on page load. I have 7 tabs. On clicking the tabs, data in the grid should filter based on the value of a hidden column in the grid. I dont want the filter text box and user inputing the filter text. Is there any way to do it?

Thanks & regards,
Regeesh
pooja
Top achievements
Rank 1
 answered on 22 May 2012
1 answer
158 views
Hi to All,

am doing a web app in vs 2010. for this i want to use telerik controls.

am trying to install it. but am getting error while installation.

Error

unable to find a version of the runtime to run this app.

am getting a this error.plz tell me how to install it.
Petar
Telerik team
 answered on 22 May 2012
1 answer
143 views
Hi to All,

am doing a web app in vs 2010. for this i want to telerik controls.
am dwnloding radcontrols for asp.net from http://www.telerik.com/download-trial-file.aspx?pid=561 
while installing this exe am getting error.
but am getting error like this 

unable to find a version of the runtime to run this application.
how to resole it plz tell me 
Petar
Telerik team
 answered on 22 May 2012
7 answers
805 views
I want to clear all filter item values programatically when I click on certain buttons.  How can I achieve this?

Thanks!
Hari
Top achievements
Rank 1
 answered on 22 May 2012
6 answers
181 views
I have the following RadEditor:

<telerik:RadEditor ID="RadEditor1" runat="server" EditModes="Design, Preview" Skin="Outlook" EnableResize="true">
    <CssFiles>
        <telerik:EditorCssFile Value="StyleSheet.css" />
    </CssFiles>
    <Content>
        Editor content 1
    </Content>
</telerik:RadEditor>

The css inside StyleSheet.css is applied to the content of the RadEditor as expected. However, when this RadEditor is placed inside a RadWindow the css doesn't work.

How can I get the css to work when the RadEditor is inside a RadWindow?
Dean
Top achievements
Rank 1
 answered on 21 May 2012
2 answers
256 views
EDIT: I just realize The title is misleading. The OnAjaxUpdate DOES fire, but I get the error: 'Sys.ArgumentNullException: Sys.ArgumentNullException: Value cannot be null.Parameter name: panelsUpdated[0]'.


I have a RadGrid inside a panel and I Ajaxify the panel as an AjaxSetting using an RadAjaxManager. A popup window let's the user add items to the grid on closing via javascript, which then calls the RadAjaxManager's AjaxRequest. This all works great.

I have a couple RadToolTipManager's that are wired to elements in the RadGrid. On page load or reload, the tooltips work great. However, if the user adds an item via the popup window which calls the RadAjaxManager's AjaxRequest, the tootips don't work (unless the page is refreshed which defeats the purpose). All the user gets is the native tooltip text and nothing else.

So, after reading the forums, I realized I needed to add each RadTooltipManager as AjaxSettings in the RadAjaxManager. I did that and the tooltip begins to fire now, but after a few seconds it tosses an error: 'Sys.ArgumentNullException: Sys.ArgumentNullException: Value cannot be null.Parameter name: panelsUpdated[0]'.

Here's the HTML side of things...
<telerik:RadCodeBlock>
    <script type="text/javascript">
        function OnClientClose(oWnd, args) {
            var arg = args.get_argument();
            if (arg) {
                var retValue = arg.ReturnValue;
 
                if (arg.ReturnValue == "ONE" || arg.ReturnValue == "TWO") {
                    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                    ajaxManager.set_enableAJAX(true);
                    ///this calls RadAjaxManager1_AjaxRequest() server side
                    ajaxManager.ajaxRequest(arg.ReturnValue); 
                }
                else {
                    __doPostBack('__Page', 'REFRESH|' + retValue)
                }
            }
        }
    </script>
</telerik:RadCodeBlock>
<des:PageManager ID="PageManager1" runat="server" AJAXFramework="TelerikRadAJAX"
    AJAXControlID="ScriptManager1">
    <ChangeMonitor Enabled="True" UseValidationGroups="True" />
</des:PageManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="pnlONE">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="pnlONE" LoadingPanelID="AjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="pnlTWO">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="pnlTWO" LoadingPanelID="AjaxLoadingPanel1" />           
                <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
                <telerik:AjaxUpdatedControl ControlID="RadToolTipManager3" />
            </UpdatedControls>
        </telerik:AjaxSetting>           
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Transparency="55"
    BackColor="#E0E0E0">
    <div style="text-align: center">
        <asp:Image ID="imgPanelImage" runat="server" AlternateText="Loading..." ImageUrl="~/Images/ajax-loader.gif" />
    </div>
</telerik:RadAjaxLoadingPanel>

And the C# side....
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    RadToolTipManager1.TargetControls.Clear();
    RadToolTipManager3.TargetControls.Clear();
 
    //this is called from ajaxRequest() client side
    if (e.Argument == "ONE")
        grdONE.DataBind();
    else if (e.Argument == "TWO")
        grdTWO.DataBind();
}
 
protected void grdTWO_ItemDataBound(object sender, GridItemEventArgs e)
{
    ...
    this.RadToolTipManager1.TargetControls.Add(...)
    this.RadToolTipManager3.TargetControls.Add(...)
    ...
}
 
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
{
 
    this.UpdateToolTip(args.Value, args.UpdatePanel);
}
private void UpdateToolTip(string elementID, UpdatePanel panel)
{
    ...
}


Any ideas?

Thanks for any help,
Robert 






Robert Helm
Top achievements
Rank 1
 answered on 21 May 2012
1 answer
91 views
When I click on the grid drag drop column, it highlights but is twice the size of the normal row.

What is the CSS responsible for the changing of this design?

.rgDragCol  ?

Richard
Top achievements
Rank 1
 answered on 21 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?