Telerik Forums
UI for ASP.NET AJAX Forum
10 answers
252 views
Hi there,

We are in the process of upgrading the telerik controls in our project from Telerik Controls ASP.NET AJAX Q1 2008 to Telerik Controls ASP.Net AJAX Q2 2009 (Yes its Q1 2008 to Q2 2009).

We discovered a weird behaviour on the RadComboBox that was working fine in the Q1 2008 version where the selected item is not updated at all.

The webpage in question generates the controls dynamically such that every time the submit button is click, it submits the current page and parses the next page controls.
The entire process in brief can be describe in the following:
  1. An xml document (comprising of xmlnodes where each node is a possible page to be displayed) is loaded from the database and stored in session. See eg. of a single node with 1 RadComboBox.

    <item name="PostalAddressState" displaySource="" dataSource="" label="State" control="DropDownList" direction="Horizontal" required="True" entityColumnName="Address.State" entityType="PostalAddress" width="80px"
                                <field label="Select" value="0" selected="False" fieldType="String" goTo=""/> 
                                <field label="ACT" value="ACT" selected="False" fieldType="String" goTo=""/> 
                                <field label="NSW" value="NSW" selected="False" fieldType="String" goTo=""/> 
                                <field label="NT" value="NT" selected="False" fieldType="String" goTo=""/> 
                                <field label="QLD" value="QLD" selected="False" fieldType="String" goTo=""/> 
                                <field label="SA" value="SA" selected="False" fieldType="String" goTo=""/> 
                                <field label="TAS" value="TAS" selected="False" fieldType="String" goTo=""/> 
                                <field label="VIC" value="VIC" selected="False" fieldType="String" goTo=""/> 
                                <field label="WA" value="WA" selected="True" fieldType="String" goTo=""/> 
                            </item> 

2. The web application selects the appriopriate node to display based on a index and translates the xml into a string of text using xslt.
<telerik:RadComboBox id="rcb{@id}" runat="server" Skin="WebBlue" AllowCustomText="false" MarkFirstMatch="true" 
               HighlightTemplatedItems="true" width="{@width}" EnableItemCaching="false"
                    <items> 
                      <xsl:for-each select="field"
                        <xsl:choose> 
                          <xsl:when test="@selected='True'"
                            <telerik:RadComboBoxItem Value="{@value}" Selected="{@selected}" text="{@label}" /> 
                          </xsl:when> 
                          <xsl:otherwise> 
                            <telerik:RadComboBoxItem Value="{@value}" text="{@label}" /> 
                          </xsl:otherwise> 
                        </xsl:choose> 
                      </xsl:for-each> 
                    </items> 
                  </telerik:RadComboBox> 

3. The resulting string would end up looking exactly like a typical aspx code. e.g.
<telerik:RadComboBox id="rcbID24" runat="server" Skin="WebBlue" AllowCustomText="false" MarkFirstMatch="true" HighlightTemplatedItems="true" width="100px" EnableItemCaching="false"
        <items> 
          <telerik:RadComboBoxItem Value="0" text="Select" /> 
          <telerik:RadComboBoxItem Value="Br" text="Br" /> 
          <telerik:RadComboBoxItem Value="Captain" Selected="True" text="Captain" /> 
          <telerik:RadComboBoxItem Value="Dr" text="Dr" /> 
          <telerik:RadComboBoxItem Value="Father" text="Father" /> 
          <telerik:RadComboBoxItem Value="Miss" text="Miss" /> 
          <telerik:RadComboBoxItem Value="Mr" text="Mr" /> 
          <telerik:RadComboBoxItem Value="Mrs" text="Mrs" /> 
          <telerik:RadComboBoxItem Value="Ms" text="Ms" /> 
          <telerik:RadComboBoxItem Value="Professor" text="Professor" /> 
          <telerik:RadComboBoxItem Value="Rev" text="Rev" /> 
          <telerik:RadComboBoxItem Value="Sir" text="Sir" /> 
          <telerik:RadComboBoxItem Value="Sr" text="Sr" /> 
          <telerik:RadComboBoxItem Value="The Hon." text="The Hon." /> 
        </items> 
      </telerik:RadComboBox> 

4. This string is then added to the webpage through Page.ParseControl(string). where all the controls are added to a placeholder.

5. User keys in the values and submits the page where the values would then be written back into the xmlDocument, processed and the next xmlnode would be selected to be displayed. this would continue until there is nothing left to be displayed and the xmldocument will then be saved.

I hope you guys arent lost in my explaination of how things work till now.. but in summary, its basically
xmldocument --> xslt translation --> string of aspx code --> binded to page using page.parsecontrol() -->get next node in xmldocument when user clicks submit. --> repeat all over again.


Ok. The weird behaviour where the selected item is not displayed happens when a single node that has a previously selected value or default selected value is being displayed. (see e.g. 3 above where the item "Captain" is selected.) If the user selects a different item in the list, like "Mr" on the same example, this item would now be selected. and would be saved back in the document. However, the selected item is not reflected back onto the radcomboBox even though a new item is selected. the radcombobox instead retains the "Captain" as the selected item. see flow below. of the debugging we went through.

xmldocument --> xslt translation --> string of aspx code --> binded to page using page.parsecontrol() --> radcombobox default value is "Captain"-->user selects "Mr" in combobox and clicks submit. --> "Mr" is written back in the xmldocument. --> system notices a change in the node, saves the change and retrieves updated node (same node) where "Mr" is now the selected item --> xslt translation--> string of aspx code (Where "Mr" is selected item) --> binded to page using page.parsecontrol(). ["Captain" is now selected]-->
radcomboBox selected item is "captain" when displayed to the user.

The moment the string is binded using page.parseControl(), the selected item was reverted back to the original item. but if we copied the snipper of page.Parsecontrol, from line 17 to line 21 and pasted it after line 21, the correct selected item would be persisted on the combobox.
// transformedContent is the output from xslt. 
                string transformedContent = obj.GetHtml(Context); 
                 
                Control ctrl = new Control(); 
                ctrl = Page.ParseControl(transformedContent); 
 
                // Debug statement to show that the combobox in question retains the correct selected value. 
                foreach (Control ccc in ctrl.Controls) 
                { 
                    if (ccc is RadComboBox && ccc.ID == "rcbID24"
                    { 
                        string vvv = ((RadComboBox)ccc).SelectedValue;                         
                    } 
                } 
                 
                // Clear and dispose of any controls from any previously parsed node. 
                pclXmlOutput.Controls.Clear();                 
                pclXmlOutput.Dispose(); 
 
                // Add the NEW control. 
                pclXmlOutput.Controls.Add(ctrl); 
                 
 
                // Check to see if the comboBox has changed its value. 
                foreach (Control ccc in ctrl.Controls) 
                { 
                    if (ccc is RadComboBox && ccc.ID == "rcbID24"
                    { 
                        string vvv = ((RadComboBox)ccc).SelectedValue; 
                    } 
                } 

One small note. The code here is being used in a RadWindow.

Can anyone help?













Shawn Krivjansky
Top achievements
Rank 1
 answered on 28 Apr 2012
7 answers
276 views
I'm trying to add a simple range validator to a GridBoundColumn in ItemCreated.
However, TextBoxControl.ID is null.
If I set the ID, then changes from "InPlace" edit forms are also null in e.Item.OwnerTableView.ExtractValuesFromItem

protected

 

void rgMembers_ItemCreated(object sender, GridItemEventArgs e)

 

{

 

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

 

    {    

 

        GridEditableItem edititem = (GridEditableItem)e.Item;

 

 

        / /validate Percentage

 

 

        GridTextBoxColumnEditor editorP = (GridTextBoxColumnEditor)edititem.EditManager.GetColumnEditor("Percentage");

 

 

        TableCell cellP = (TableCell)editorP.TextBoxControl.Parent;

 

 

        RangeValidator validatorP = new RangeValidator();

 

        validatorP.ID =

"rgvPercentage";

 

        validatorP.ControlToValidate = editorP.TextBoxControl.ID;  //<-- Value is NULL

        validatorP.Type =

ValidationDataType.Double;

 

        validatorP.Display =

ValidatorDisplay.Dynamic;

 

        validatorP.ErrorMessage =

"<br/>% must be between 0 and 100.";

 

        validatorP.MinimumValue =

"0";

 

        validatorP.MaximumValue =

"100";

 

        cellP.Controls.Add(validatorP);
    }

Why is the TextBoxControl.ID null ?
Seems to work with other type fields (i.e RadDatePicker.ID)

Thanks

Jayesh Goyani
Top achievements
Rank 2
 answered on 28 Apr 2012
6 answers
333 views
Added custom sizes 100 and 200 to the combobox in item created as shown.  Our grid does an ajax postback to query for more data if page size or number changes.
protected void partnerGrid_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridPagerItem)
    {
        RadComboBox pageSize = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
        RadComboBoxItem rcbItem100 = pageSize.FindItemByText("100");
        RadComboBoxItem rcbItem200 = pageSize.FindItemByText("200");
        if (rcbItem100 == null)
        {
            pageSize.Items.Add(new RadComboBoxItem("100"));
            pageSize.FindItemByText("100").Attributes.Add("ownerTableViewId", partnerGrid.MasterTableView.ClientID);
        }
 
        if (rcbItem200 == null)
        {
            pageSize.Items.Add(new RadComboBoxItem("200"));
            pageSize.FindItemByText("200").Attributes.Add("ownerTableViewId", partnerGrid.MasterTableView.ClientID);
        }
 
        pageSize.SelectedValue = partnerGrid.PageSize.ToString();
    }
}


Inexplicably, ItemCreated is fired four times when the pagesize is changed. I suppose two are for each pager (even though
it's set to top-only, the bottom pager is still there), but I can't fathom the last two.

Worse, on the 3rd and 4th invocations of ItemCreated, the combobox has remembered the standard three (10, 20, 50) plus whatever
was selected, but has lost the unselected one. So, if the user goes directly to 200, when the grid re-renders
it shows 100 below 200 (as it was added but 200 was already there).

Secondly, on subsequent postbacks, the combobox will not accept a selectedValue of whatever the fifth item is now
and keeps defaulting to 10. The grid's page size is fine, so the query gets the appropriate number of items,
we just show 10 in the pulldown instead of the number they actually chose.

The ajax is really simple:

<telerik:AjaxSetting AjaxControlID="partnerGrid">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="partnerGrid" LoadingPanelID="gridLoadingPanel" />
    </UpdatedControls>
</telerik:AjaxSetting>

Anytime we do something in the grid, show the loading panel while we're thinking about it. It seems as if
something's wrong in ajax land, but it can't be simpler than that.
Darren
Top achievements
Rank 1
 answered on 28 Apr 2012
1 answer
70 views
Is there a way to automatically disable any past days and time slots in the RadScheduler?
I do not want to show the pass days

Thanks!
Erdem
Erdem
Top achievements
Rank 1
 answered on 28 Apr 2012
6 answers
389 views
does anyone know how to reduce the size of the nodes to display more nodes on a page? Specifically the Width?
I've used the css properties to shrink the size of the fonts and image but I don't know what I have to change to reduce the node size without messing up the whole chart.

code:

 

 

<telerik:RadOrgChart ID="OrgChart" runat="server" DataFieldID="ID" DataFieldParentID="ParentID" Enabled="true" Width="100%">

 

<RenderedFields>  

 

<ItemFields>

 

<telerik:OrgChartRenderedField DataField="BusinessTitle" />

 

<telerik:OrgChartRenderedField DataField="EmployeeName" />

 

</ItemFields>

 

</RenderedFields>

 

</telerik:RadOrgChart>

 



Thanks,
Kuldeep
Top achievements
Rank 1
 answered on 28 Apr 2012
6 answers
149 views
I'm currently having an issue where a RadToolBar doesn't work in the latest version of Chrome or Internet Explorer, but does work in Firefox or IE 7.  Essentially, instead of having the HTML that should display the toolbar and the dropdown menu contained within, I have a container div with nothing outside.  I have absolutely no idea what could be causing this, and I was hoping someone could provide guidance on the matter.  Thanks for your help.
Sam
Top achievements
Rank 1
 answered on 28 Apr 2012
7 answers
245 views
Hi:

Having a z-index issue with the dropdown part of menu.  See attached file.

Phil
Phil
Top achievements
Rank 2
 answered on 27 Apr 2012
2 answers
132 views
Hi,

We have used the RadFilter control and binded with the RadGrid control. We have the apply filter button placed in the grid toolbar and user need to go and click the button once the filter is added.
1. Can we avoid the apply filter button, once he has finished adding the filter ?
2. Need to avoid the mouse click on the filter button, but the enter button does not work .  
Yogesh
Top achievements
Rank 1
 answered on 27 Apr 2012
2 answers
139 views
When I filter one column, then try to filter another column on the first filtered set, it does not work together. It resets the first filter and just filter with the 2nd value (column).

I set RadGrid datasource = some datatable in NeedDataSource event.

How can I make the set of filtering work?
MS
Top achievements
Rank 1
 answered on 27 Apr 2012
1 answer
91 views
I'm not sure what's going on here, but I had the combo boxes working on another page...then i did something (forgot what, might've updated the controls) and now they won't drop down at all...

Code:

<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="130px">
                                            <Items>
                                                <telerik:RadComboBoxItem runat="server" Text="Right Chest"
                                                    Value="Right Chest" />
                                                <telerik:RadComboBoxItem runat="server" Text="Left Chest" Value="Left Chest" />
                                                <telerik:RadComboBoxItem runat="server" Text="On Pocket" Value="On Pocket" />
                                                <telerik:RadComboBoxItem runat="server" Text="Full Front - Centered"
                                                    Value="Full Front - Centered" />
                                                <telerik:RadComboBoxItem runat="server" Text="Front Location - Other"
                                                    Value="Front Location - Other" />
                                            </Items>
                                        </telerik:RadComboBox>

It almost appears that the control is enabled = false, but i know it's enabled.

Is this a problem with the control from the design side of things? I'm using VS 2011, so I manually added the controls from the bin40 folder. Is this why?
TIM
Top achievements
Rank 1
 answered on 27 Apr 2012
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?