Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
282 views
Hello,

I have a dynamically created raddcok and  in which user control is loaded.

I want to update the user control contents on one of the command item click event. Well how is it possible to refresh the contents (may be page load event of the user control need to be called) ?

Protected Sub RadDock_Command(ByVal sender As Object, ByVal e As DockCommandEventArgs)
      if  e.Command.Name = "doRefresh" Then
            Dim doc2Refresh As String = DirectCast(sender, RadDock).UniqueName
            ' expect to refresh user control loaded within raddock.
           End If
    End Sub


Thanks.
Pero
Telerik team
 answered on 11 May 2011
1 answer
65 views
Why are the hot fixes not done as .msp files - due to local administrative rights policies in place at our organization we're finding it difficult to simply copy/paste the hot fix files over the originall installed files.  If we had a simple .msp file our lives would be made so much simpler.
Erjan Gavalji
Telerik team
 answered on 11 May 2011
1 answer
361 views
Hello,

We are using the following column definition for a button column that should display a DateTime:

<telerik:GridButtonColumn UniqueName="STARTDATE" ButtonType="LinkButton"
       DataTextField="STARTDATE" DataTextFormatString="{0:g}" HeaderText="[START DATE]"
       CommandName="GoToItem" />

The problem is that it is standard in our app to display just the date if the time is "12:00 am", as this usually indicates that the exact time was not entered. Therefore, I need to conditionally use "{0:d}" for my format string instead of "{0:g}" when StartDate.TimeOfDay.Ticks=0.

We have a server-side function with the following format that we usually use for this logic:
public static string GetShortDateTimeString(DateTime? aDateTime)

In the past, we've either called the function in the ItemDataBound event or used a GridTemplateColumn with a LinkButton to call the function:
<telerik:GridTemplateColumn HeaderText="[START DATE]"DataField="STARTDATE" UniqueName="STARTDATE">
    <ItemTemplate>
      <asp:LinkButton ID="lnkSTARTDATE" runat="server"
            Text='<%#GetShortDateTimeString((DateTime?)Eval("STARTDATE"))%>'
            OnCommand="lnkViewGrid_Command" CommandArgument='<%# Eval("OID").ToString() %>'/>
    </ItemTemplate>
     </telerik:GridTemplateColumn>

My question is whether there is something I can do in the GridButtonColumn definition to create this complex formatting logic, or if I have to use one of those two options. I tried using the GridButtonColumn "Text" field but got an error when I tried to load the page:

Databinding expressions are only supported on objects that have a DataBinding event. Telerik.Web.UI.GridButtonColumn does not have a DataBinding event.


--Christina

Marin
Telerik team
 answered on 11 May 2011
1 answer
49 views
I'm starting to manage RadSheduler, and I know how to change the Tooltip of dating.Thanks for your help
Veronica
Telerik team
 answered on 11 May 2011
2 answers
125 views
The MaxTextLength property checks the limit on submit, but I need a way of stopping any characters being entered once the limit has been reached, I'm prepared to take the performance hit.

I can display an alert message once the limit is reached, but how can I stop any more text being entered?

NB: The users can only see the text entry view, the HTML view is hidden, and the character limit is for the text entered, not the html length.

The function I have so far is:-
<script type="text/javascript">
    function OnClientLoad(editor) {
        editor.attachEventHandler("onkeydown", function (e) {
            var content = editor.get_text(); //returns the editor's content as plain text
            var words = 0;
            if (content) {
                var punctRegX = /[!\.?;,:&_\-\-\{\}\[\]\(\)~#'"]/g;
                var contentcontent = content.replace(punctRegX, "");
                var trimRegX = /(^\s+)|(\s+$)/g;
                contentcontent = content.replace(trimRegX, "");
                if (content) {
                    splitRegX = /\s+/;
                    var array = content.split(splitRegX);
                    words = array.length;
                }
            }
            var counter = $get("counter");
              
            var limit =<%  Response.Write(charimit.ToString());%>
            counter.innerHTML = "Words: " + words + " Characters: " + content.length;
            if(content.length > limit)
            {
                alert("Too many characters!");
                 
            }
  
        });
    }
  
</script>

Ideally, after the alert has popped up, the character that had just been entered would be deleted, or at least future entry would be prevented (although any deletions would have to be allowed).

Thanks
AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 11 May 2011
1 answer
93 views
Hello Telerik,

I have a question, in our project we are using Dundas Charts, and we have a requirement that charts we are displaying should be exported to PDF on a button click. I see that telerik provide PDF export option but I was wondering weather it supports Dundas charts if it dose can you please provide some sample or tutorial kind of thing !!!


Thanks,
Education Dynamics
Sebastian
Telerik team
 answered on 11 May 2011
1 answer
233 views
Hello.
I am creating a servercontrol that inherits the radgrid.
I am creating it on "OnLoad"
I want to create a GridDropDownColumn that will be filled by a DataSet.
From what i read i saw i have 3 options :
1) GridDropDownColumn with DataSourceID  ,
 2) DropDownColumn that can "bind" to the gridDataSource ( the gridatasource must have both id and text - and i can only have the id) 
3) Template.
I can't use number 1 and 2. so the only option is template.
I created a class for ItemTemplate, and one for EditItemTemplate.
The problem i have is with the EditItemTemplate

   class DropDownListTemplate : IBindableTemplate<br>
    {<br>
        string dataField = null;<br>
        bool enabled;<br>
        DropDownList ddl = null;<br>
<br>
        public DropDownListTemplate(string dataField, bool enabled)<br>
        {<br>
            this.dataField = dataField;<br>
            this.enabled = enabled;<br>
        }<br>
<br>
        void ITemplate.InstantiateIn(Control container)<br>
        {<br>
            ddl = new DropDownList();<br>
            ddl.Enabled = enabled;<br>
            ddl.DataBinding += ddl_DataBinding;<br>
            container.Controls.Add(ddl);<br>
        }<br>
<br>
        void ddl_DataBinding(object sender, EventArgs e)<br>
        {<br>
            ddl = (DropDownList)sender;<br>
            ddl.ID = dataField;<br>
            GridEditFormItem bidingContainer = ddl.NamingContainer as GridEditFormItem;<br>
            string value =  ((DataRowView)bidingContainer.DataItem)[dataField].ToString();<br>
<br>
            ddl.Items.Add(value);<br>
<br>
        }<br>
  <br>
<br>
        IOrderedDictionary IBindableTemplate.ExtractValues(Control container)<br>
        {<br>
            OrderedDictionary dick = new OrderedDictionary();<br>
            dick.Add(dataField, ddl.SelectedValue.ToString());<br>
            return dick;<br>
        }<br>
    }




I wanted to make it only ITemplate but i got an error saying i need to make it IBindableTemplate.

On ItemDataBound i find the template, get the dropdownlist and bind it to my DataSet.
When i push the "Edit" command it works. The problem appears when i push "Update".

On the "GridTelerik_UpdateCommand" event i need to Extract the new values.
But i get an error at : ((GridEditableItem)e.Item).ExtractValues(newValues);

The error is : "Editor cannot be initialized for column :  <columnName> - where columnName is the uniqueName of the TemplateColumn.

Is there a way i can resolve it. Does it have a problem because i instantiate the column editItemTemplate on Load? In case there is a better solution for this situation please advice me.
Thanks.
Radoslav
Telerik team
 answered on 11 May 2011
1 answer
140 views
The server I'm developing on is running IIS 7.5, and my company uses Internet Explorer 8.  In my program, I have a series of steps that a user has to go through in sequence.  As one step is completed (via a button click), another step loads.  The steps are each in Panels, and I use a RadAjaxManager to update the next panel on button clicks so that the next panel is made visible.  The odd problem that I'm having right now is that whenever the next panel loads, the first RadNumericTextBox within the newly loaded panel will not hold the value typed into it.  For example, if, once the text box loads, the user types "100" and goes to the next text box, "100" will stay in the box, but if I were to try to find its value server-side, it would be blank.  If i were to click on the text box again, the value "100" will disappear.  Upon typing in the value again, it will change to "100.00" like it's supposed to whenever it loses focus, and the value will be available server-side.  This happens randomly, but if it does happen, it will only happen on the first time and on the first box.  Any help is much appreciated.

Here is my Markup:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="lookupButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="orderPanel" LoadingPanelID="RadAjaxLoadingPanel1" />      
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                                                                   
                        <telerik:AjaxUpdatedControl ControlID="countPanel" LoadingPanelID="RadAjaxLoadingPanel1" />  
                        <telerik:AjaxUpdatedControl ControlID="orderCount" LoadingPanelID="RadAjaxLoadingPanel1" />  
                        <telerik:AjaxUpdatedControl ControlID="amountPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>           
                <telerik:AjaxSetting AjaxControlID="inputButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="amountPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="amountList" LoadingPanelID="RadAjaxLoadingPanel1" />       
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                                                                   
                    </UpdatedControls>
                </telerik:AjaxSetting>           
                <telerik:AjaxSetting AjaxControlID="printButton">
                    <UpdatedControls>                       
                        <telerik:AjaxUpdatedControl ControlID="errorLabel"/>                                       
                        <telerik:AjaxUpdatedControl ControlID="printButton" LoadingPanelID="RadAjaxLoadingPanel1" />                                           
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>       
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue" />
    <asp:Panel ID="orderPanel" runat="server" DefaultButton="lookupButton">
        <fieldset>
            <legend>Order Information</legend>
            <table>
                <tr>
                    <td align="left"><telerik:RadNumericTextBox ID="orderNum" Width="150px" runat="server" MaxLength="6" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" DataType="Int32"></telerik:RadNumericTextBox></td>
                    <td align="left"><asp:Button ID="lookupButton" runat="server" Text="Look Up Order" OnClick="LookupButton_Click" /></td>
                </tr>
                <tr>
                    <td align="left"><asp:Label ID="orderSalesText" runat="server" Font-Size="Small" Font-Bold="true" Text="Money Order Amount: "></asp:Label></td>
                    <td align="left"><asp:Label ID="orderSalesValue" runat="server" Font-Size="Small" Font-Bold="true"></asp:Label></td>
                </tr>
                <tr>
                    <td align="left"><asp:Label ID="orderFeesText" runat="server" Font-Size="Small" Font-Bold="true" Text="Money Order Fees: "></asp:Label></td>
                    <td align="left"><asp:Label ID="orderFeesValue" runat="server" Font-Size="Small" Font-Bold="true"></asp:Label></td>
                </tr>
            </table>
        </fieldset>
    </asp:Panel>
    <br />
    <br />
    <asp:Panel ID="logPanel" runat="server">
         
    </asp:Panel>
    <asp:Panel ID="countPanel" runat="server" DefaultButton="inputButton" Visible="false">
        <fieldset>
            <legend>Total Money Orders</legend>
            <table>
                <tr>
                    <td align="left"><telerik:RadNumericTextBox ID="orderCount" Width="150px" runat="server" MaxLength="2" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" DataType="Int32"></telerik:RadNumericTextBox></td>
                    <td align="left"><asp:Button ID="inputButton" runat="server" Text="Enter Count" OnClick="InputButton_Click" /></td>
                </tr>
            </table>
        </fieldset>
    </asp:Panel>
    <br />
    <br />
    <asp:Panel ID="amountPanel" runat="server" Visible="false" DefaultButton="printButton">
        <telerik:RadListView ID="amountList" runat="server" ItemPlaceholderID="amountPlaceHolder">
            <LayoutTemplate>
                <fieldset>
                    <legend>Money Order Amounts</legend>
                    <asp:Panel ID="amountPlaceHolder" runat="server"></asp:Panel>
                </fieldset>
            </LayoutTemplate>           
            <ItemTemplate>
                <center>
                    <table>
                        <tr>
                            <td align="right"><asp:Label ID="amountLabel" runat="server" Text="<%# Container.DataItem.ToString() %>" Font-Bold="true" Font-Size="Small"></asp:Label></td>
                            <td align="left"><telerik:RadNumericTextBox ID="amountBox" Width="150px" runat="server" NumberFormat-DecimalDigits="2" DataType="double"></telerik:RadNumericTextBox></td>                           
                        </tr>
                    </table>
                </center>       
            </ItemTemplate>
        </telerik:RadListView>           
        <br />
        <br />
        <center>
            <asp:CheckBox ID="suspFlag" runat="server" /><asp:Label runat="server" ID="suspText" Text="This order is suspicious" Font-Bold="true" Font-Size="Small"></asp:Label>
            <br />
            <asp:Button ID="printButton" runat="server" Text="Print Money Orders" OnClick="PrintButton_Click" />
        </center>           
    </asp:Panel>

Here is my server-side code:
public partial class MoneyOrder_Create : System.Web.UI.Page
{
    ACROrder order = ACRFunctions.Order;
    int moneyOrderCount = ACRFunctions.OrderCount;
    protected void Page_Load(object sender, EventArgs e)
    {
        ((AppMasterPage)Master).verNum = "3.5";
        ((AppMasterPage)Master).visibleHome = true;
        ((AppMasterPage)Master).AppName = "Money Order Creation";
        ((AppMasterPage)Master).visibleBreadCrum = true;
        ((AppMasterPage)Master).subMenuName = navLastMenu.GetMenuLineApps(navLastMenu.GetPreviousMenuID(Convert.ToInt32(Session["SessionMenuID"])));
        if (Request.QueryString["error"] != null)
            errorLabel.Text = Request.QueryString["error"];
    }
 
    protected void LookupButton_Click(object sender, EventArgs e)
    {
        order = ACRFunctions.GetACROrder(Convert.ToInt32(orderNum.Text), true);
        if (order.Order_No == -1)
            SetLookupText("Cannot Find Order in ACR", "", "");           
        else
        {
            if (ACRFunctions.OrderIsMoneyOrder(order))
            {
                if (!ACRFunctions.OrderIsUsed(order))
                {
                    SetLookupText("", ACRFunctions.GetMoneyOrderSum(order).ToString("C"), ACRFunctions.GetMoneyOrderFees(order).ToString("C"));
                    SetFocus(orderCount);
                    ACRFunctions.Order = order;
                    countPanel.Visible = true;
                }
                else
                    SetLookupText("This ACR Order has already been used to print money orders", "", "");               
            }
            else
                SetLookupText("Not a Valid Money Order Transaction", "", "");               
        }
    }
 
    public void SetLookupText(string errorText, string salesText, string feesText)
    {
        errorLabel.Text = errorText;
        orderSalesValue.Text = salesText;
        orderFeesValue.Text = feesText;
        if (salesText == "")
        {
            countPanel.Visible = false;
            amountPanel.Visible = false;
        }
    }
 
    protected void InputButton_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(orderCount.Text))
        {
            errorLabel.Text = "You Must Enter a Count";
            return;
        }
        else
        {
            moneyOrderCount = Convert.ToInt32(orderCount.Text);
            if (moneyOrderCount <= 0)
            {
                errorLabel.Text = "You Must Enter a Positive Number";
                amountList.DataSource = null;
                return;
            }
            errorLabel.Text = "";
            amountPanel.Visible = true;
            ArrayList list = new ArrayList();
            for (int i = 0; i < moneyOrderCount; i++)
            {
                list.Add("Amount " + (i + 1) + ": ");
            }
            amountList.DataSource = list;
            ACRFunctions.OrderCount = moneyOrderCount;           
        }
    }
 
    protected void PrintButton_Click(object sender, EventArgs e)
    {
        List<decimal> amounts = new List<decimal>();
        foreach (var item in amountList.Items)
        {
            if (string.IsNullOrEmpty(((item.FindControl("amountBox") as RadNumericTextBox).Text)))
            {
                errorLabel.Text = "You must enter an amount for each money order.  Change the count if you entered too many.";
                return;                                            
            }
            else if (Convert.ToDecimal((item.FindControl("amountBox") as RadNumericTextBox).Text) <= 0)
            {
                errorLabel.Text = "Money Order Amounts Must Be Greater than Zero.";
                return;                                            
            }
            else
                amounts.Add(Convert.ToDecimal((item.FindControl("amountBox") as RadNumericTextBox).Text));
        }
        Printer printer = new Printer();
        string error = printer.PrintMoneyOrders(amounts, ACRFunctions.Order, suspFlag.Checked, Session["SessionUserNum"].ToString(), Request.ServerVariables["REMOTE_ADDR"]);
        if (!string.IsNullOrEmpty(error))
            errorLabel.Text = error;
        else
            errorLabel.Text = "Print Successful";
    }
}

Thanks,
Aaron
Martin
Telerik team
 answered on 11 May 2011
3 answers
175 views
Hi, i have text allign issue in RadScheduler when the resources grouping direction is Vertical. The text is not fully displayed and the text is align to the left.
Here is the picture.


Could anyone please advice me ?
PLEASE !!
Peter
Telerik team
 answered on 11 May 2011
1 answer
92 views
Hi,
I am using telerilk rad grid to show details of employee name and ID with pagination. I also have a text box for employee name which should populate first employee name in the grid page. When i change the grid to second page, the text box should show the first name of second page. I am assigning the text box value in the ItemDataBound event. The value is assigned to the text box but it is not showing in the UI since the grid paging is done in AJAX and the page is not rendered. How to get the text box populate without rendering the whole page.
Thanks,
S, Karthi
Karthi
Top achievements
Rank 1
 answered on 11 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?