FileExplorer File Selector Dialog usercontrol issue

5 posts, 0 answers
  1. James Blair
    James Blair avatar
    3 posts
    Member since:
    Aug 2012

    Posted 11 Oct 2009 Link to this post

    Hi, i am trying to use the file explorer on a page which has a master page of which the controls (text boxes) on the pages are genarated from a usercontrol, i'm trying to have two text boxes which both link to the file explorer using the file seletor dialog demo http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/fileselectordialog/defaultcs.aspx, everything seems to work apart from when i click the files on file explorer the window shuts but my file paths are not transfered to the text boxes , below is the code that is genarated from one of the usercontrols on the page which look like its passing the corrent name of the control but i'm not sure if i am mising something? any help would be great

    renderd usercontrol
    <input name="ctl00$ContentPlaceHolder3$HomeBannerZone2$TXBHeadingLink" type="text" value="some text" id="ctl00_ContentPlaceHolder3_HomeBannerZone2_TXBHeadingLink" style="width:500px;" />

    Renderd Java
      function OnFileSelected(wnd, fileSelected)
            {
                var textbox = $get("ctl00_ContentPlaceHolder3_HomeBannerZone2_TXBHeadingLink");
                textbox.value = fileSelected;
            }

  2. James Blair
    James Blair avatar
    3 posts
    Member since:
    Aug 2012

    Posted 11 Oct 2009 Link to this post

    I've now got the control kind of working, as said i have two users controls on the one page and each user control is displaying the java for each control using the java below


     

    //This function is called from the Explorer.aspx page

     

     

    function OnFileSelected(wnd, fileSelected)

     

    {

     

    var textbox = $get("<%= TXBbackgroundImage.ClientID %>");

     

    textbox.value = fileSelected;

     

     

    }


    1.
      //This function is called from the Explorer.aspx page
            function OnFileSelected(wnd, fileSelected)
            {
                var textbox = $get("ctl00_ContentPlaceHolder3_HomeBannerZone1_TXBbackgroundImage");
                textbox.value = fileSelected;
               
                
            }
    2.
       function OnFileSelected(wnd, fileSelected)
            {
                var textbox = $get("ctl00_ContentPlaceHolder3_HomeBannerZone2_TXBbackgroundImage");
                textbox.value = fileSelected;
               
                
            }


    so when i try to use the file explorer from one text box the control uses the frist java is see's and only sets the text  on the last usercontrol.

     

  3. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 15 Oct 2009 Link to this post

    Hi James,

    This is a common behavior in user control scenarios and it is not related to our controls. In your case, however, if you open a new support ticket and send me your project, I will rework it to work correctly.

    Best wishes,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  4. James Blair
    James Blair avatar
    3 posts
    Member since:
    Aug 2012

    Posted 15 Oct 2009 Link to this post

     

    Hi Manage to do a work around

    Added a attribute to each usercontrols addded on the page

     

    selectFile.Attributes.Add(

    "onclick", "OpenFileExplorerDialog2(" & TypeID & "); return false;")

     

     

    passed this into a control on the main page to set the value of the seleted box when seleted

    function

     

    OpenFileExplorerDialog2(a)

     

    {

    document.getElementById(

    "ctl00_ContentPlaceHolder3_Label1").innerText=a;

     

     

    var textbox = $get("<%= TXBbackgroundImage.ClientID %>");

     

     

    var wnd = $find("<%= ExplorerWindow.ClientID %>");

     

    wnd.show();

    }


    update the text box on the returned call#

     

     

    function OnFileSelected(wnd, fileSelected)

     

    {

     

     

    if (document.getElementById("ctl00_ContentPlaceHolder3_Label1").innerText == 1 )

     

    {

    document.getElementById(

    "ctl00_ContentPlaceHolder3_HomeBannerZone1_TXBbackgroundImage").innerText = fileSelected;

     

    }

     

    else

     

    {

    document.getElementById(

    "ctl00_ContentPlaceHolder3_HomeBannerZone2_TXBbackgroundImage").innerText = fileSelected;

     

    }

    Thanks

  5. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 16 Oct 2009 Link to this post

    Hello James,

    We are glad that you were able to find a solution yourself.

    Having other questions, please feel free to ask us.

    All the best,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top