Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
273 views
Hi all
I am using the RadComboBox in an ASP.NET MVC enviroment.
When I let run the RadCombobox within a <form id="form1" runat="server">  all works fine.
But the goal of MVC is to work without a ViewState in order to avoid any overhead, so I try to use the RadComboBox without the ViewState, means use Html.Begin() and Html.EndForm() instead of  <form id="form1" runat="server">.

When I do so, the following runtime error occurs:

Runtime error in Microsoft JScript: 'attributes' is Null or not an object

at Line 1900 in Telerik.Web.Ui.Webresource_1.axd

if(_2e["attributes"]){
this.get_attributes()._load(_2e["attributes"]);
}

 
I assume now, that RadComboBox is only useable when a ViewState is available. If yes, can you tell me which other controls are dependent of the ViewState? And if no, can you tell me what I am doing wrong? Here is my code:

In the MasterPage:
<% using(Html.BeginForm()) { %>

 

 

<telerik:RadScriptManager ID="mainRadScriptManager" runat="server" EnableTheming="True" />

 

......

 

 

In the View:

 

<%

categoryRadComboBox.DataSource = ViewData[

 

ProductController.Identifiers.DataSources.Categories];

 

categoryRadComboBox.DataBind();

%>

 

 

<telerik:RadComboBox ID="categoryRadComboBox" Runat="server"

 

AutoPostBack="True" DataTextField="Name"

 

 

 

DataValueField="ProductCategoryID" Height="66px" Width="250px" Skin="Default" MaxHeight="400px">

 

 

 

 

</telerik:RadComboBox>

And in the Controller:

 

 

 

string categoryValue = RadControlHelper.ExtractComboBoxValue(Request, Identifiers.Controls.CategoriesComboBox);

 

AdventureWorksDataContext context = new AdventureWorksDataContext();

 

 

 

var categories = from category in context.ProductCategories

 

 

 

orderby category.Name

 

 

 

select new { category.Name, category.ProductCategoryID };

 

 

 

ViewData[

Identifiers.DataSources.Categories] = categories.ToList();

 

 

 

 

 

 

 


Thanks for your help and best regards.
Hans

 

 

 

 

 

Atanas Korchev
Telerik team
 answered on 17 Jun 2009
1 answer
93 views
Hi

When using the page size drop down on the grid it vanishes leaving me unable to change the page size again. Is it possible to keep the page size drop down visiable at all times? It seems to vanish when you select a number that is between  the top and bottom range of that page size. 
e.g. I have 15 records and select a page size of 20, loses page size drop down.

Thanks
Pavlina
Telerik team
 answered on 17 Jun 2009
1 answer
411 views
Hi there,

I am having a problem trying to databind to a RadComboBox in the codebehind.  I have two RadComboBoxes, and when I select something from the first, I want to update the available list in the second.  To do this, I am catching the SelectedIndexChanged event for the first combobox and want to set the DataSource property for the second combobox but when I do the DataBind, the following error appears: "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

Here is my sub in the codebehind where I am doing this DataBind.  When I step through it, the 'found.Factors' list is populated as expected, but the DataBind still does not work.

 

protected void FactorTypeList_SelectedIndexChanged(object source, RadComboBoxSelectedIndexChangedEventArgs e)

 

{

 

//Identify the Factor Type Column/ComboBox.

 

 

GridTemplateColumn FactorTypeColumn = (GridTemplateColumn)CRFGrid.Columns.FindByDataField("FactorType.Name");

 

 

RadComboBox FactorTypeComboBox = (RadComboBox)FactorTypeColumn.CurrentColumnEditor.ContainerControl.FindControl("FactorTypeList");

 

 

//Identify the Factor Column/ComboBox.

 

 

GridTemplateColumn FactorColumn = (GridTemplateColumn)CRFGrid.Columns.FindByDataField("Factor.Name");

 

 

RadComboBox FactorComboBox = (RadComboBox)FactorColumn.CurrentColumnEditor.ContainerControl.FindControl("FactorList");

 

 

////Check on the currently selected item.

 

 

if (FactorTypeComboBox.SelectedIndex == 0)

 

{

 

//The User has deselected the item so all Factors should be available.

 

FactorComboBox.DataSource = FactorDataSource;

FactorComboBox.DataBind();

}

 

else

 

{

 

//Update the Factor ComboBox with the Factors for the selected Factor Type.

 

 

SustainmentDataClassesDataContext ctx = new SustainmentDataClassesDataContext();

 

 

var FactType = from p in ctx.FactorTypes

 

 

where p.Name == FactorTypeComboBox.Text

 

 

select p;

 

 

if (FactType != null)

 

{

 

FactorType found = FactType.First<FactorType>();

 

FactorComboBox.DataSource = found.Factors;

FactorComboBox.DataBind();

}

}

}

Here is my GridTemplateColumn in the markup:

 

<%

-- Factor Column--%>

 

 

<telerik:GridTemplateColumn

 

 

DataField="Factor.Name"

 

 

HeaderText="<%$ Resources:Sustain, Factor %>">

 

 

<headerstyle width="120" />

 

 

<EditItemTemplate>

 

 

<telerik:RadComboBox

 

 

id="FactorList"

 

 

runat="server"

 

 

skin="Vista"

 

 

allowcustomtext="false"

 

 

datasourceid="FactorDataSource"

 

 

datavaluefield="Id"

 

 

datatextfield="Name"

 

 

SelectedValue='<%# Bind("FactorId") %>'

 

 

AppendDataBoundItems="True"

 

 

AutoPostBack="True"

 

 

OnSelectedIndexChanged="FactorList_SelectedIndexChanged"

 

 

CausesValidation="false">

 

 

<Items>

 

 

<telerik:RadComboBoxItem

 

 

runat="server"

 

 

Text="<%$ Resources:Grid, EmptyListItemText%>"

 

 

Value="-1" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<span style="color: Red">*</span>

 

 

<asp:CompareValidator

 

 

ID="CompareValidatorFactor"

 

 

ValueToCompare="<%$ Resources:Grid, EmptyListItemText%>"

 

 

Operator="NotEqual"

 

 

ControlToValidate="FactorList"

 

 

ErrorMessage="<%$ Resources:Sustain, ValidationText_MandatoryField%>"

 

 

runat="server"/>

 

 

</asp:CompareValidator>

 

 

</EditItemTemplate>

 

 

<ItemTemplate>

 

 

<asp:Label

 

 

id="lblFact"

 

 

runat="server"

 

 

Text='<%# Eval("FactorName") %>'>

 

 

</asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn >

 

 

 

I am in a bit of a rush to get this done and its really frustrating so any help would be greatly appreciated.

Thanks,

Martin

Veli
Telerik team
 answered on 17 Jun 2009
4 answers
644 views

I am using
Q3 - 2008.3.1125.35

for Rad Upload i need only certain file types
i tried 2 methods
1) 

string

 

[] allowedFileExtensions = new string[2] { ".zip", ".doc" };

 

RadUpload1.AllowedFileExtensions = allowedFileExtensions;

 

 
2)

<

 

telerik:RadUpload ID="RadUpload1" runat="server" AllowedFileExtensions=".zip,.doc">

 

 

 

</telerik:RadUpload>

still not working, it is still showing the default one.
Please help

 

 

Atanas Korchev
Telerik team
 answered on 17 Jun 2009
1 answer
58 views
Hi,

I have set the option for multilanguage spell checking in RadSpell control. I am getting German and french in the dropdown. However, even if i select German or French in Dropdown and click on spell check it alwys shows English dictionary. Please let me know why this is happenning and what to do. Please do reply ASAP.

Thanks in advance.
Kripa
Rumen
Telerik team
 answered on 17 Jun 2009
0 answers
98 views

Hi,

I am having following unexpected behavior:

After canceling request when a file is too big, when I am selecting another file, args._progressData.RadUpload.RequestSize is from previous file and not from one which I just selected.


Code:
function CheckUploadedImageFilesSize(progressArea, args)
{
        if(args._progressData.RadUpload.RequestSize > maxSize)
        {
            progressArea.cancelRequest();
        }
}
Iulian
Top achievements
Rank 1
 asked on 17 Jun 2009
1 answer
99 views
Hey Folks. I've setup the Client-side master/detail binding as per Vlad's examples and am having some problems with this particular function:


function RadGrid1_HierarchyExpanding(sender, args) {
    collapseItems(sender);

    try {

        var customerID = args.getDataKeyValue("CustomerID");
        var nestedViewItem = args.get_nestedViewItem();

        nestedViewItem.cells[1].appendChild($get("RadGrid2"));

        ordersView = $find("RadGrid2").get_masterTableView();

        ordersCommandName = "Load";

        WebService.GetOrdersByCustomerID(customerID, ordersView.get_currentPageIndex() * ordersView.get_pageSize(), ordersView.get_pageSize(),
                    ordersView.get_sortExpressions().toString(), ordersView.get_filterExpressions().toDynamicLinq(),
                        updateOrdersGrid);
    }
    catch (Error) {
        alert(Error);
    }
}

Both IE and Firefox complain that cells is undefined. Firefox can see it, so I think the cells is private to the row. How else can I replace the nestedViewItem.cells[] content? I think everything else is working OK.



Sebastian
Telerik team
 answered on 17 Jun 2009
0 answers
378 views
Telerik RadXmlHttpPanel is an UI control that serves as a container for rapid content loading. You can place diverse content on the RadXmlHttpPanel: rich user content, user controls or just about anything that could be added on a page.
There are three ways for loading data on the RadXmlHttpPanel. These are: AJAX, Client Callback and WebService. Each of them has strong or weak points, so which one should be used depends solely on the scenarios the RadXmlHttppanel is used in.

  • AJAX - It is the slowest of the three. This is happening because, when AJAX is used the controls affected are destroyed and recreated on the page, so the state of the controls is saved and posted back from the server, together with the content of the RadXmlHttpPanel. On the other hand the AJAX framework is flexible and universal. It can be used in many different scenarios.
  • Callback - When a client callback is used, only the RadXmlHttpPanel content is retrieved from the server, in contrast when using AJAX. The client state is not affected by the postback, so no need the state of the controls to be restored. Moreover, a handler for the OnServiceRequest event of the RadXmlHttpPanel should be specified to handle the data request which is not the case when using a WebService.
  • WebService - can be used to handle the data request of the RadXmlHttpPanel. The WebMethodPath and the WebMethodName properties should be set and the RadXmlHttpPanel automatically retrieves and loads the data. Similarly as in the Client Callback the client state is not affected.

The WebService and the Callback are maybe faster ways to load content, but their usage is specific and not as flexible as in the case when AJAX is used. 

To get familiar with the control please follow these online resources:

Telerik Admin
Top achievements
Rank 1
Iron
 asked on 17 Jun 2009
2 answers
113 views
I created a class that inherits from FileManagerDialogConfiguration (and ImageManagerDialogConfiguration), which loads the correct configuration for my website (I have written a custom FileSystemBrowser, which takes some substantial configuration). This greatly reduces the amount of repeated code for loading FileExplorer and RadEditor. However, I can't set the RadEditor ImageManager (or FileManager.Configutation) property because it is Read Only. Is there a reason it is read only? Is there any work around for this?
dlamprey
Top achievements
Rank 2
 answered on 17 Jun 2009
0 answers
431 views
Telerik RadCaptcha is UI control that provides two major strategies for protection against automated form submissions:
  • Image With Modified Symbols (Captcha Image) - They are displayed in a form, and the user is required to input the symbols in a textbox. The Image is generated with an HttpHandler.
  • Automatic Robots Discovery - this strategy uses predefined rules which decide whether the input comes from a robot or not. At this point, there are two implemented rules that could be applied either separately or simultaneously.
    • Minimum form submission time - the presumption is that a human cannot input the fields in a form correctly for a time less than 3 seconds (this is set by default, and could be modified). If the submission is executed faster than the predefined value, it is assumed that the executor is a robot.
    • Hidden textbox in the form (the so-called "honeypot") - this rule requires the insertion of a textbox which is not visible when the form is styled. Still, it will be detected by a robot, and therefore if any data is entered, the executor is considered to be a robot.

Key features:
  • Three Modes for Protection - you can easily define which spam protection strategies to be used for spam protection. For maximum security, by default, all of them are used.
  • Set Custom Error Message - the error message that is displayed when the condition being validated fails. Depending on which protection strategy is used, the respective error message is displayed.
  • Background and Line Noise Level of the Captcha Image - you can easily control the background and the line noise of the Image by setting the respective value (None, Low, Medium, High or Extreme). The default level of the background noise is Low and of the line noise is None.
  • Font Family and Font Warp of the Catcha Image - you can easily choose which font family to be used for the Image text. Arial is used as a default value for the font family. Furthermore, the amount of random font warping to apply to the rendered text can be changed by setting the CaptchaFontWarp property. The default amount of font warping is Low.
  • Text Length and Possible Characters of the Catcha Image - the default length of the text is 5 characters, and the characters could be either letters or either numeric characters. Alternatively, you can choose what kind of characters to be used (only letters or only numeric characters), and change the length of the text.
  • Maximum time interval of the Captcha Image - the maximum number of minutes the Captcha Image will be cached and valid.
  • Minimum Timeout - minimum number of seconds the form must be displayed before it is valid. If you're too fast, you must be a robot. This is set when “Minimum form submission time” mode is used for Spam Protection.

To get familiar with the control please follow these online resources:

Telerik Admin
Top achievements
Rank 1
Iron
 asked on 17 Jun 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?