Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
208 views
I have 2 RadDateTime controls inside my <FormTemplate>

Editing works perfectly fine, but when I try and create a new item...it throws this...?

Any idea?...if I remove the SelectedDate property everything is fine again...

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:

Line 243:                                <div class="inputItem">
Line 244:                                    <label class="rcbLabel itemLabel">Opens:</label>
Line 245:                                    <telerik:RadDateTimePicker ID="fromDatePicker" runat="server" Width="245px" DateInput-DateFormat="dddd MMM dd, yyyy h:mmtt" Skin="Sitefinity" SelectedDate='<%# Eval("FromDate") %>'>
Line 246:                                        <DateInput runat="server" EnableSingleInputRendering="true" />
Line 247:                                    </telerik:RadDateTimePicker>

Source File: DesignBuilder\Default.aspx    Line: 245

Stack Trace:

[InvalidCastException: Specified cast is not valid.]
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 27 Feb 2013
1 answer
286 views
Hello,

I have a basic radSplitter setup, with a "navigation" pane on the left and a "content" pane on the right, divided by a split bar. We'll call this page "Main.aspx".

In the navigation pane, I have a radTreeView control which builds up nodes in groups based on database records. Clicking on a treeview node sets the content pane's ContentURL to a specific aspx page based on the node & parameters, etc. Within this content pane, I can step the user through a wizard-type interface.

If the user edits an item in the content pane or completes the wizard, I would like to be able to refresh the TreeView control via some sort of javascript, similar to what is found at http://www.telerik.com/support/kb/aspnet-ajax/splitter/referencing-content-page-in-a-splitter-pane-from-the-parent-page-and-vice-versa.aspx  without refreshing the entire page and losing the reference to the page in the content pane. This would update the treeview with the new or changed information.

Complex as it may be, the only real solution I can think of is to refresh the entire page while holding a value in Session. After the treeview builds, it can inspect the session value, highlight the node in question, and load the content pane base on the session value.

Do you have any better ideas?
Dobromir
Telerik team
 answered on 27 Feb 2013
2 answers
263 views
Hello!
I searched a while for this issue and can't seem to find. I have a multipage radtabstrip. When i click a radbutton in the first tab, i want the thrid one to open, load data, then trigger the insert command in the grid inside the 3rd tab.
Everything works from the moments i arrive in the load of my 3rd tab. My EventArguments still have what i sent from the first tab.

For the sake of showing my problem, here is how i do it from the javascript file:
//Client side function called by my button in the first tab:
triggerMyThridTab: function() {
    this._needToAdd = true;
    this._tabs.get_tabs().getTab(2).set_selected(true);
}
//.... calling the selected function
onTabSelected: function(sender, args){
    if(this._needToAdd){
      sender._userControl._needToAdd = true;
      sender._userControl._myThridTab.raise_load();
    }
}
//In my thirdTab usercontrol load function....
raise_load: function(){
    if(this._needToAdd){
      var myAction = "addNewEntry";
      eval("var exec = function() { $find(window.idAjaxManager).ajaxRequestWithTarget('" + this._triggerUniqueID + "', '\\{ \\'Action\\':\\'" + myAction + "\\'}' ); }");
      ExecRequeteAjax(this, exec, 5, null);//This calls the postback
    }
}

Then, i have this in my third tab load function :
'This is the userControl contained in the third tab
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  If ValidateEventArguments() Then
    'I must open the grid in insert mode
    MyGrid.MasterTableView.IsItemInserted = True
    MyGrid.Rebind()
  End If
End Sub

In my Third tab, i have a grid with a custom userControl for the edit form:
<telerik:RadGrid ID="MyGrid" runat="server" >
   <EditFormSettings EditFormType="WebUserControl" UserControlName="~/UserControls/MyAddItemCustomUC.ascx" />
   <Columns>....</Columns>
</telerik:RadGrid>


My Problem is, i need to pass some viewstate properties to the userControl. Normally i do this in the grid itemCreated() function when the item is type of GridEditFormInsertItem.
Protected Sub MyGrid_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles MyGrid.ItemCreated
  If TypeOf e.item Is GridEditFormInsertItem Then
    Dim control As MyCustomEditUC = DirectCast(e.Item.FindControl(GridEditFormInsertItem.EditFormUserControlID), MyCustomEditUC)
    control.SomePropreties = PropretiesInViewState
  End If
End Sub

When i load the customUC, my properties is set, and i can use it. But, if i write IsItemInserted somewhere.... that variable is never set and my website crashes. I can't put the variable in the viewstate anywhere else, security issues, and thats how the website was made before i added this feature.

I hope my explanations were clear and someone might be able to answer me cause i really don't know what to do...

Sophie
Top achievements
Rank 2
 answered on 27 Feb 2013
5 answers
148 views
Hi
I have ComboBox with multicolumns which is embeded in RadGrid ->Columns ->GridTemplateColumn -> EditItemTemplate.
Orginally it had one checkbox column and 3 databound coulmns from SqlDataSource. I had to add new column and it had to be TextBox. After that when I click 'Save' while inserting new item I get error:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 


Here's my code:
<telerik:RadComboBox ID="RadComboBox1" runat="server" Height="200px" Width="300px"
                            DropDownWidth="520px" EmptyMessage="Select Item" HighlightTemplatedItems="true"
                            EnableLoadOnDemand="True" RadComboBoxImagePosition="Right" AllowCustomText="true"
                            DataTextField="hardware_no" DataValueField="id_comp"
                            SelectedValue='<%# Eval("id_comp") %>'  
                            Text='<%# Eval("hardware_no") %>'
                            AutoPostBack="False" 
                            DataSourceID="SqlDataSource1" 
                            >
                            <HeaderTemplate>
                                <table style="width: 480px" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td style="width: 20px;">
                                            </td>
                                        <td style="width: 35px;">
                                            Amount</td>
                                        <td style="width: 100px;">
                                            Hardware Nr</td>
                                        <td style="width: 160px;">
                                            Department</td>
                                        <td style="width: 140px;">
                                            Person</td>
                                              
                                    </tr>
                                </table>
                            </HeaderTemplate>
                            <ItemTemplate>
                                  
                                <table style="width: 480px" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td style="width: 20px;">
                                            <asp:CheckBox runat="server" ID="chk1" Checked="false" />
                                        </td>
                                        <td style="width: 35px;">
                                            <asp:TextBox ID="TextBoxAmount" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "amount") %>' Width="25" ></asp:TextBox>  
                                              
                                        </td>
                                        <td style="width: 100px;">
                                            <%# DataBinder.Eval(Container.DataItem, "no_h")%>
                                        </td>
                                        <td style="width: 160px;">
                                            <%# DataBinder.Eval(Container.DataItem, "dept")%>
                                        </td>
                                        <td style="width: 140px;">
                                            <%# DataBinder.Eval(Container.DataItem, "person")%>
                                        </td>
                                          
                                    </tr>
                                </table>
                                 
                            </ItemTemplate>
                        </telerik:RadComboBox>

All data fields from SqlDataSource are provided from strored procedure, including the TextBox one - 'amount'

Please help
Thx
Konrad
Nencho
Telerik team
 answered on 27 Feb 2013
8 answers
310 views
I have a telerik:RadGrid with inline editing using a user control.  The problem is that the user control when examined from inside the OnEditCommand event is always null; although a trace of the asp.net page shows that the controls are rendered.

My Radgrid definition:
<telerik:RadGrid runat="server" AllowPaging="True" ID="grdSPFilters" OnNeedDataSource="grdSPFilters_NeedDataSource"
                        Width="350px" OnRowDrop="grdSPFilters_RowDrop" AllowMultiRowSelection="false"
                        OnEditCommand="grdSPFilters_EditCommand" AutoGenerateColumns="false">

My Radgrid edit area definition:
<EditFormSettings UserControlName="FilterMatchRuleBuilder.ascx" EditFormType="WebUserControl">
                                <EditColumn UniqueName="FilterMatchRuleBuilder01">
                                </EditColumn>
 </EditFormSettings>

My event:
public void grdSPFilters_EditCommand(object sender, GridCommandEventArgs e)
 {
    // snip...
    GridDataItem item = (GridDataItem)e.Item;
   FilterMatchRuleBuilder frb = item.FindControl("FilterMatchRuleBuilder01") as FilterMatchRuleBuilder;

the problem is here - the item.Findcontrol never finds my user control.  I've tried enumerating through the entire item.Controls collection and no user controls exist.  Although a trace of the asp.NET page shows the user control has been rendered.  What is happening here?  All the Telerik articles I've seen demonstrate that you simply use an item.Findcontrol; however that simply does not work.

Another thing that doesn't make sense.  Inside my grdSPFilters_EditCommand method e.Item.IsInEditMode is always equal to false.
Geoff Ballard
Top achievements
Rank 1
 answered on 27 Feb 2013
1 answer
123 views
hi .i use RadSplitter in my masterpage and create mywebform by master page
but i have a problem with this commponent
i can use this but in run time i have problem and the problem is contentplaceholder in mywebform has merged by the footer of page and i cant use it in seperated window.
I've attached a picture to better understand the problem.
Please help.
MasterPge:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="Automation.Main" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
    <link href="Styles/CssReset.css" rel="stylesheet" />
</head>
<body >
    <form ids="form1" runat="server">
       <telerik:RadScriptManager runat="server" ID="RadScriptManager1"></telerik:RadScriptManager>
        <div class="header">
            <h1>Your Name Here</h1>
            <h2>My Personal Site</h2>
         
            <div class="menua">
            </div>
        </div>
        <div class="context" >
         
            <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" Height="100%">
            <telerik:RadPane runat="server" ID="RadPane1" Width="70%">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                      </asp:ContentPlaceHolder>
            </telerik:RadPane>
            <telerik:RadSplitBar runat="server" ID="RadSplitbar1" CollapseMode="Backward" />
            <telerik:RadPane runat="server" ID="Radpane2" Width="330px">
            </telerik:RadPane>
        </telerik:RadSplitter>
           
        </div>
        <div class="footerbg">
            <div class="footer">
            </div>
        </div>
 
    </form>
</body>
</html>

Webform:
<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Automation.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="content">
            <h3>Request an Account</h3>
            <p>Accounts will be activated pending the approval of the Administrator.</p>
            
        </div>
</asp:Content>

Dobromir
Telerik team
 answered on 27 Feb 2013
1 answer
127 views

I'm using a RadHtmlChart based on HTML5 from telerik. I'm using a Pie Chart, and I want to display the method's values. How should I save the values -- maybe as a list? It shouldn't have a big impact on the method itself, because I need this method for some report stuff.

public double GetBookedVacation(int year)
{
    int counter = 0;
    if (this.AnnualVacations.Any())
    {
        foreach (HtVacationDay vacationDay in HtVacationDays)
        {
            foreach (DateTime vacationDayDate in vacationDay.GetDates())
            {
                if (vacationDayDate.Year == year)
                {
                    counter++;
                }
            }
        }
    }
    return counter;
}

Thanks for help and fast answer.

Danail Vasilev
Telerik team
 answered on 27 Feb 2013
5 answers
139 views
hi I want to update a radgrid when my radwindow is closed. This demo suggest to use ajaxmanager in the page, but my ajaxmanager is actually in the master page. In my case is it still possible to update the grid on radwindow close?

please help
thanks in advance
Angel Petrov
Telerik team
 answered on 27 Feb 2013
14 answers
1.5K+ views
Hello,

I have to use asp:UpdatePanel in one part of my application. Is it still possible to show the telerik loading panel when it updates?
Unfortunately I couldn't find anything about it.

Thanks in advance.
Rob
Top achievements
Rank 1
 answered on 27 Feb 2013
1 answer
78 views
I just posted an Excel export solution to the pivot grid forum under the same title. You MAY want to have a look at it.
Kostadin
Telerik team
 answered on 27 Feb 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?