Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
273 views
Hi

I am trying to display a column of checkboxes in Telerik RadGrid in my project.
The data source of my grid is a list of objects.
How to do this  programatically ?

p.s.
an answer in any programming language will be appreciated 

my code:

    
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
      setColumnsOnGrid(Of object)(lst, RadGrid1, ArrayNameFilds:={"column1", "column2", "column3 ", "etc."})
    End If
End Sub
 
Private Sub setColumnsOnGrid(Of T)(ByVal lst As List(Of T), ByVal grdName As RadGrid, ByVal ArrayNameFilds As Array)
    Dim nameFiled As String
    grdName.DataSource = lst
    grdName.AllowMultiRowSelection = True
    grdName.MasterTableView.AutoGenerateColumns = False
 
    Dim boundColumn As GridBoundColumn
 
    For i As Integer = 0 To ArrayNameFilds.Length - 1
        nameFiled = ArrayNameFilds(i).ToString()
        boundColumn = New GridBoundColumn()
        grdName.MasterTableView.Columns.Add(boundColumn)
        boundColumn.DataField = nameFiled
        boundColumn.HeaderText = nameFiled
     Next
End Sub


my aspx:

<telerik:RadGrid ID="grd_test" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" GridLines="None">
    <ClientSettings>
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
</telerik:RadGrid>
Viktor Tachev
Telerik team
 answered on 15 Apr 2014
1 answer
265 views
Hello,

I've been searching for a while now, but I cant find out how I can make a RadNotification part of the RadAjaxPanel. In my scenario, the notification is shown, but when I click a button in the contentTemplate of the RadNotification, a full postback is created in stead of the partial one with the loadingPanel.

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel_App" runat="server"></telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RadAjaxPanel_App" LoadingPanelID="RadAjaxLoadingPanel_App" runat="server">
    <telerik:RadNotification ID="RadNotification_ExitWithoutSave" Position="Center" Width="350px" Height="160px" LoadContentOn="FirstShow" AutoCloseDelay="0" Title="Please Confirm" TitleIcon="~/style/img/help2_16.png" EnableRoundedCorners="true" Animation="Fade" ShowCloseButton="False" Overlay="True" Opacity="95" KeepOnMouseOver="False" runat="server" RenderMode="Auto">
        <ContentTemplate>
            <telerik:RadButton ID="rbt_Yes" Text="Yes" CommandName="Yes" ButtonType="StandardButton" width="100px" Font-Bold="true" Icon-PrimaryIconCssClass="rbOk" Icon-PrimaryIconTop="6px" runat="server" RenderMode="Auto" />
        </ContentTemplate>
    </telerik:RadNotification>
 
......


Any ideas on this?

Kind regards,

Erik
Misho
Telerik team
 answered on 15 Apr 2014
1 answer
179 views
i want use htmlchart in my asp.net project i use VS 2012 and i wrote below code
but DataFieldX and DataFieldY not support in my page and when i open page i see Parser Error


<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
</telerik:RadStyleSheetManager>

<TooltipsAppearance BackgroundColor="White" DataFormatString="{1}% in {0} minutes"></TooltipsAppearance>
<LabelsAppearance Visible="false">
</LabelsAppearance>
</telerik:ScatterLineSeries>
<telerik:ScatterLineSeries Name="1.6C" DataFieldX="ChargeTime16C" DataFieldY="ChargeCurrent16C">
<TooltipsAppearance BackgroundColor="White" DataFormatString="{1}% in {0} minutes"></TooltipsAppearance>
<LabelsAppearance Visible="false">
</LabelsAppearance>
</telerik:ScatterLineSeries>
<telerik:ScatterLineSeries Name="3.1C" DataFieldX="ChargeTime31C" DataFieldY="ChargeCurrent31C">
<TooltipsAppearance BackgroundColor="White" DataFormatString="{1}% in {0} minutes"></TooltipsAppearance>
<LabelsAppearance Visible="false">
</LabelsAppearance>
</telerik:ScatterLineSeries>
</Series>
<XAxis>
<LabelsAppearance DataFormatString="{0}m" />
<TitleAppearance Text="Time" />
</XAxis>
<YAxis MaxValue="100">
<LabelsAppearance DataFormatString="{0}%" />
<TitleAppearance Text="Charge" />
</YAxis>
</PlotArea>
<ChartTitle Text="Charge current vs. charge time">
</ChartTitle>
</telerik:RadHtmlChart>
</div>





Danail Vasilev
Telerik team
 answered on 15 Apr 2014
2 answers
215 views
Hi Telerik team,

I am a newbie programmer and have been using Telerik since a couple of months now.

I am trying to implement the follwing process:

1. User uploads an Image on RadImageEditor using AsyncUpload
2. User crops the image
3. User clicks on CreateProfile button on the page.
4. The cropped image should be stored in the database.

Problem: The uncropped version of the image gets stored. I think I am doing something wrong. Would be great if you could help

Code:

.aspx

<telerik:RadImageEditor  ID="ImageEditor_CreateNewUser"   CanvasMode="No" runat="server" Height="500px" Width="700px"     OnImageLoading="ImageEditor_CreateDonor_ImageLoading" OnClientCommandExecuting="OnClientCommandExecuting">
</telerik:RadImageEditor>

<asp:Button ID="BtnDonorSave" Text="Create Donor" ValidationGroup="CreateDonorSubmit" runat="server" OnClick="BtnDonorSave_Click" />

  .aspx.cs - 

        protected void ImageEditor_CreateNewUser_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
        {
            if (!Object.Equals(Context.Cache.Get(Session.SessionID + "UploadedFile"), null))
           {
                using (EditableImage image = new EditableImage((MemoryStream)Context.Cache.Get(Session.SessionID + "UploadedFile")))
                {
                    args.Image = image.Clone();
                    args.Cancel = true;
                }
           }
        }
 protected void BtnDonorSave_Click(object sender, EventArgs e)
        {
             EditableImage ei = ImageEditor_CreateDonor.GetEditableImage();
            MemoryStream s = new MemoryStream();
            ei.Image.Save(s, ei.RawFormat);
            byte[] imgData = s.ToArray();

            db.CreateUser(userId, imgData);

}
















Vessy
Telerik team
 answered on 15 Apr 2014
3 answers
198 views
where can I download the latest version of italian resx file?

Thanks!
Vessy
Telerik team
 answered on 15 Apr 2014
6 answers
306 views

Hi there,

I check the display-property of the columns of a RadGrid on PreRender, but it isn't actual.

If I Hide/Show another Column or sort a column, the PreRender Function gives the correct display-property.

Here my code:

<%

 

@

Page

Language

="VB"

AutoEventWireup

="false"

CodeBehind

="Default.aspx.vb"

Inherits

="TelerikWebAppHideUnhideColBug._Default"

%>

 

<%

 

 

@

Register

Assembly

="Telerik.Web.UI"

Namespace

="Telerik.Web.UI"

TagPrefix

="telerik"

%>

 

 

<!

 

 

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

id

="Head1"

runat

="server">

 

 

 

 

<

title

></

title

>

 

</

 

 

 

head

>

 

<

 

 

 

body

>

 

 

 

 

<

form

id

="form1"

runat

="server">

 

 

 

 

<

script

type

="text/javascript">

 

 

 

 

function

RadGridCSC_ColumnHidden(sender, args) {

 

$find(

 

 

"<%= RadAjaxManager1.ClientID %>"

).ajaxRequest(

"ColumnHidden"

);

 

}

 

 

 

function

RadGridCSC_ColumnShown(sender, args) {

 

$find(

 

 

"<%= RadAjaxManager1.ClientID %>"

).ajaxRequest(

"ColumnShown"

);

 

}

 

 

 

function

RadGridCSC_ColumnRezised(sender, args) {

 

$find(

 

 

"<%= RadAjaxManager1.ClientID %>"

).ajaxRequest(

"ColumnRezised"

);

 

}

 

 

 

</

script

>

 

 

 

 

<

telerik

:

RadAjaxManager

ID

="RadAjaxManager1"

runat

="server">

 

 

 

 

</

telerik

:

RadAjaxManager

>

 

 

 

 

 

<

telerik

:

RadScriptManager

ID

="RadScriptManager1"

runat

="server"></

telerik

:

RadScriptManager

>

 

 

 

 

 

<

div

>

 

 

 

 

<

telerik

:

RadGrid

ID

="RadGrid1"

runat

="server"

AllowFilteringByColumn

="True"

 

 

 

 

AllowPaging

="True"

PageSize

="50"

Width

="100%"

Height

="650"

AllowSorting

="True"

CellSpacing

="0"

 

 

 

 

EnableHeaderContextMenu

="true"

EnableHeaderContextFilterMenu

="true">

 

 

 

 

 

<

GroupingSettings

CaseSensitive

="false"></

GroupingSettings

>

 

 

 

 

<

MasterTableView

AutoGenerateColumns

="false"

AllowFilteringByColumn

="True"

CommandItemDisplay

="Top"

width

="100%"

ClientDataKeyNames

="ProductID">

 

 

 

 

<

PagerStyle

AlwaysVisible

="true"

Mode

="NextPrevAndNumeric"

/>

 

 

 

 

<

Columns

>

 

 

 

 

<

telerik

:

GridBoundColumn

DataField

="ProductID"

Visible

="true"

FilterControlWidth

="60%"

HeaderStyle-Width

="80"

ItemStyle-Width

="60"

HeaderText

="ProductID"

UniqueName

="Version2"

ColumnGroupName

="SoftwareInformation"

ItemStyle-HorizontalAlign

="Left"

HeaderStyle-HorizontalAlign

="Left"

/>

 

 

 

 

<

telerik

:

GridBoundColumn

DataField

="ProductName"

Visible

="true"

FilterControlWidth

="80%"

HeaderStyle-Width

="200"

ItemStyle-Width

="200"

HeaderText

="Product Name"

UniqueName

="ProductName"

ColumnGroupName

="SoftwareInformation"

ItemStyle-HorizontalAlign

="Left"

HeaderStyle-HorizontalAlign

="Left"

/>

 

 

 

 

<

telerik

:

GridBoundColumn

DataField

="UnitPrice"

 

 

 

 

Visible

="true"

DataType

="System.String"

FilterListOptions

="VaryByDataType"

 

 

 

 

FilterControlWidth

="80%"

HeaderStyle-Width

="270"

ItemStyle-Width

="270"

 

 

 

 

HeaderText

="UnitPrice"

 

 

 

 

UniqueName

="UnitPrice"

ColumnGroupName

="SoftwareInformation"

 

 

 

 

ItemStyle-HorizontalAlign

="Left"

HeaderStyle-HorizontalAlign

="Left"/>

 

 

 

 

<

telerik

:

GridBoundColumn

DataField

="ReorderLevel"

Visible

="true"

FilterControlWidth

="60%"

HeaderStyle-Width

="80"

ItemStyle-Width

="60"

HeaderText

="ReorderLevel"

UniqueName

="ReorderLevel"

ColumnGroupName

="SoftwareInformation"

ItemStyle-HorizontalAlign

="Left"

HeaderStyle-HorizontalAlign

="Left"

/>

 

 

 

 

<

telerik

:

GridBoundColumn

DataField

="Discontinued"

Visible

="true"

FilterControlWidth

="80%"

HeaderStyle-Width

="200"

ItemStyle-Width

="200"

HeaderText

="Discontinued"

UniqueName

="Discontinued"

ColumnGroupName

="SoftwareInformation"

ItemStyle-HorizontalAlign

="Left"

HeaderStyle-HorizontalAlign

="Left"

/>

 

 

 

 

</

Columns

>

 

 

 

 

</

MasterTableView

>

 

 

 

 

 

<

ClientSettings

AllowColumnsReorder

="true"

ReorderColumnsOnClient

="false">

 

 

 

 

<

DataBinding

Location

="http://demos.kendoui.com/service/Northwind.svc"

ResponseType

="JSONP">

 

 

 

 

<

DataService

TableName

="Products"

Type

="OData"

/>

 

 

 

 

</

DataBinding

>

 

 

 

 

<

Scrolling

 

 

 

 

AllowScroll

="true"

 

 

 

 

UseStaticHeaders

="true"

 

 

 

 

ScrollHeight

="300px"

/>

 

 

 

 

<

ClientEvents

OnColumnShowing

="RadGridCSC_ColumnShown"

OnColumnHidden

="RadGridCSC_ColumnHidden"

/>

 

 

 

 

</

ClientSettings

>

 

 

 

 

</

telerik

:

RadGrid

>

 

 

 

 

</

div

>

 

 

 

 

</

form

>

 

</

 

 

 

body

>

 

</​

 

 

 

html

>

 

​



Imports

 

 

Telerik.Web.UI

 

 

Partial

 

 

Class

_Default

 

 

 

 

Inherits

System.Web.UI.

Page

 

 

 

 

Private

Sub

RadGrid1_PreRender(sender

As

Object

, e

As

System.

EventArgs

)

Handles

RadGrid1.PreRender

 

 

 

 

Dim

col

As

Telerik.Web.UI.

GridBoundColumn

 

 

col = RadGrid1.Columns.FindByUniqueName(

 

"Version2"

)

 

 

 

 

Debug

.Print(col.UniqueName +

":"

+ col.di.Display.ToString)

 

 

 

 

End

Sub

 

End

 

 

 

Class​

 

 

 

​​​​​​​
If I toogle the hide/show a column the Output are:

Version2:True

Version2:False

Version2:False

Version2:False

Version2:False

Version2:False


How can I get the actual display of a Column?

Thanks
Thomas
Viktor Tachev
Telerik team
 answered on 15 Apr 2014
5 answers
487 views
Good morning! I am facing a problem when I resize the RadDock I trigger, and then try to change page it appears the following error:

Erro em tempo de execução do JavaScript: Sys.WebForms.PageRequestManagerServerErrorException: The numeric part ('184,28570556640625') of '184,28570556640625' cannot be parsed as a numeric part of a Pixel unit.

Which form to be able to resolve this problem? I'm using the language of the browser in Portuguese, it brings this error when I use English and it does not show any errors.

I await response Thanks!
Slav
Telerik team
 answered on 15 Apr 2014
1 answer
114 views
I installed the .NET Telerik controls (AJAX) and the extensions for VS 2013 and I want to generate a web application targeting .NET 4.

If I target .NET 4.5.1, then the tools appear in the toolbox but if I target .NET 4 then they do not.

It seems the controls can still be used in older .NET versions as I can paste code for the controls into my .apsx files in my .NET 4 project and they seem to work OK.

I need the latest version of the controls and VS as I need to target both touch and mouse devices as well as some older browsers.  Can I safely do this?  What are the implications?
Yana
Telerik team
 answered on 15 Apr 2014
2 answers
97 views
It appears that there may be a date format issue related to the RadScheduler and the ODataDataSource.  While it works with an OData Version 2 date, it fails if the ODataDataSource is pointed to an OData Version 3 web service.  I receive the following javascript error related to date parsing:

     Error: Unable to get property 'length' of undefined or null reference

Our OData Service returns "2014-03-14T23:00:00" with version 3 while the older version returns dates like /Date(1394838000000)/

Can you confirm that this is a bug on your end?  We are using the 2014 Q1 update which allowed us to upgrade our OData service to Version 3.
Hristo Valyavicharski
Telerik team
 answered on 15 Apr 2014
3 answers
209 views
I have 3 dropdowncolumns in this radGrid.
The first one "Pnum" is working well, I can select the value and save it, and the saved value is visible in the grid when not in edit mode. If I open the record in edit mode the dropdown stays on the selected value unless I select a new value.
The other two dropdowncolumns are giving me problems. The selected value is saved to the db but is not visible when the grid is not in edit mode and if I open the record in edit mode after having saved it,  the dropdown value is on the default value.

How can I have the two dropdowncolumns "minutes" and "hours" acting like the "Pnum" column? Why they are acting in a different way?

I mean after selecting the value and update the record have the value shown in the grid. 

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" Culture="it-IT" DataSourceID="SqlDataSource1" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True" Skin="Outlook" CellSpacing="-1" GridLines="Both">
                       <ExportSettings>
                           <Pdf PageWidth="">
                           </Pdf>
                       </ExportSettings>
                       <ClientSettings>
                           <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                       </ClientSettings>
                       <MasterTableView DataKeyNames="Id" DataSourceID="SqlDataSource1" CommandItemDisplay="Top">
                           <Columns>
                               <telerik:GridEditCommandColumn ButtonType="ImageButton">
                                   <HeaderStyle Width="35px" />
                               </telerik:GridEditCommandColumn>
                               <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" FilterControlAltText="Filter Id column" HeaderText="Id" ReadOnly="True" SortExpression="Id" UniqueName="Id">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="60px" />
                               </telerik:GridBoundColumn>
                               <telerik:GridDateTimeColumn DataField="Date" DataType="System.DateTime" FilterControlAltText="Filter Date column" HeaderText="Date" SortExpression="Date" UniqueName="Date" DataFormatString="{0:dd/MM/yyyy}">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="80px" />
                               </telerik:GridDateTimeColumn>
                               <telerik:GridDropDownColumn DataField="Pnum" DataSourceID="SqlDataSource2" ListTextField="Pnum" ListValueField="Pnum"  FilterControlAltText="Filter column column" UniqueName="column" HeaderText="P-Number">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="80px" />
                               </telerik:GridDropDownColumn>
 
                               <telerik:GridBoundColumn DataField="WorkedTime" DataType="System.TimeSpan" FilterControlAltText="Filter WorkedTime column" HeaderText="Worked Time" SortExpression="WorkedTime" UniqueName="WorkedTime">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="90px" />
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="Week" FilterControlAltText="Filter Week column" HeaderText="Week" SortExpression="Week" UniqueName="Week">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="60px" />
                               </telerik:GridBoundColumn>
 
 
                               <telerik:GridDropDownColumn DataField="minutes" DataSourceID="SqlDataSource3" ListTextField="minutes" ListValueField="minutes"  FilterControlAltText="Filter minutes column" UniqueName="minutes" HeaderText="Minutes" DataType="System.Int16">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="80px" />
                               </telerik:GridDropDownColumn>
                               <telerik:GridDropDownColumn DataField="hours" DataSourceID="SqlDataSource4" ListTextField="hours" ListValueField="hours"  FilterControlAltText="Filter hours column" UniqueName="hours" HeaderText="Hours" DataType="System.Int16">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="80px" />
                               </telerik:GridDropDownColumn>
                               <telerik:GridBoundColumn  DataField="Note" FilterControlAltText="Filter Note column" HeaderText="Note" SortExpression="Note" UniqueName="Note">
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                               </telerik:GridBoundColumn>
                               <telerik:GridButtonColumn ButtonType="ImageButton" Text="Delete" CommandName="Delete" FilterControlAltText="Filter column1 column" ConfirmDialogType="RadWindow" ConfirmText="Do you really want to delete this project and all its content?" UniqueName="column1">
                                   <HeaderStyle Width="30px" />
                               </telerik:GridButtonColumn>
                           </Columns>
                           <EditFormSettings>
                               <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                           </EditFormSettings>
                       </MasterTableView>
                   </telerik:RadGrid>
Kostadin
Telerik team
 answered on 15 Apr 2014
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?