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

RadComboBox in EditFormSettings - how to find it ?

6 Answers 280 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Krzysztof
Top achievements
Rank 1
Krzysztof asked on 11 Dec 2008, 08:40 PM
Hi

I have code :
<telerik:RadGrid ID="GridAdvert" runat="server" > 
         <MasterTableView DataKeyNames="id" >                        
           <EditFormSettings EditFormType="Template"  > 
            <EditColumn UniqueName="EditCommandColumn1">   
            </EditColumn>        
             <FormTemplate> 
                 
                  <telerik:RadComboBox ID="findCompanyBox" runat="server" Skin="Inox"               
                    AllowCustomText="True" ShowToggleImage="True" ShowMoreResultsBox="true" 
                    EnableLoadOnDemand="True" EnableVirtualScrolling="true"   
                    Width="200px" Height="200px"   
                    ZIndex="10000" OnItemsRequested="findCompanyBox_ItemsRequested" > 
                    <CollapseAnimation Duration="200" Type="OutQuint" /> 
                  </telerik:RadComboBox>                    
 
             <asp:Button ID="UpdateButton" OnClientClick="Save(this, event);" Text="Save"   
                    runat="server" /> 
            </FormTemplate>                                                  
           </EditFormSettings>                    
          </MasterTableView> 
         </telerik:RadGrid> 

in code behind I have :

protected void findCompanyBox_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
{  
   RadComboBox findCompanyBox = new RadComboBox();  
   findCompanyBox = (RadComboBox)GridAdvert.FindControl("findCompanyBox");  


After I call :
findCompanyBox = (RadComboBox)GridAdvert.FindControl("findCompanyBox");
... I get > findCompanyBox = null

My question is . How can I find RadComboBox control in Girid FormTemplate ???

Regards
Krzysztof






6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Dec 2008, 04:52 AM
Hello,

You can try the following code to access the RadComboBox in Grid EditFormTemplate in the ItemDataBound event of the RadGrid.
cs:
protected void GridAdvert_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
       if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
          {             
              GridEditFormItem item = e.Item as GridEditFormItem; 
              RadComboBox  rdcbx = (RadComboBox )item.FindControl("findCompanyBox") 
          } 
    } 

Thanks
Princy.
0
Krzysztof
Top achievements
Rank 1
answered on 12 Dec 2008, 09:25 AM
Hi

It work well. Thank You.
But I have another problem with display RadComboBox items.

I code behind I have :

protected void findCompanyBox_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
    {  
for (int i = itemOffset; i < endOffset; i++)  
 {  
    RadComboBoxItem boxItem =  
                    new RadComboBoxItem(data.Rows[i]["companyName"].ToString(), data.Rows[i]["companyName"].ToString());  
    boxItem.Font.Size = FontUnit.Point(8);  
    FindCompanyBox.Items.Add(boxItem);  
 
  }  

When I match items for ComboBox, I canot see the items. I can see border and footer of ComboBox but item content disapear. I cannot see background of items too.  Why ??

Regards
Krzysztof

0
Krzysztof
Top achievements
Rank 1
answered on 12 Dec 2008, 10:48 AM
Hi

C# code work well but ...
How can I find RadComboBox in JavaScript code ???

Regrards
Krzysztof
0
Shinu
Top achievements
Rank 2
answered on 12 Dec 2008, 11:10 AM
Hi Krzysztof,

Here is a code library submission which explains how to access controls in a Grid template on the client side. Go through it and see if it helps to some extent.
Accessing server controls in a grid template on the client

Shinu.
0
Krzysztof
Top achievements
Rank 1
answered on 12 Dec 2008, 12:55 PM
Hi

Thank You for the sample.

Could You answer for my prevoiuse question ??

.....
When I match items for ComboBox, I canot see the items. I can see border and footer of ComboBox but item content disapear. I cannot see background of items too.  Why ??
.....

Regards
Krzysztof
0
Krzysztof
Top achievements
Rank 1
answered on 12 Dec 2008, 01:37 PM
Hi

I downloaded and run this sample. It work well.


Regards
Krzysztof
Tags
Grid
Asked by
Krzysztof
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Krzysztof
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or