Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
346 views
Hi,

I have a page containing a ribbon bar and a content control (div).
I added AjaxSettings for this (in CreateChildControls):
AjaxSetting ajaxSetting1 = new AjaxSetting(m_ribbonBar.ID);
ajaxSetting1.UpdatedControls.Add(new AjaxUpdatedControl(m_contentPanel.ID, m_loadingPanel.ID) { UpdatePanelHeight = new Unit("100%") });
RadAjaxManager1.AjaxSettings.Add(ajaxSetting1);

The control for the content div is dynamically created (dependent on the button I clicked in the ribbon bar).
So far, this works. While the control is dynamically loaded and added to the content div, the content div shows the loading panel.

Now I built a control containing a radgrid and a button for testing purposes:
protected override void CreateChildControls()
{
         base.CreateChildControls();
 
         Button b = new Button();
         b.ID = "B";
         b.Text = "Search again";
         b.Click += new EventHandler(b_Click);
         Controls.Add(b);
         m_grid = new RadGrid();
         m_grid.ID = "Grid";
         m_grid.NeedDataSource += (grid_NeedDataSource);
         m_grid.AllowPaging = true;
         m_grid.PageSize = 10;
         Controls.Add(m_grid);
         RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(b, m_grid, LoadingPanel);
         RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(m_grid, m_grid, LoadingPanel);
}

The loading panel is the same as the one from the main page (if I don't use a loading panel here, I get the error too).
When the control is dynamically created the first time, everything is ok. The div shows the loading panel until the control is ready. When I click the button, m_radGrid.Rebind() is called and the RadGrid shows a loading panel.
But when another dynamically created control is added to the content div (I call m_contentPanel.Clear() first), I get a loading panel and this exception (right after I added the grid to the ajaxsettings):

Exception type: InvalidOperationException 
    Exception message: Collection was modified; enumeration operation may not execute
   at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
   at Telerik.Web.UI.RadAjaxControl.OnPagePreRender(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.Control.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

What is the correct way to add dynamically created controls to the AjaxSettings so that my case will work?

Thanks!
JP
Top achievements
Rank 1
 answered on 06 Dec 2011
3 answers
521 views
I have a NumericTextBox that is set to type=percentage, inside of a FormView for databinding. The database stores the percentage field as a decimal number less than or equal to one (0.00 to 1.00). I'd like the user interact with a range between 0 and 100, which is just the database value times 100. I'd also like to keep the databinding as simple as possible, and it needs to be two-way (I know <%# Eval("pct") * 100 %> would work for reading, but I wouldn't be able to save it back to the database). I know there are other solutions, like indirection or manually binding that, but is there any setting existing or planned that can essentially do this translation for the front end?

So that, any time I programmtically reference the field, it is (for example) 0.03, but when the users sees it, it would be 3 %, and they would change it by typing in  "4 %". Is this possible? Anybody found any creative solutions?

Thanks, Matthew
Vasil
Telerik team
 answered on 06 Dec 2011
5 answers
204 views
I'm trying to get a RadDatePicker to properly postback on my RadGrid.  I'm creating the object dynamically since depending on the row type, I want different types of controls in the column.

To start, inside ItemCreated, I'm doing this to create the control:
DateTime tmpDate;
item["Column2"].Controls.Add( new RadDatePicker() {
    ID = "phDate",
    SelectedDate = DateTime.TryParse( indExpDate, out tmpDate ) ? (DateTime?)tmpDate : null
} );
In this code, indExpDate is set to either my data (if the item.DataItem is available) or to "" (if not).

This is the same code that I'm using to create my TextBox objects as well, which are working fine.

The control is properly created initially, showing the date that I want.  When I post back in an ItemCommand, the SelectedDate is always NULL, and when the page redraws following the postback, the field is blank.  This only happens if I don't change the control value - once I change the control value, all is well.

As I said, TextBox works fine.  I create the control the same way, set the .Text property, can read the data during ItemCommand, and the value comes back when the postback completes.  RadDatePicker is the only one that I'm having trouble with.

Any ideas?

Thanks - Matt
Mira
Telerik team
 answered on 06 Dec 2011
3 answers
173 views
Everything is fine in IE and Firefox. However, the alignment for RadNumericTextBox is not working properly in Chrome. It was fine when I last checked it. I noticed it today at work when was refactoring some code. Even the demo pages are not working properly. 

Here is how you can reproduce it.
1) Go to:  http://demos.telerik.com/aspnet-ajax/input/examples/radnumerictextbox/firstlook/defaultcs.aspx
2) Now click on the spin buttons of any rad window and see the alignment. 

Galin
Telerik team
 answered on 06 Dec 2011
7 answers
223 views
I just have one checkbox and a text that comes in a datasource. Can I use a grid to get the following style?

CB1 Text1    CB2 Text2
CB3 Text3    CB4 Text4

...
Iana Tsolova
Telerik team
 answered on 06 Dec 2011
1 answer
126 views
I have the following code for radtreelist control , due to some issue my usercontrol popup form is not opening up in edit mode, please can i know is their any thing missing in the code thats avoiding pop up to open up.

 
<telerik:RadTreeList ID="RadTreeList1" AllowLoadOnDemand="true" AllowSorting="true" AllowPaging="true"<br>            PageSize="15" AutoGenerateColumns="false" OnChildItemsDataBind="RadTreeList1_ChildItemsDataBind"<br>            OnNeedDataSource="RadTreeList1_NeedDataSource" DataKeyNames="PId" ParentDataKeyNames="P1Id" runat="server" EditMode ="PopUp"><br>             <Columns><br>                <telerik:TreeListEditCommandColumn UniqueName="InsertCommandColumn" ButtonType="ImageButton"<br>                HeaderStyle-Width="60px" ItemStyle-HorizontalAlign="Center" /><br>               <telerik:TreeListButtonColumn UniqueName="DeleteCommandColumn" Text="Delete" CommandName="Delete"<br>                ButtonType="ImageButton" HeaderStyle-Width="30px" /><br>                <telerik:TreeListBoundColumn UniqueName="EmpCode"  HeaderText="Emp Code"<br>                            DataField="EmpCode" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"<br>                            ItemStyle-Width="100px" Visible="true"   /><br>               <telerik:TreeListBoundColumn ReadOnly="true" UniqueName="Status" DataField="Status" HeaderText="Status"<br>                            ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100px" Visible="true"><br>                 </telerik:TreeListBoundColumn><br>                <telerik:TreeListBoundColumn ReadOnly="true" UniqueName="Id" DataField="Id" <br>                            ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" Visible="false"><br>                   </telerik:TreeListBoundColumn><br>              </Columns><br>            <EditFormSettings EditFormType="WebUserControl" UserControlPath="~/Controls/Example.ascx" PopUpSettings-Modal="true" <br>            PopUpSettings-Width="700px"><br>        </EditFormSettings><br>        </telerik:RadTreeList>
Princy
Top achievements
Rank 2
 answered on 06 Dec 2011
1 answer
59 views
Hi,

We had a requirement as

The selection of the record(s) in the radgrid should be toggled by a single click of the mouse on the record. and without the use of any 'Ctrl' key to deselect it.

Is there any way to deselect the record in the radgrid by a click on it and without using 'Ctrl' key (in the case where only one record is selected.)

Can you please share your knowledge on this with me.

Thanks in advance.
Shinu
Top achievements
Rank 2
 answered on 06 Dec 2011
4 answers
276 views
I have a webform with a timer and various other controls.  When a button is pressed, the server Enables the timer.  The timer is obviously activated, as postbacks start with the OnTick event.  But once the timer starts ticking, none of the UI components are updated as defined by the ajax settings:
<asp:Panel ID="pnlTimer" runat="server">
  <asp:Timer ID="Timer1" runat="server" Interval="2000" OnTick="Timer1_Tick"
    Enabled="false">
  </asp:Timer>
</asp:Panel>
...
<telerik:AjaxSetting AjaxControlID="Timer1">
  <UpdatedControls>
    <telerik:AjaxUpdatedControl ControlID="pnlTimer" />
    <telerik:AjaxUpdatedControl ControlID="tbah" />
    <telerik:AjaxUpdatedControl ControlID="grPosts" />
    <telerik:AjaxUpdatedControl ControlID="lblErr" />
    <telerik:AjaxUpdatedControl ControlID="lblMsg" />
  </UpdatedControls>
</telerik:AjaxSetting>

The intent here is that on each timer postback some activity will be done which may update an error message or an informational message, and some conditions may cause the timer itself to change interval or disable.  But the labels are not updated, and neither is the timer.

I have a button defined as start/stop, and if I click that the timer does disable.

Note that I have the timer wrapped in a panel to accommodate the old issue where updating the timer throws an exception because it's trying to set a Visible property on the timer which doesn't exist.

What am I missing?  I'm sure it's something simple...  Thanks!
Iana Tsolova
Telerik team
 answered on 06 Dec 2011
1 answer
248 views
Hello

I am getting very desperate, i can not figure out why in


 

 

protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)

 

{

 

 

//initcombos

 

 

 

if (e.Item is GridEditFormItem && e.Item.IsInEditMode)



 

e.Item.IsInEditMode   is always false...

Can you please help?

Thanks

Kati

Princy
Top achievements
Rank 2
 answered on 06 Dec 2011
2 answers
105 views
If I have a RadGrid set up declaratively using an EntityDataSource, how can I set up filtering to cater for entity associations?

For example, in the EntityDataSource, this will not work if I try to filter on "Model":

Select="it.[Id], it.[ModelId], it.[Model].[Name] AS Model"

This results in an error:

Error: Sys.WebForms.PageRequestManagerServerErrorException: LIKE arguments must be of string type. Near member access expression, line 8, column 4.

The auto-generated column (by selecting Refresh Schema in the design view of the EntityDataSource control) is as follows:
<telerik:GridBoundColumn
    DataField="Model"
    DataType="System.String"
    FilterControlAltText="Filter Model column"
    HeaderText="Model"
    ReadOnly="True"
    SortExpression="Model"
    UniqueName="Model">
</telerik:GridBoundColumn>

Richard
Richard Weeks
Top achievements
Rank 2
 answered on 05 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?