This is a migrated thread and some comments may be shown as answers.

FileExplorer File Selector Dialog usercontrol issue

4 Answers 87 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
James Blair
Top achievements
Rank 1
James Blair asked on 11 Oct 2009, 03:26 PM

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;
        }

4 Answers, 1 is accepted

Sort by
0
James Blair
Top achievements
Rank 1
answered on 11 Oct 2009, 04:24 PM
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.

 

0
Fiko
Telerik team
answered on 15 Oct 2009, 12:18 PM
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.
0
James Blair
Top achievements
Rank 1
answered on 15 Oct 2009, 12:45 PM

 

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

0
Fiko
Telerik team
answered on 16 Oct 2009, 03:30 PM
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.
Tags
FileExplorer
Asked by
James Blair
Top achievements
Rank 1
Answers by
James Blair
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or