Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
323 views

hi,
I try to implement custom control (inherit RadComboBox). For customize dropdownList I make the class for radcombobox.ItemTemplate. In this class in InstantiateIn method add some labels with DataBinding eventhandler.

I also set event ItemsRequested for data load ondemad:
void RadComboBox_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
int noItems = 15;

RadComboBox combo = (RadComboBox)o;
combo.DataSourceID =
null;
combo.DataSource =
null;
String sortExpression = this.Sort.SelectedValue;

// new datasource
ObjectDataSource ods = new ObjectDataSource("Artikli", "GetArtikliPagedSortedKlas");
// set parameters
ods.SelectParameters.Add("maximumRows", noItems.ToString());
ods.SelectParameters.Add(
"sortExpression", sortExpression);
//.... // there are more parameters. Those parameters must set at this point(depends from other controls)

combo.DataSource = ods;
combo.DataBind();
// There get the message InvalidOperationException ONLY IF PUT THE CONTROL IN FORMVIEW(on edit)
//Error message:"Databinding methods such as Eval(), XPath(), and Bind() can only be used in 
the context of a databound control."
}

 The new control works fine until I don't databind it. My case:put it on the FormView, databind and on run time choose edit(insert i did't try).

To summarize:

  1.  How to databind ondemad. In DropDownList header I have some extra controls on which values depends query to database.
  2. How to determine what is select for first time when user choose edit in FormView - to prepare a query which included rigt row.
  3. If in custom control add a new public property, put the control into FormView itemtemplate and bind any field get the error:(There was an error rendering the control. Cannot create an object of type 'System.Collections.Generic.List`1......) Set attribute [Bindable(false)] doesn't solve problem.

 The solution must be acteptable also for radgrid and gridview.

Simon
Telerik team
 answered on 07 Jul 2008
1 answer
125 views

Hi,
I am using TabStrips for creating tabs in my project. Previously i have created tabs structure as shown in the diagram

Now as per our new project requirement i want to change the tab look in to hyper link like structure. as shown in diagram


 So is there any solution how can we convert these tabs look in to hyper link. So please suggest solution for that

Thanks and regard,
Sagar

Paul
Telerik team
 answered on 07 Jul 2008
2 answers
161 views

I have a RadEditor (version 415)  in UserControl surounded by a standard panel, I am using a RadTree to load the content in the User control and also load html from my database etc... so far so good.

Now in my Rad Editor I have all the tools etc.. and 1 Custom Dialog.
when the Ajaxing is switched on a browser pop up says the that the custom dialog command is not implemented, thats because the js is not rendering on the page. All the other Dialogs work fine.

I upgraded to release version 619 and then none of the dialogs worked at all so I have to revert back to version 415.

I have tried registering the script block and movimng it into the Page scope from the ascx, but no love there either I have spend a day on this and I'm about to give the whole telerik ajax thing the flick if I can't get this working.

[CODE]

<

telerik:RadEditor

ID="RadEditor1"

runat="server"

Width="99%"

height="650"

Skin="WebBlue"

>

<Tools>

<telerik:EditorToolGroup>

<telerik:EditorTool Name="AjaxSpellCheck" />

<telerik:EditorTool name="FindAndReplace" shortcut="CTRL+F" />

<telerik:EditorSeparator />

<telerik:EditorTool name="Cut" shortcut="CTRL+X" />

<telerik:EditorTool name="Copy" shortcut="CTRL+C" />

<telerik:EditorTool name="Paste" shortcut="CTRL+V" />

<telerik:EditorTool name="PasteFromWord" />

<telerik:EditorTool name="PasteFromWordNoFontsNoSizes" />

<telerik:EditorTool name="PastePlainText" />

<telerik:EditorTool name="PasteAsHtml" />

<telerik:EditorSeparator />

<telerik:EditorTool name="Undo" shortcut="CTRL+Z" />

<telerik:EditorTool name="Redo" shortcut="CTRL+Y" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup>

<telerik:EditorTool name="ImageManager" shortcut="CTRL+G" />

<telerik:EditorTool name="ImageMapDialog" />

<telerik:EditorTool name="AbsolutePosition" />

<telerik:EditorSeparator />

<telerik:EditorTool name="FlashManager" />

<telerik:EditorTool name="MediaManager" />

<telerik:EditorTool name="DocumentManager" />

<telerik:EditorTool name="TemplateManager" />

<telerik:EditorTool name="LinkManager" shortcut="CTRL+K" />

<telerik:EditorTool name="Unlink" shortcut="CTRL+SHIFT+K" />

<telerik:EditorTool Name="InsertSpecialLink" Text="Insert Page Link" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup>

<telerik:EditorTool name="Bold" shortcut="CTRL+B" />

<telerik:EditorTool name="Italic" shortcut="CTRL+I" />

<telerik:EditorTool name="Underline" shortcut="CTRL+U" />

<telerik:EditorTool name="StrikeThrough" />

<telerik:EditorSeparator />

<telerik:EditorTool name="JustifyLeft" />

<telerik:EditorTool name="JustifyCenter" />

<telerik:EditorTool name="JustifyRight" />

<telerik:EditorTool name="JustifyFull" />

<telerik:EditorTool name="JustifyNone" />

<telerik:EditorSeparator />

<telerik:EditorTool name="Indent" />

<telerik:EditorTool name="Outdent" />

<telerik:EditorTool name="InsertOrderedList" />

<telerik:EditorTool name="InsertUnorderedList" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup>

<telerik:EditorTool name="ConvertToLower" />

<telerik:EditorTool name="ConvertToUpper" />

<telerik:EditorSeparator />

<telerik:EditorTool name="InsertTable" />

<telerik:EditorTool name="InsertSnippet" />

<telerik:EditorTool name="InsertFormElement" />

<telerik:EditorTool name="InsertSymbol" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup>

<telerik:EditorTool name="ForeColor" />

<telerik:EditorTool name="BackColor" />

<telerik:EditorSeparator />

<telerik:EditorTool name="FontName" />

<telerik:EditorTool name="FontSize" />

<telerik:EditorTool name="ApplyClass" />

<telerik:EditorTool name="InsertCustomLink" />

<telerik:EditorTool name="FormatBlock" />

<telerik:EditorSeparator />

<telerik:EditorTool name="FormatStripper" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup>

<telerik:EditorTool name="IncreaseSize" shortcut="F10" />

<telerik:EditorTool name="DecreaseSize" shortcut="F9" />

<telerik:EditorTool name="Print" shortcut="CTRL+P" />

<telerik:EditorTool name="Superscript" />

<telerik:EditorTool name="Subscript" />

<telerik:EditorTool name="InsertParagraph" />

<telerik:EditorTool name="InsertHorizontalRule" />

<telerik:EditorTool name="InsertDate" />

<telerik:EditorTool name="InsertTime" />

<telerik:EditorSeparator />

<telerik:EditorTool name="AboutDialog" />

<telerik:EditorTool name="Help" shortcut="F1" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup>

<telerik:EditorTool name="ToggleScreenMode" shortcut="F11" />

<telerik:EditorTool name="ToggleTableBorder" />

<telerik:EditorTool name="Zoom" />

<telerik:EditorTool name="ModuleManager" />

<telerik:EditorTool name="ToggleDocking" />

<telerik:EditorTool name="RepeatLastCommand" shortcut="F4" />

</telerik:EditorToolGroup>

</Tools>

<DocumentManager DeletePaths="/Documents/" UploadPaths="/Documents/" ViewPaths="/Documents/" />

<ImageManager DeletePaths="/Images/" UploadPaths="/Images/" ViewPaths="/Images/" />

<MediaManager UploadPaths="/Media/" DeletePaths="/Media/"

ViewPaths="/Media/"

SearchPatterns="*.wma,*.wmv,*.avi,*.wav,*.mpeg,*.mpg,*.mpe,*.mp3,*.divx,*.m3u,*.mid,*.midi,*.snd,*.mkv,*.m4v,*.mp4"

MaxUploadFileSize="10240000">

</MediaManager>

<TemplateManager UploadPaths="/Templates/" DeletePaths="/Templates/" ViewPaths="/Templates/" />

<FlashManager UploadPaths="/Flash/" DeletePaths="/Flash/" ViewPaths="/Flash/" />

</telerik:RadEditor>


<script type="text/javascript">

//<![CDATA[

Telerik.Web.UI.Editor.CommandList[

"InsertSpecialLink"] = function(commandName, editor, args)

{

var elem = editor.getSelectedElement(); //returns the selected element.

if (elem.tagName == "A")

{

editor.selectElement(elem);

argument = elem;

}

else

{

var content = editor.getSelectionHtml();

var link = editor.get_document().createElement("A");

link.innerHTML = content;

argument = link;

}

var myCallbackFunction = function(sender, args)

{

editor.pasteHtml(String.format(

"<a href=\"{0}\" originalAttribute="href" originalPath="\"{0}\"" >{1}</a> ", args.href, args.name))

}

editor.showDialog(

"InsertSpecialLink", argument, myCallbackFunction);

};

</script>

//// Code Behind Called on Page Load


private void InsertCustomDialogues()

{

DialogDefinition insertSpecialLinkDialogDefinition = new DialogDefinition("~/UI/Content/ItemSelect.ascx", new DialogParameters());

insertSpecialLinkDialogDefinition.Modal =

true;
insertSpecialLinkDialogDefinition.VisibleTitlebar =
true;
insertSpecialLinkDialogDefinition.VisibleStatusbar =
true;
insertSpecialLinkDialogDefinition.Width =
Unit.Pixel(250);
insertSpecialLinkDialogDefinition.Height =
Unit.Pixel(650);
insertSpecialLinkDialogDefinition.VisibleStatusbar =
false;

RadEditor1.AddDialogDefinition(

"InsertSpecialLink", insertSpecialLinkDialogDefinition);

}




[CODE]

Rumen
Telerik team
 answered on 07 Jul 2008
9 answers
818 views
Hi,

How do I set the RadGrid width and height in javascript?  I dont know if I am doing this correctly...but here is what i did...

I have a window.onresize function to make the grid fill the whole browser based on the browser size, which is working fine when I use the following function with code as follows:-
"var grid = document.getElementById("<%=Grid.ClientID%>");
grid.style.width = "1000px" <--- calculated based on current window size
grid.style.height = "1000px" etc...."

But, when I call the same function with window.onload, the width is resizing fine...but the grid.style.height is not filling the screen in FIREFOX 3.0.  For some reason, the repaint/redraw of the grid is not called? 

Is there another way of resizing the grid in javascript besides calling element.style.height/width?

Cheers,
Josh
Veli
Telerik team
 answered on 07 Jul 2008
3 answers
123 views
I have a grid in which I have a RadCombobox. If the text of the combobox changes in 'scheduled' a mail must be sent. This works fine. 
            Dim cell1 As TableCell = editItem("ddlStatus")  
            Dim Status As String = (CType(cell1.Controls(0), RadComboBox)).Text  
             
           If Status = "Scheduled" Then  
 ' rest of code
 
As you may notice the mail will also be sent if something else in the grid changes. The mail must only be sent if the combobox changes. It has something to do with SelectedIndexChanged, but this event must be fired when clicking the 'updatebutton'.

How do I arrange this?
Iana Tsolova
Telerik team
 answered on 07 Jul 2008
1 answer
101 views

I have datepicker user control and run this on load.

In ie6 it loads the page for a couple seconds then it refreshes the page once it finishes loading the javascript.  The below script is run for each calendar.  I have tons of calendars on the page - over 25.

Is there a solution to the page refresh.  In ie7 it doesn't refresh - it just takes longer to load.

string
script = string.Format(@"

var {0}invalidInput = false;

var {0}errmessage = '';

function {0}_ShowDetails()

{{

var pnlName = '{0}_pnlDetails';

var myPanel = document.getElementById(pnlName);

if (myPanel != undefined)

{{

myPanel.style.display='block';

var rfvName = '{0}_rfv';

var ReqValidator = document.getElementById(rfvName);

ValidatorEnable(ReqValidator,true);

}}

}}

function {0}_HideDetails()

{{

var pnlName = '{0}_pnlDetails';

var myPanel = document.getElementById(pnlName);

if (myPanel != undefined)

{{

myPanel.style.display='none';

var rfvName = '{0}_rfv';

var ReqValidator = document.getElementById(rfvName);

ValidatorEnable(ReqValidator,false);

}}

}}

function {0}_OnDateSelected(sender, args)

{{

{0}invalidInput = false;

{0}_ShowDetails();

}}

function {0}_OnError(sender, args)

{{

if (args.get_reason() == Telerik.Web.UI.InputErrorReason.ParseError)

{{

{0}errmessage='Date must be in valid format (mm/dd/yyyy)';

{0}invalidInput = true;

}}

else if (args.get_reason() == Telerik.Web.UI.InputErrorReason.OutOfRange)

{{

{0}errmessage='Date out of range';

{0}invalidInput = true;

}}

alert({0}errmessage);

}}

function {0}_CustomValidate(sender, args)

{{

var customVal = document.all ? document.all['{1}'] : document.getElementById('{1}');

customVal.errormessage = {0}errmessage;

if ({0}invalidInput)

args.IsValid = false;

}}

function {0}_OnBlur(sender, args)

{{

if (sender.GetTextBoxValue() == '')

{{

{0}invalidInput = false;

}}

}}"

, this.ClientID, CustomValidator1.ClientID);

RadDatePicker picker = (RadDatePicker)RadDatePicker1;

RadDatePicker1.DateInput.ClientEvents.OnError =

string.Format("{0}_OnError", this.ClientID);

RadDatePicker1.DateInput.ClientEvents.OnBlur =

string.Format("{0}_OnBlur", this.ClientID);

RadDatePicker1.ClientEvents.OnDateSelected =

string.Format("{0}_OnDateSelected", this.ClientID);

CustomValidator1.ClientValidationFunction =

string.Format("{0}_CustomValidate", this.ClientID);

Pavel
Telerik team
 answered on 07 Jul 2008
4 answers
234 views
Multiline textboxes are not appearing when the RadFormDecorator is being used. The same textbox set to singleline will appear.

This problem is occurring when using IE7 as the browser. It appears normally in Firefox.

If the RadFormDecorator is removed, the multiline text box appears normally.

In our application, the RadFormDecorator is located in the master page.

Is there a solution to this problem?

Jacques
Jacques
Top achievements
Rank 1
 answered on 07 Jul 2008
5 answers
424 views
Hi,

I want to call a client side script inside an ItemTemplate.
The function accepts 2 parameters, the ID and the index of the row.

I trigger all this by setting:

<ItemTemplate> 
      <div style="background-color:Gray; padding:5px"> <a href="#" onclick="openRadWindow('<%#DataBinder.Eval(Container.DataItem,"ID")%>'); return false;">Test</a> 
     </div> 
</ItemTemplate> 

As you can see, the second parameter is missing. I am inside a hira. Table. I want to get the index of the parent table inside the DataBinder. Is there a way to get the value?

Another solution I am searching for ist to get the current selected row via client API without eventargs.

In detail I just want to collapse the parent row and open a radwindows (which works already) when the button inside the template is clicked. Maybe you have another idea.

Thanks!
Chris
Veli
Telerik team
 answered on 07 Jul 2008
1 answer
73 views
if we select any text within a <SPAN> and do 'cut' operation and paste it somewhere else then it introduce the nested <FONT> tag at the position where we paste it. It is creating a problem for our application.

We are useing 

RadEditor1.Document.execCommand(

"Cut", false, null);
RadEditor1.Document.execCommand("Copy", false, null);
RadEditor1.Document.execCommand("Paste", false, null);

Also i tried to find any client event for RadEditor but there is no such command that support cut copy paste.

Is there any Client side command for Editor itself that will not introduce this extra <FONT> tag on these Cut, Copy, Paste operation.

Thanks in advance for any fruitfull suggestion.

 

Rumen
Telerik team
 answered on 07 Jul 2008
1 answer
76 views
I have a grid in which i generate 10 columns dynamically. All columns width is greater than grid width and I have an horizontal scrollbar. If I scroll at right of my grid I miss one column. If I click add new record and pass in edit mode (edit in place), I don't see missing column but with TAB i can set cursor in that field. If I insert my data, now I see my last column.

Do you know why ?

I don't set mastertableview width and I also try to set it at 100% but I have the same result

Thanks
Princy
Top achievements
Rank 2
 answered on 07 Jul 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?