Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
199 views
Hello,

I've encountered some surprising behaviour with the RadAutoCompleteBox.Entries property during the implementation of a custom DataSourceSelect event.  Unless I also implement the EntryAdded and EntryRemoved events, the items added to or removed from the box by the user do not show up in the Entries collection of the control in the DataSourceSelect event handler.

I have an AutoCompleteBox defined as follows:
<telerik:RadAutoCompleteBox ID="titles" runat="server" InputType="Token" TokensSettings-AllowTokenEditing="false" DataTextField="Title" DataValueField="TitleID" OnDataSourceSelect="titles_DataSourceSelect" OnEntryAdded="titles_EntryAdded" Width="400px"></telerik:RadAutoCompleteBox>

I have a method that queries my back end database with the text entered by the user and sets the data source.  Before querying the database, I get the items that have already been added to the control and include their IDs in the database queries, so that they can be filtered out of the drop down of matches.  In other words, if a user has types in text, picked an item form the dropdown and added it to the control, I ensure that the same item does not appear again in the dropdown.

        protected void titles_DataSourceSelect(object sender, AutoCompleteBoxDataSourceSelectEventArgs e)<br>        {<br>            List<int> exclude = new List<int>();<br>            foreach (AutoCompleteBoxEntry entry in titles.Entries)<br>            {<br>                int id = -1;<br>                if (int.TryParse(entry.Value, out id))<br>                {<br>                    exclude.Add(id); <br>                }<br>            }<br><br>            titles.DataSource = Database.SearchDimension("Title", e.FilterString, exclude); // call DAL<br>        }<br>

I have put a RadAjaxManager on the page and given the AutoCompleteBox the ability to ajaxically update itself.
         <telerik:AjaxSetting AjaxControlID="titles">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="titles" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
             </telerik:AjaxSetting>

But the above doesn't work.  When my DataSourceSelect event handler fires, the Entries collection of the control is always empty.

If I implement empty event handlers for EntryAdded and EntryRemoved, it works as expected, and the Entries collection contains the items which have been previously selected by the user.

<telerik:RadAutoCompleteBox ID="titles" runat="server" InputType="Token" TokensSettings-AllowTokenEditing="false" DataTextField="Title" DataValueField="TitleID" OnDataSourceSelect="titles_DataSourceSelect" OnEntryAdded="titles_EntryAdded" OnEntryRemoved="titles_EntryRemoved" Width="400px"></telerik:RadAutoCompleteBox>

        protected void titles_EntryAdded(object sender, AutoCompleteEntryEventArgs e)<br>        {<br>        }<br><br>        protected void titles_EntryRemoved(object sender, AutoCompleteEntryEventArgs e)<br>        {<br>        }

If I eliminate either one of these two event handlers, the corresponding action is not taken into account in the Entries collection.  So if I remove EntryAdded, items I add to the control are not taken into account.  If I remove EntryRemoved, when I add and then remove an item, it still shows up in the Entries collection.

On a full page postback triggered by something else, the Entries collection always correctly lists items really entered in the web form.

I am running this in a SharePoint 2010 custom Application page.

This looks like a bug to me, but maybe I've misunderstood the API for this control and am not using it correctly.



Nencho
Telerik team
 answered on 28 Mar 2014
2 answers
364 views
Hi,

I've been reading through your help doc and also searched through the forum on how to pass parameter from one user control (UC1) to another user control (UC2), but still not quite getting it, hopefully you could help me understand it better.

I created a small project as below:

My aspx page contains UC1 (a grid) and UC2 (a textbox).  When UC1 gets clicked, it'll get the location id and I need to pass that value to UC2 to display it.
RadAjaxManager is on the aspx page and RadAjaxManagerProxy is set up in each user controls.

The closest I can find is this from your help doc :

http://www.telerik.com/help/aspnet-ajax/ajax-load-control-from-another-webusercontrol-in-different-masterpage-contentplaceholder.html

Is this the way I should follow to send data from one user control to another by using bubble event or is there another way you would recommend?

Thank you,

Helen
Helen
Top achievements
Rank 1
 answered on 28 Mar 2014
1 answer
145 views
Hi,

I have a radGrid.  The data populated is very expensive to gather, so I have opted to collect only the data shown on the current page of the grid and set the virtual count to a select COUNT(*) ...etc. which works fine when I have the radGrid on a webpage.  

In the NeedDatasounrce event, I simply get the radGrid.PageSize & radGrid.CurrentPageIndex and use these to figure out the set to return... this all works ok in a web page.

However, if I use the same grid in a server control (built in CreateChildControls()) the page size is always 10, even when I jump from 10 to 20 to 50, each time in (needdatasource event) code it is 10.  Viewstate is enabled for this grid, could it be that the viewstate has not loaded for this grid at this point?  If so , any reason why not for server control, but OK on the aspx webpage?...(differences in event orders??)  

Is there anything I can do to get this pagesize value at the radGrid_needdatasource event for my server control?

ps - This new page value is available by the time we get to the pre_render event... and the PageSize changed event fires after the needdatasource event, so these eventargs are too late to be used in the datasource.

Thanks in advance

Craig
Top achievements
Rank 1
 answered on 28 Mar 2014
1 answer
170 views
how to perform the Radbutton condition base radconfirm,radalert
And When i check the radgrid GroupHeader check box  checked  child items check box checked at list 1 child item checked after click radbutton  call the radconfirm,other wise call the radalert  sample code in javascript
Shinu
Top achievements
Rank 2
 answered on 28 Mar 2014
1 answer
231 views
I am building an application that will be used globally.  So, how or where do I specify inside the Telerik Control to use the correct Language.  For example, I use a RadTextBox control.  That control has a "Label" property and I set the value of that property to an English Text.  How will it get translated into German for example?
Viktor Tachev
Telerik team
 answered on 28 Mar 2014
2 answers
50 views
I am performing a test on the editor content in OnClientSubmit. I would like to prevent the submit if the test fails. Is it possible to do this?
Ianko
Telerik team
 answered on 28 Mar 2014
1 answer
35 views
Hi all

I use the RadTreeList  component with a custom Pager component (PagerTemplate).
But when booting the root page in a browser error occurs: 

TypeError: this._events is null

 However, if I remove the custom Pager component  this error is not reproduced 
Someone can vary help in solving this prolemy?

Code:

                        <telerik:RadTreeList ID="rdTree" runat="server" 
                            DataKeyNames="Location" ParentDataKeyNames="ParentLocation"
                            GridLines="None" Skin="EchopassTreeListSkin" EnableEmbeddedSkins="false"
                            AllowPaging="True" AutoGenerateDeleteColumn="True"
                            AutoGenerateEditColumn="True" AllowAutomaticDeletes="false"
                            AllowAutomaticUpdates="false" 
                            AutoGenerateColumns="False"
                            AllowSorting="True" OnNeedDataSource="rdTree_NeedDataSource"
                            PageSize="50" OnItemDataBound="rdTree_ItemDataBound"
                            OnItemCommand="rdTree_ItemCommand"
                            >
                            <Columns>
                                                    /* ----------- */
                            </Columns>
                            <ClientSettings>
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true"></Scrolling>
                            </ClientSettings>
                            <EditFormSettings EditFormType="Template" PopUpSettings-Height="280px" PopUpSettings-Width="900px">
                                <FormTemplate>
                                    <table style="width: 700px; padding: 10px">
                                        <tr>
                                            <td colspan="6" style="height: 20px">
                                                <asp:Label ID="lblBanner" runat="server" CssClass="boldLabel"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblName" runat="server" CssClass="boldLabelxSmall"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtName" runat="server" CssClass="width200"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:Label ID="lblDescription" runat="server" CssClass="boldLabelxSmall"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtDescription" TextMode="MultiLine" runat="server" CssClass="width200"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:LinkButton ID="lnkCancel" runat="server" CssClass="btnGeneral_grid"
                                                     Text="Cancel" CommandName="Cancel"></asp:LinkButton>
                                            </td>
                                            <td>
                                                <asp:LinkButton ID="lnkGo" runat="server"></asp:LinkButton>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblPhoneNumber" runat="server" Text="Phone Number:" CssClass="boldLabelxSmall">
                                                </asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadNumericTextBox ID="txtFloorNumber" runat="server" Width="40px" MinValue="1"
                                                 NumberFormat-DecimalDigits="0"></telerik:RadNumericTextBox>    
                                            </td>
                                            <td>
                                                <telerik:RadMaskedTextBox ID="txtPhoneNumber" SelectionOnFocus="CaretToBeginning" 
                                                runat="server" Mask="(###) ###-####" Width="80px"></telerik:RadMaskedTextBox>
                                            </td>
                                            <td></td>
                                            <td></td>
                                            <td></td>
                                        </tr>                                        
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>

                            <PagerStyle AlwaysVisible="true" Position="TopAndBottom" />
                            <PagerTemplate>
                                <asp:Panel ID="PagerPanel" Style="padding: 6px; line-height: 24px" runat="server">
                                    <div style="float: left;">
                                        <span style="margin-right: 3px;">Page size:</span>
                                        <telerik:RadNumericTextBox ID="txtPageSize" runat="server" Style="margin-right: 20px;" Width="40px"
                                            Value='<%# (int)DataBinder.Eval(Container, "Paging.PageSize") %>'>
                                            <ClientEvents OnValueChanged="txtPageSize_ValueChanged" />
                                            <NumberFormat DecimalDigits="0" />
                                        </telerik:RadNumericTextBox>

                                    </div>
                                    <div style="margin: 0px; float: right;">
                                                    Displaying page
                                        <%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %>
                                        of
                                        <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                                        , items
                                        <%# (int)DataBinder.Eval(Container, "Paging.FirstIndexInPage") + 1 %>
                                        to
                                        <%# (int)DataBinder.Eval(Container, "Paging.LastIndexInPage") + 1 %>
                                        of
                                        <%# DataBinder.Eval(Container, "Paging.DataSourceCount")%>
                                    </div>
                                    <div style="width: 400px; margin: 0px; padding: 0px; float: left; margin-right: 10px; white-space: nowrap;">
                                        <asp:Button ID="Button1" runat="server"
                                            CommandName="Page" CommandArgument="First" Text=" " CssClass="PagerButton FirstPage" />
                                        <asp:Button ID="Button2" runat="server"
                                            CommandName="Page" CommandArgument="Prev" Text=" " CssClass="PagerButton PrevPage" />
                                        <span style="vertical-align: middle;">Page:</span>
                                        <telerik:RadNumericTextBox ID="RadNumericTextBox1" Width="25px" Value='<%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %>'
                                            runat="server">
                                            <ClientEvents OnValueChanged="RadNumericTextBox1_ValueChanged" />
                                            <NumberFormat DecimalDigits="0" />
                                        </telerik:RadNumericTextBox>
                                        <span style="vertical-align: middle;">of
                                <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                                        </span>
                                        <asp:Button ID="Button3" runat="server"
                                            CommandName="Page" CommandArgument="Next" Text=" " CssClass="PagerButton NextPage" />
                                        <asp:Button ID="Button4" runat="server"
                                            CommandName="Page" CommandArgument="Last" Text=" " CssClass="PagerButton LastPage" />
                                    </div>
                                    <asp:Panel runat="server" ID="NumericPagerPlaceHolder" />
                                </asp:Panel>
                            </PagerTemplate>
                        </telerik:RadTreeList>
Maria Ilieva
Telerik team
 answered on 28 Mar 2014
1 answer
136 views
I am trying to dynamically create a radgrid and render it to HTML so that I can email it to users. I
have all the data I need and the formatting of the actual grid control
finished. However, this is running in a batch process (not an aspx
page) so I am dynamically creating a dummy page, populating the grid and
trying to render it to html using the code below. However, on the call
to 'RenderControl' I get an exception: 'The control with ID 'RadGrid1'
requires a ScriptManager on the page. The ScriptManager must appear
before any controls that need it.'. Can anyone pls advise how to do
this :)

Thanks

Public Function ExecuteRadgridReport(report As IReport, ByVal params As Object(), ByVal userid As Integer) As String

Dim p As New Page
p.EnableEventValidation = False

Dim form As New HtmlForm
p.Controls.Add(form)

form.Controls.AddAt(0, New ScriptManager)

Dim x As New Telerik.Web.UI.RadGrid
x.MasterTableView.GroupsDefaultExpanded = True
x.ID = "RadGrid1"
form.Controls.Add(x)

ExecuteRadgridReport(x, report, params, userid)

'Render the grid to html
Dim sw As New StringWriter()
Dim htw As New HtmlTextWriter(sw)
x.RenderControl(htw)

'Return the html
Return sw.ToString()

End Function
Angel Petrov
Telerik team
 answered on 28 Mar 2014
1 answer
75 views
We want to create a 4 level grid to display the following information
Level1: Projects – every project number is unique
Level 2: The orders that belong to the project – The orders for every project starts with order no 0001. There could be many orders with the same number (e.g. 0001) but only one order 0001 for each project. Project plus order number is unique
Level3: The Line Items within an order. Again a line item 0001 will appear in every order. Project + Order No + line Item is unique
Level4: The Release Note numbers for each Line Item. There could be many Release not numbers for each Project, Order No, Line Item Combination.
Question:
How should the Master and detail keys be structured for each level.
Eyup
Telerik team
 answered on 28 Mar 2014
1 answer
58 views
Hi,

I'm using a rad Grid in which I'm hiding a column by default, through code using "grid.Display" property. Sometimes I even need to use the option for showing / hiding column via the context menu in the header of a grid.
Other things work normally, except column re-size. When I try to re-size a particular column (suppose, col 3), col 2 gets re-sized.
This happens with all the columns coming next to any of the hidden columns.

I've checked previous posts on the same topic, but could not found any resolution on this.(or a fix was in process)
I've read that this issue may occur with IE6/7, but I'm using IE9.

Please let me know, how this can be worked out.

Thanks.
Venelin
Telerik team
 answered on 28 Mar 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?