Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
139 views
Hi,

I have empty combobox with template created on server side. 
I need add item with javascript on client-side, but I need use template items (checkbox)
If I add new item, I have only clasic combobox item.

class CheckBoxTemplate : ITemplate
{
    string ColName = "cboCol1";
    const string head = "<div onclick=\"StopPropagation(event)\">";
    const string tail = "</div>";
 
    public void InstantiateIn(Control container)
    {
        CheckBox chkControl = new CheckBox();
        chkControl.ID = "chkControl";
        chkControl.CssClass = "";
        chkControl.Attributes.Add("onclick", "onCheckBoxClick('" + _controlClientId + "')");
        chkControl.DataBinding += new EventHandler(this.chkControl_DataBind);
        container.Controls.Add(new LiteralControl(head));
        container.Controls.Add(chkControl);
        container.Controls.Add(new LiteralControl(tail));
    }
 
    public void chkControl_DataBind(Object sender, EventArgs e)
    {
        CheckBox chkControl = (CheckBox)sender;
        RadComboBoxItem radComboItem = (RadComboBoxItem)chkControl.NamingContainer;
        chkControl.Text = " " + DataBinder.Eval(radComboItem.DataItem, ColName).ToString();
    }
}

Javascript add items
var xmlDoc = xmlDoc.firstChild;
if (xmlDoc.childNodes.length > 0) {
    var combo = $find(comboid);
    combo.trackChanges();

    for (x = 0; x < xmlDoc.childNodes.length; x++) {
        try {
            sCboID = xmlDoc.childNodes[x].childNodes[0].childNodes[0].nodeValue;
            sCboText = xmlDoc.childNodes[x].childNodes[1].childNodes[0].nodeValue;               
            var comboItem = new Telerik.Web.UI.RadComboBoxItem();
            comboItem.set_text(sCboText);
            comboItem.set_value(sCboID);
            combo.get_items().add(comboItem);
        }
        catch (err) { }
    }
    combo.commitChanges();
}

Thanks for help.
Best regards
Roman
Roman Krsko
Top achievements
Rank 1
 answered on 10 Dec 2010
1 answer
171 views

I received an incomplete project utilising Telerik controls after a coworker left our company.
After installing the latest version of Telerik, I loaded the project and encountered a few initial errors with controls not rendering.
The project previously made use of Telerik:RadScriptManager which I had to change to the asp:ScriptManager in order to get the project to render and compile. I had it working until yesterday when Visual Studio '08 was no longer able to supply File, Line, Column, or Project Information on code errors. Additionally, ASP.NET error pages (YPODs) are also unable to supply data on errors - only supplying the following:

Server Error in '/MyProject' Application.


Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'hfChangePWError' does not exist in the current context

Source Error:

 

[No relevant source lines]


Source File:    Line: 0

Show Detailed Compiler Output:

 

c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE> "C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe" /t:library /utf8output /R:"C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\App_Web_ayecinuc.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\assembly\dl3\fe2998c9\008db4e2_e221cb01\Telerik.Web.Design.DLL" /R:"C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\assembly\dl3\79065178\009b1d22_837fcb01\Telerik.Web.UI.DLL" /R:"C:\Windows\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.DirectoryServices.AccountManagement\3.5.0.0__b77a5c561934e089\System.DirectoryServices.AccountManagement.dll" /R:"C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.DirectoryServices\2.0.0.0__b03f5f7f11d50a3a\System.DirectoryServices.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\App_Code.jelbpzvr.dll" /R:"C:\Windows\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /out:"C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\App_Web_default.aspx.cdcab7d2.xdzlie0w.dll" /D:DEBUG /debug+ /optimize- /win32res:"C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\aenyhhjc.res" /w:4 /nowarn:1659;1699;1701 /warnaserror-  "C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\App_Web_default.aspx.cdcab7d2.xdzlie0w.0.cs" "C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\App_Web_default.aspx.cdcab7d2.xdzlie0w.1.cs" "C:\Users\DevUser.Domain\AppData\Local\Temp\Temporary ASP.NET Files\MyProject\e358ee4f\f7483ef9\App_Web_default.aspx.cdcab7d2.xdzlie0w.2.cs"
 
 
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
 
c:\(Work Files)\Source\MYPROJECT\Default.aspx(25,55): error CS0103: The name 'hfChangePWError' does not exist in the current context

_________________________________________________________________________________________________________________________

Here are the asp.net directives and assembly references from Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ MasterType virtualpath="~/MasterPage.master" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body style="background-image:url('Images/StartPageBackground.png'); background-repeat: no-repeat">
    <form id="form1" runat="server">    
    <asp:ScriptManager ID="RadScriptManager1" runat="server" >
        <Scripts>       
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </asp:ScriptManager>
_________________________________________________________________________________________________________________________

Any help you can offer on this issue would be greatly appreciated, as I'm still fairly new to the usage and nuances of Telerik controls.

Thank you.


Erjan Gavalji
Telerik team
 answered on 10 Dec 2010
3 answers
121 views
I have created a simple bar chart... which is bound to an array... size of array is unknown... is it possible for me to make a chart which have same bar widths even there are 2 record or more... current bars become thicker when there are less records.... 

second thing is when I have lets' say 1000 bars in chart the PlotArea is too small for these number of bars... it creates a mess with scale and bars... i need a chart that have same same bar width for any number of charts and dynamic PlotArea...

please help
Evgenia
Telerik team
 answered on 10 Dec 2010
3 answers
172 views
Hi,
I'm using the rad rotator for displaying the latest 10 images by using their names from database, where the images are in a folder.
the code for above procedure is below

<telerik:RadRotator ID="RadRotator1" runat="server" Height="120px" Width="680px"  ScrollDuration="500" ScrollDirection="Right" FrameDuration="1500" ItemWidth="120px" ItemHeight="100px" RotatorType="AutomaticAdvance" DataSourceID="SqlDataSource1" OnInit="RadRotator1_Init">
 <ItemTemplate>
   <asp:Image ID="image1" runat="server" CssClass="image" ImageAlign="left" Visible="true" ImageUrl='<%# String.Format("~/upload data/movies/{0}", DataBinder.Eval(Container.DataItem, "imagename")) %>' />
 </ItemTemplate>
</telerik:RadRotator>
 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cinema mistakesConnectionString %>"
     SelectCommand="SELECT TOP 10 [imagename] FROM [movie] ORDER BY [mid] DESC"></asp:SqlDataSource>


when a client clicks on the rotator item (image) it is redirecting to the new page, code for this is below

protected void RadRotator1_Init(object sender, EventArgs e)
    {
        RadRotator1.ItemClick += new RadRotatorEventHandler(RadRotator1_ItemClick);
    }
 
    void RadRotator1_ItemClick(object sender, RadRotatorEventArgs e)
    {
         
        Response.Redirect(string.Format("~/admin/postmistake.aspx",e.Item.Index));
    }

  now, in redirected page i wrote sentence as 
string s = Context.Request.QueryString["id"];

how can i get the name of image(clicked item) by using the above rotating item index
Shinu
Top achievements
Rank 2
 answered on 10 Dec 2010
3 answers
160 views
Hi, I have  RadMaskedTextBox defined as:

<

 

 

telerik:RadMaskedTextBox ID="MaskedTextBox_PPC_CODE" runat="server" CatalogIconImageUrl=""

 

 

 

Description="" DisplayPromptChar="_" Mask="##-######.####" PromptChar="_"

 

 

 

Title="" Text="76-.0000"

 

 

 

TitleIconImageUrl="" TitleUrl=""></telerik:RadMaskedTextBox>

it's telerik 2010 Q2, how to make the the textbox's text like '76-______.0000',
not '76-0000__.____'.   thanks.

 

Hus Damen
Top achievements
Rank 1
 answered on 10 Dec 2010
5 answers
134 views
We have a grid that uses a series of numeric columns. For consistency, the developer was attempting to use a GridNumericColumnEditor; this works properly when it's applied to a single column, but when it's applied to more than one column the page throws a ArgumentOutOfRangeException when attempting to edit.

The column editor is defined as;

   
<telerik:GridNumericColumnEditor ID="customNumeric" runat="server"><br>
        <NumericTextBox Width="70" /><br>
    </telerik:GridNumericColumnEditor>


...and the Grid columns are defined as;

                            <
telerik:GridNumericColumn DataField="Area1" DataType="System.Decimal" HeaderText="Area1"<br>
                                SortExpression="Area1" UniqueName="Area1" NumericType="Currency" DataFormatString="{0:c2}"<br>
                                Aggregate="Sum" ColumnEditorID="customNumeric"><br>
                            </telerik:GridNumericColumn><br>
                            <telerik:GridNumericColumn DataField="Area2" DataType="System.Decimal" HeaderText="Area2"<br>
                                SortExpression="Area2" UniqueName="Area2" NumericType="Currency" DataFormatString="{0:c2}"<br>
                                Aggregate="Sum" ColumnEditorID="customNumeric"><br>
                            </telerik:GridNumericColumn>


If we have the ColumnEditorID set in only one column (any column) it works, but when it's added to the second or subsequent column it throws the error. Is there something we're missing?
Veli
Telerik team
 answered on 10 Dec 2010
1 answer
64 views
Dear All,

Chart Looks fine when it is drawn, but when I zoom on it bars are shifted ahead... please see the picture attached to realize the problem

Velin
Telerik team
 answered on 10 Dec 2010
1 answer
94 views
I'd love this control (or another similar one) to be able to return JSON, and have it populate based on a template defined in the control markup...

Like the MS jQuery templating...except I still want all the events and bits that go along with this control.
Pero
Telerik team
 answered on 10 Dec 2010
3 answers
90 views
Hello,

I have a RadDatePicker with the attribute dir="rtl".
This attribute causes to the navigations text button to be inverted (see the attached jpg).
The tooltip is ok.

The code is:

<telerik:RadDatePicker ID="RadDatePicker1" runat="server" dir="rtl">
</telerik:RadDatePicker>

My goal is to set the popup button on the left side to the input date.

Thank you,
Oren
Iana Tsolova
Telerik team
 answered on 10 Dec 2010
1 answer
80 views
Hi. I am just starting to try to use the grid control. What I am trying to do encompasses several different things and any help would be appreciated. Once I've done it once I will then know how to do it all in the future. Thanks

The page that I have needs a single grid that is actually derived from 3 fairly simple tables:

Table 1
RsId - unique primary key auto generated in the database
RType - int (will always be 0 for this page)
Description - varchar

Table 2
Cid- unique primary key auto generated in the database
RsId - linked to Table1:RsId  (actually is a 1:1 relationship but database assumes 1 to many)
CType - int
CMax - int

Table 3
LRid - unique primary key auto generated in the database
RsId - linked to table1:RsId
LType - char()
LText - nchar()

There are reasons why table 1 and table 2 are not merged into a single table. Questions:
1. What is the easiest way to build a hierarchical grid with two levels of hierarchy: first effectively representing a join of table1 and table2 (since they effectively have a 1:1 relationship) and the detailsview having related Table 3 records
2. When I "Add new record" I want to create a table1 record so I can have an insert query in my sqldatasource. If I don't have RType in my grid how do I define the sql command such that RType is always set to int 0.
3. When I "Add new record" in the master view is there an event that I can use to create the table2 record that will match the new table1 record or create the new records in both tables.
4. In table2 CType has a set of predefined potential values. How do I define CType as a drop down where the grid control's definition contains the int value (that will be the value stored in the database) and the text to display in the drop down?

Thanks

Update:
Finding my way on [1] but several things are far from obvious. It's not clear what the best way is to create the hierarchical structure but I have managed to do it (maybe not the best way - who knows). However, I have had to create 2 sqldatasources (one for the masterview and one for the details). I couldn't see an automatic way to get the wizard to create the second datasource so I created it manually and then edited the code for the grid control to define the data source under

<

 

DetailTables>

 

 

<telerik:GridTableView runat="server" AllowAutomaticDeletes="True" DataSourceID="SqlDataSource2" Width="100%" AllowFilteringByColumn="False"

 

 

AutoGenerateColumns="True" CommandItemDisplay="Top">

 

However, I have had to specify autogeneratecolumns because its not obvious to me at the moment how I define the columns for the details view using the object property builder for the grid. This is a problem because I don't want all of the columns to be visible. How do you create and define the details view?

Found how to do [2]
I think I can do [3] but haven't implemented it yet
Looking for solution to [4]
Trying to work out how to define the Insert query for the details view (ie for Table3)
Iana Tsolova
Telerik team
 answered on 10 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?