Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
222 views
We are facing an issue in radgrid batch editing for cell, if you try to enter a 4 digit value for decimal, it adds a comma in the value and gives the following error upon saving changes:

System.Exception: 1,200.00 is not a valid value for Decimal. ---> System.FormatException: Input string was not in a correct format.

Also tested it on rad grid demo site and same issue is there as well:

http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultvb.aspx

Please try entering a 4 digit value for column 'UnitPrice', after entering the value it will add a comma and show error on save changes, however the error is different.

Thanks
Angel Petrov
Telerik team
 answered on 21 May 2014
2 answers
103 views
I have a piechart, binding data from a storedprocedure. I am getting 2 columns  one is Age and BusinessTotal. Based on Age column data, Color should be showed. Please let me know how to accomplish this.

<telerik:RadHtmlChart runat="server" ID="RadHtmlChart3" Width="300" Height="300" Transitions="true">
                    <Appearance>
                         <FillStyle BackgroundColor="White"></FillStyle>
                    </Appearance>                  
                    <Legend>
                         <Appearance BackgroundColor="White" Position="Right" Visible="false">
                         </Appearance>
                    </Legend>
                    <PlotArea>
                         <Appearance>
                              <FillStyle BackgroundColor="White"></FillStyle>
                         </Appearance>
                         <Series>
                              <telerik:PieSeries DataFieldY="BusinessTotal"  StartAngle="90" >
                                   <LabelsAppearance Visible="false" Position="InsideEnd" DataFormatString="{0:N0}">
                                   </LabelsAppearance>
                                   <TooltipsAppearance Color="White"  DataFormatString="{0:N0}"></TooltipsAppearance>
                         


Databinding : C#
protected void GetBusinessData(string metricName)
        {
                SqlCommand cmdProc = new SqlCommand("[oss].[SelectSalespersonBusinessAge]", SqlConnection);
                cmdProc.CommandType = CommandType.StoredProcedure;
                cmdProc.Parameters.AddWithValue("@LoginName", loginName);
                cmdProc.Parameters.AddWithValue("@MetricYear", metricYear);
                cmdProc.Parameters.AddWithValue("@MetricMonth", metricMonth);

                SqlDataAdapter adp = new SqlDataAdapter();
                adp.SelectCommand = cmdProc;
                adp.Fill(dt);
                RadHtmlChart3.DataSource = dt;
                RadHtmlChart3.DataBind();
                if (dt.Rows[0]["age"].ToString() == "7-12 Months")
                {
                  //Yellow color should be assigned for this part
                  
                }
                if (dt.Rows[1]["age"].ToString() == "12+ Months")
                {
                   //REd for this
                }              
}
              




Neetha
Top achievements
Rank 1
 answered on 21 May 2014
5 answers
279 views
Here is my scenario:

I have a RadGrid with RADAjaxManager rights to update itself. In markup, I have some GridTemplateColumns that contain custom buttons. The rest of the columns get populated via AutoGenerateColumns="true" from the NeedsDataSource event of the grid.

I am using the ItemDataBound event of the grid to setup each GridDataItem, setting some buttons' enabled property and some images based on the grid's data. This is working great to load the grid, and it persists after sorting, paging, and filtering.

The problem that I'm running into is when I click one of the custom buttons, it will properly run through the ItemCommand event of the grid, but then the buttons' enabled state and the images that I set are wiped away. Since my code to set these things up is in the grid's ItemDataBound event and that does not fire after the ItemCommand is fired, I'd like to know what event should I be using to set enabled/image URL type properties of the grid cells?

Thanks!

-Scott
Scott
Top achievements
Rank 1
 answered on 21 May 2014
2 answers
282 views
I have a RadDropDownTree control on a page, I can successfully bind data to it [and read back the selected node's value], and I can successfully set the value BACK on loading a form.  However, when I programmatically set the selected node, it doesn't show up on the page.  I have to manually expand the DropDownTree and select the already selected item.

How can I have the DropDownTree ACTUALLY select the node programmatically?

I'm using Telerik ASP.NET AJAX v2014.1403.45
Mike
Top achievements
Rank 1
 answered on 21 May 2014
1 answer
327 views
Hi,
I have a simple Grid with a GridDropDownColumn using the default RadCombBox. On Eidt and Insert, I bind the Combo to an XML-based Dictionary inside ItemDataBound. Both functionalities are wroking fine and I can save updated records without problems. However, I keep getting above error every time I attempt to Insert, although the process is working, whether I Cancel or Insert, with the Combo being populated as expected. In other words, the error doesn't affect Insertion but it is annoying to keep showing! How can I eliminate it?


Grid markup:

<telerik:RadGrid ID="CoursesGrid" runat="server" Width="920px" AutoGenerateColumns="False" PageSize="20" AllowPaging="True" CssClass="AddBorders">
    <MasterTableView DataKeyNames="CourseID" EditMode="EditForms" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add New Course" InsertItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" EnableNoRecordsTemplate="true" ShowHeader="true">
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditBtn" ButtonType="ImageButton" HeaderStyle-Width="60px" Resizable="false" ItemStyle-HorizontalAlign="Center"></telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn UniqueName="CourseID" DataField="CourseID" HeaderText="Course ID" ColumnEditorID="CourseIDEditor" HeaderStyle-Width="70px" Resizable="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="CourseName" DataField="CourseName" HeaderText="Course Name" ColumnEditorID="CourseNameEditor" HeaderStyle-Width="380px" Resizable="false"></telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn UniqueName="FromDate" DataField="FromDate" HeaderText="From" DataFormatString="{0:dd/MM/yyyy}" HeaderStyle-Width="80px" Resizable="false" ItemStyle-HorizontalAlign="Center"></telerik:GridDateTimeColumn>
            <telerik:GridDateTimeColumn UniqueName="ToDate" DataField="ToDate" HeaderText="To" DataFormatString="{0:dd/MM/yyyy}" HeaderStyle-Width="80px" Resizable="false" ItemStyle-HorizontalAlign="Center"></telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn UniqueName="Venue" DataField="Venue" HeaderText="Venue" ColumnEditorID="VenueEditor" HeaderStyle-Width="80px" Resizable="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
            <telerik:GridDropDownColumn UniqueName="Category" HeaderText="Category" DataField="CatID" HeaderStyle-Width="160px" Resizable="false" ItemStyle-HorizontalAlign="Center"></telerik:GridDropDownColumn>
        </Columns>
        <NoRecordsTemplate>
            <div id="NoRecordWrapper">No Courses available!</div>
        </NoRecordsTemplate>
    </MasterTableView>
    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
    <ClientSettings EnableAlternatingItems="true">
    </ClientSettings>
</telerik:RadGrid>


ItemDataBound (VB):

Protected Sub CoursesDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles CoursesGrid.ItemDataBound
    Try
        '--------------------------------------------------------
        ' 1.  Display (Regular) Mode
        '--------------------------------------------------------
        If TypeOf e.Item Is GridDataItem Then
            ' 1.1 Get reference of current Item & its Data
            '----------------------------------------------------
            Dim courseRec As GridDataItem = CType(e.Item, GridDataItem)
            Dim courseInfo As DataRowView = CType(courseRec.DataItem, DataRowView)
 
            ' 1.2 Set style of Arabic content
            '----------------------------------------------------
            If Not IsDBNull(courseInfo("Locale")) Then
                courseRec("CourseName").CssClass = "arabicText"
                courseRec("CourseName").HorizontalAlign = HorizontalAlign.Right
 
                If Not IsDBNull(courseInfo("Venue")) Then
                    courseRec("Venue").CssClass = "arabicText"
                End If
            End If
 
            ' 1.3 Replace Subject ID with its Description
            '----------------------------------------------------
            Dim catID As String = courseInfo("CatID")
            Dim catDesc As String = CodeLibrary.CatList.Item(catID)
 
            courseRec("Category").Text = catDesc
        End If
 
        '--------------------------------------------------------
        ' 2. Edit/Insert Mode
        '--------------------------------------------------------
        If TypeOf e.Item Is GridEditableItem AndAlso CType(e.Item, GridEditableItem).IsInEditMode Then
            ' 2.1 Get reference of Edit Manager
            '----------------------------------------------------
            Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
            Dim editMan As GridEditManager = editedItem.EditManager
 
            ' 2.2 Handle 'Category' DropDownList
            '----------------------------------------------------
            '     2.2.1 Get reference of respective ColumnEditor
            '    ................................................
            Dim subjectEditor As GridDropDownListColumnEditor = CType(editMan.GetColumnEditor("Category"), GridDropDownListColumnEditor)
            Dim subjectsList As RadComboBox = subjectEditor.ComboBoxControl
 
            '     2.2.2 Populate
            '    ................................................
            subjectEditor.DataSource = CodeLibrary.CatList
            subjectEditor.DataTextField = "Value"
            subjectEditor.DataValueField = "Key"
 
            subjectEditor.DataBind()
 
            subjectsList.Items.Insert(0, New RadComboBoxItem("--- SELECT ---", "XX"))
 
            '     2.2.3 Set Selected Value
            '    ................................................
            subjectsList.SelectedValue = "XX"
 
            If Not e.Item.OwnerTableView.IsItemInserted Then
                subjectsList.SelectedValue = e.Item.DataItem("CatID")
            End If
 
            '     2.2.4 Set Width
            '    ................................................
            subjectsList.Width = Unit.Pixel(200)
 
            ' 2.3 Style 'Course Name' if Arabic
            '----------------------------------------------------
            Dim nameEditor As GridTextBoxColumnEditor = CType(editMan.GetColumnEditor("CourseName"), GridTextBoxColumnEditor)
            Dim textColumn As TextBox = nameEditor.TextBoxControl
 
            If Not IsDBNull(e.Item.DataItem("Locale")) Then
                textColumn.CssClass = "arabicText alignRight"
            End If
 
            ' 2.4 Disable 'CourseID' on Edit
            '----------------------------------------------------
            If Not TypeOf e.Item Is IGridInsertItem Then
                Dim idEditor As GridTextBoxColumnEditor = CType(editMan.GetColumnEditor("CourseID"), GridTextBoxColumnEditor)
                idEditor.TextBoxControl.Enabled = False
            End If
 
        End If
 
    Catch ex As Exception
        Dim errorMsg As String = String.Format("â–º CoursesDataBound: [{0}]", ex.Message)
        DisplayFeedback("page", Nothing, errorMsg)
    End Try
End Sub


I thought of handling each process separately, but I will end up with redundant code! 

Many thanks in advance.

Konstantin Dikov
Telerik team
 answered on 21 May 2014
6 answers
87 views
I have a page where I show the user 4 columns from an sql query, in a grid.
If they export , we have to include all 15 columns, which leads me to wonder if I could not just create all in the code behind, a new virtual instance of a radgrid, and populate it with my full sql query result set, and then use the exporttoexcel() method call without showing the user the second grid.

Is this possible? If so, what would be the limitations or tips to making sure this works seemless?

Thank you for you help in advance.
Leon
Top achievements
Rank 1
 answered on 21 May 2014
2 answers
95 views
Hello,

i've got a problem with a templatecolumn inside a radgrid.
The templatecolumn contains two RadButtons.
The problem is, that in Internetexplorer 10, the buttons of the templatecolumn are displayed outside of the radgrid.

To be more specific:
Scrolling is enabled,
5 rows are within the visible area,
the buttons within the templatecolumn are all rendered at once, so they appear below the radgrid.

I remember that I already stumbled upon something similar.
Last time it was a radbutton that was in the wrong place and then "jumped" back to where it belongs when I hovered over it.

Has anyone come across this issue?
Konstantin Dikov
Telerik team
 answered on 21 May 2014
1 answer
53 views
Hi.
May I know which all browser versions are supported by telerik controls?
Shinu
Top achievements
Rank 2
 answered on 21 May 2014
1 answer
75 views
I think if you delete or paste on a folder-by-folder basis, I would like to bring the size and file name of all that is subordinate to that folder. However, I do not know how. I would appreciate answers.
Vessy
Telerik team
 answered on 21 May 2014
4 answers
254 views
I implement Expand All and Collapse All buttons on my chart via the chart properties ExpandAllNodes and CollapseAllNodes.  That functionality works as expected.

The problem arises when you collapse all nodes then individually start expanding nodes.  The chart has several problems.

1.  It is not centering child nodes on expand.  The first child node gets drawn centered under the parent then the rest of the nodes get drawn to the right.  I would expect the all children nodes to be centered under a parent just like they are when the chart is first rendered.

2.  Same level children nodes overwrite each other.  This is a pretty major bug in my opinion since the nodes just draw right over each other.  

Is there a way to force the chart to redraw when expanding nodes so 1 and 2 are not an issue?

See code below and attachments.  In chart_expanded_3rd_level_first_child.png the node "Peter" has 2 children nodes "Arnold" and "Mike".  When you click the + under node "Peter 1" its children overwrite one of the "Peter" node's children.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
  <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
            <telerik:RadButton ID="btnExpand" runat="server" Text="Expand All" OnClick="btnExpand_Click">
            </telerik:RadButton>
            <telerik:RadButton ID="btnCollapse" runat="server" Text="Collapse All" OnClick="btnCollapse_Click">
            </telerik:RadButton>           
            <br/>
 
          <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel">
               <telerik:RadOrgChart ID="RadOrgChart1" runat="server" EnableCollapsing="true" Skin="Office2010Blue" />
          </telerik:RadAjaxPanel>
  
    </form>
</body>
</html>


protected void Page_Load(object sender, EventArgs e)
{
    var employees = CreateEmployees();
 
    RadOrgChart1.DataFieldID = "EmployeeID";
    RadOrgChart1.DataFieldParentID = "ParentID";
    RadOrgChart1.DataTextField = "Name";
    //RadOrgChart1.DataImageUrlField = "ImageUrl";
    RadOrgChart1.DataSource = employees;
    RadOrgChart1.DataBind();
}
 
private DataTable CreateEmployees()
{
    var employees = new DataTable();
    employees.Columns.Add("EmployeeID");
    employees.Columns.Add("ParentID");
    employees.Columns.Add("Name");
    employees.Columns.Add("ImageUrl");
    employees.Rows.Add(new string[] { "1", null, "Kate", "~/Img/Northwind/Customers/LONEP.jpg" });
    employees.Rows.Add(new string[] { "2", "1", "Peter", "~/Img/Northwind/Customers/SAVEA.jpg" });
    employees.Rows.Add(new string[] { "21", "1", "Peter1", "~/Img/Northwind/Customers/SAVEA.jpg" });
    employees.Rows.Add(new string[] { "22", "1", "Peter2", "~/Img/Northwind/Customers/SAVEA.jpg" });
    employees.Rows.Add(new string[] { "23", "1", "Peter3", "~/Img/Northwind/Customers/SAVEA.jpg" });
    employees.Rows.Add(new string[] { "24", "1", "Peter4", "~/Img/Northwind/Customers/SAVEA.jpg" });
    employees.Rows.Add(new string[] { "25", "1", "Peter5", "~/Img/Northwind/Customers/SAVEA.jpg" });
    employees.Rows.Add(new string[] { "26", "1", "Peter6", "~/Img/Northwind/Customers/SAVEA.jpg" });
    employees.Rows.Add(new string[] { "27", "1", "Peter7", "~/Img/Northwind/Customers/SAVEA.jpg" });
 
    employees.Rows.Add(new string[] { "3", "2", "Arnold", "~/Img/Northwind/Customers/LACOR.jpg" });
 
    employees.Rows.Add(new string[] { "31", "21", "Arnold31", "~/Img/Northwind/Customers/LACOR.jpg" });
    employees.Rows.Add(new string[] { "32", "21", "Arnold32", "~/Img/Northwind/Customers/LACOR.jpg" });
    employees.Rows.Add(new string[] { "41", "22", "Arnold41", "~/Img/Northwind/Customers/LACOR.jpg" });
    employees.Rows.Add(new string[] { "42", "22", "Arnold42", "~/Img/Northwind/Customers/LACOR.jpg" });
    employees.Rows.Add(new string[] { "51", "23", "Arnold51", "~/Img/Northwind/Customers/LACOR.jpg" });
    employees.Rows.Add(new string[] { "52", "23", "Arnold52", "~/Img/Northwind/Customers/LACOR.jpg" });
 
 
    employees.Rows.Add(new string[] { "4", "3", "Tim", "~/Img/Northwind/Customers/GREAL.jpg" });
    employees.Rows.Add(new string[] { "5", "3", "Nora", "~/Img/Northwind/Customers/TRADH.jpg" });
    employees.Rows.Add(new string[] { "6", "4", "David", "~/Img/Northwind/Customers/CENTC.jpg" });
    employees.Rows.Add(new string[] { "7", "2", "Mike", "~/Img/Northwind/Customers/VAFFE.jpg" });
    return employees;
}
 
protected void btnCollapse_Click(object sender, EventArgs e)
{
    RadOrgChart1.CollapseAllNodes();
}
 
protected void btnExpand_Click(object sender, EventArgs e)
{
    RadOrgChart1.ExpandAllNodes();
}


Boyan Dimitrov
Telerik team
 answered on 21 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?