This is a migrated thread and some comments may be shown as answers.
rad combo box in radUpload
1 Answer 51 Views
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 16 Jul 2008, 07:46 PM
Hello,

I am trying to add a rad combo box into the custom fields of a raduploader but I'm getting some errors. 

I created a javascript function that adds controls to the custom fields of the rad upload but, in order to put the rad combo box in, I need to call the render method from my server side code.  I wanted to take the html that was produced in the render and put it in the table cell's inner html.  The problem is that the combo box render method returns javascript functions that don't seem to work.

The error I get is: "'RadControlsNamespace' is Undefined"

The generated javscript looks like this:
"

cell.innerHtml = <div id=

"ctl02_wrapper" style="display:inline">
<!-- 2.8.4 --><script type=
"text/javascript" src="/WebResource.axd?d=kMNCn9DBFwUZ2PT3nr9Q8nKTfGxfqM3IzFnt6T4kZDu4u6ciNTtF77By2rZgy2esxjRhzIOLrLIYf5J1XBkdPBu0RcNwEvenr7LitxYGTM_9zU--1dBU2yjkl0u2Qlf70&amp;t=633512827776734358"></script><div class="ComboBox_Default" id="ctl02" style="display:inline; white-space: nowrap;"><input type="text" id="ctl02_Input" name="ctl02_Input" value="" class="ComboBoxInput_Default" style="width:150px;" readonly="readonly"></input><img alt="" id="ctl02_Image" src="/WebResource.axd?d=kMNCn9DBFwUZ2PT3nr9Q8nKTfGxfqM3IzFnt6T4kZDu4u6ciNTtF77By2rZgy2eso7GBTTPlY_CgFW08xP6ilOK6Ftuf4jEzx__hxukw6JIsIH6jBcz5cAnBp-6BP6X10&amp;amp;t=633512827776734358" class="ComboBoxImage_Default"></img><div id="ctl02_DropDownPlaceholder" style="position:absolute; display: none; z-index: 300;" class="ComboBoxDropDown_Default"><div id="ctl02_DropDown" style="overflow:auto;white-space:normal;"></div></div><span id="ctl02StyleSheetHolder" style="display:none;"></span><script type="text/javascript">RadControlsNamespace.AppendStyleSheet(false, 'ctl02', '/WebResource.axd?d=kMNCn9DBFwUZ2PT3nr9Q8nKTfGxfqM3IzFnt6T4kZDu4u6ciNTtF77By2rZgy2eso7GBTTPlY_CgFW08xP6ilLUVz9i9yv34zs8tlQJer5FL-YYvN_lmRn81TOiDQ9Yu0&amp;t=633512827776734358');"

Below is some of the code:

private string GetJavascript()

{

RadComboBox cbo = new RadComboBox();

cbo.SkinsPath =

"";

this.Controls.Add(cbo);

StringWriter strWriter = new StringWriter();

HtmlTextWriter writer = new HtmlTextWriter(strWriter);

cbo.RenderControl(writer);

string cboRender = strWriter.ToString();

this.Controls.Remove(cbo);

string javascript = "";

javascript =

@"function addTitle(radUpload, args)

{

var row = args.Row;

var cell = row.insertCell(-1);

var text = document.createElement('span');

text.innerHTML = 'Title: ';

cell.valign = 'bottom';

cell.appendChild(text);

cell = row.insertCell(-1);

var title = document.createElement('input');

title.id = title.name = radUpload.GetID('title');

cell.appendChild(title);

cell = row.insertCell(-1);

cell.innerHtml = "

+cboRender+@";

}"

;

return javascript;

}

I would appreciate any information I could get on this.

Thanks,
Dale

1 Answer, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 17 Jul 2008, 07:46 AM
Hi Chris,

The "additional fields" capability of RadUpload is limited to simple HTML elements - text fields and boolean elements. Adding composite controls like RadComboBox instances is possible, but it involves too much changes to both RadUpload and RadComboBox logic, which go beyond the scope of the controls.

As per the "'RadControlsNamespace' is Undefined" problem - this happens, because the <script> element is added dynamically to the page and the browser has not retrieved the script information from the server. The best approach in solving this particular problem would be to add the <script> element initially to the page.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Asked by
Chris
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Share this question
or