This is a migrated thread and some comments may be shown as answers.

Cannot view programmatically added RadListBoxItems (RadListbox is not refreshed)

3 Answers 111 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Bahadır
Top achievements
Rank 1
Bahadır asked on 09 May 2013, 11:25 AM
Hi everybody,

I have a RadGrid which has checkbox as GridTemplateColumn. When the checkbox is clicked, I want to add a new item to a RadListbox.
I use the click event and add RadListBoxItems to my RadListbox, but the new item is not rendered in browser. I can also add a new item using a button's click event. After button click event, I can see both newly added items. So the problem is, a new item cannot be seen after checkbox click event.

Am I doing something wrong or it this a bug?
(Telerik assembly version: v4.0.30319)

Below is the related code:

<telerik:RadGrid ID="rgStudentList" runat="server" AllowFilteringByColumn="True"
                                AllowSorting="True" CellSpacing="0" Enabled="false" GridLines="None" GroupingSettings-CaseSensitive="false"
                                OnItemCommand="rgOgrenciListesi_ItemCommand" OnNeedDataSource="rgOgrenciListesi_NeedDataSource"
                                SortingSettings-SortToolTip="">
                                <GroupingSettings CaseSensitive="False" />
                                <SortingSettings SortToolTip="" />
                                <MasterTableView AllowPaging="true" AutoGenerateColumns="False" DataKeyNames="No"
                                    PageSize="10">
                                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                        <HeaderStyle Width="20px" />
                                    </RowIndicatorColumn>
                                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                        <HeaderStyle Width="20px" />
                                    </ExpandCollapseColumn>
                                    <Columns>
                                        <telerik:GridBoundColumn AllowFiltering="true" AllowSorting="true" AutoPostBackOnFilter="true"
                                            CurrentFilterFunction="StartsWith" DataField="TCKimlikNo" FilterControlAltText="Filter column1 column"                                  
                                            >
                                        </telerik:GridBoundColumn>
 
<telerik:GridTemplateColumn HeaderText="Seç" AllowFiltering="false">
                                                <ItemTemplate>                                                   
                                                    <asp:CheckBox ID="chkI" runat="server" AutoPostBack="true"  OnCheckedChanged="chkI_CheckedChanged" />
                                                </ItemTemplate>
                                                <HeaderTemplate>
                                                    <asp:CheckBox ID="chkH" runat="server" AutoPostBack="true"
                                                        OnCheckedChanged="chkH_CheckedChanged" />
                                                </HeaderTemplate>
                                            </telerik:GridTemplateColumn>
                                    </Columns>
                                    <EditFormSettings>
                                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                        </EditColumn>
                                    </EditFormSettings>
                                    <NoRecordsTemplate>
                                        <center>
                                            blah blah</center>
                                    </NoRecordsTemplate>
                                </MasterTableView>
                                <FilterMenu EnableImageSprites="true">
                                </FilterMenu>
                                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                                </HeaderContextMenu>
                            </telerik:RadGrid>

protected void chkI_CheckedChanged(object sender, EventArgs e)
        {
 
            CheckBox chkI = sender as CheckBox;
 
            String student= ((GridDataItem)chkI.Parent.Parent).Cells[3].Text;
            
            rlbOgrNo.Items.Add(new RadListBoxItem(student, student));           
 
        }

After the checkbox checked changed event, I cannot see the new item added. (Not rendered.)

I tried many things but no hope. Any help is appreciated.
Thanks.
Bahadır


3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 14 May 2013, 12:03 PM
Hi Bahadır,

I was not able to reproduce the issue in our latest release which is Q1 2013 SP2. I prepared a small sample and attached it to this thread. Please give it a try and let me know how it differs from your real setup.

Kind regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Bahadır
Top achievements
Rank 1
answered on 15 May 2013, 10:54 AM
Hi Kostadin,

We maintain legacy code and Telerik version is 2012.2.912.40
Sorry about not giving this info in my original question.

Updating to the latest telerik version is out of question because there is no budget for this.
If this is a bug, it would be ok to update to a backward compatible bug-fix version.
Can you reproduce the issue for version: 2012.2.912.40 ?

Thanks a lot for the feedback.
Bahadır

 
0
Kostadin
Telerik team
answered on 20 May 2013, 06:45 AM
Hello Bahadır,

I was not able to reproduce the issue. You could try my sample with 2012.2.912.40 version and you will see that items are added in the ListBox as expected. Could you please provide the problematic code declaration and the related code behind in order to investigate the issue further?

Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Bahadır
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Bahadır
Top achievements
Rank 1
Share this question
or