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

RadcomboBox in Sharepoint codebehind

1 Answer 55 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
SANNIDHI
Top achievements
Rank 1
SANNIDHI asked on 30 Dec 2010, 11:07 AM
Hi,

In Sharepoint aspx page i have dropdown and radcombobox controls.

When i try to fill radcombobox and asp:dropdownlist controls from the code behind file, only asp:dropdownlist is getting filled.
I am unable to fill radcombobox or any other rad controls in the codebehind file.

I double checked radcontrols id's in the aspx and in the code behind. There is no mismatch in the ID names.
Still only all my rad controls are null in the code behind. (asp.net controls i am able to access in the same code behind file)

Similar problem was found in one of the telerik forums  http://www.telerik.com/community/forums/aspnet-ajax/ajax/radlistbox-and-sharepoint-code-behind-project.aspx.

Pleass help me to resolve this issue.

//Code Behind File
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.Utilities;
using Telerik.Web.UI;
  
namespace SPTelerikTest 
    public partial class SPTelerikTest : System.Web.UI.Page 
    
        protected DropDownList DropDownList1; 
        protected RadComboBox RadComboBox1; 
  
        protected void Page_Load(object sender, EventArgs e) 
        
  
           if (!Page.IsPostBack) 
            
               DropDownList1.Items.Add("Item1");
               RadComboBoxItem oradComboBoxItem = new RadComboBoxItem("Item1);
               RadComboBox1.Items.Add(oradComboBoxItem);
            }  
        
   }
}
 
 
 
//Aspx Page code snippet
 
<table>
        <tr>
            <td>
            <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="120px" Skin="WebBlue"   EmptyMessage="Select Partner Name" ></telerik:RadComboBox>
            </td>
            <td>
            <asp:DropDownList ID="DropDownList1" runat="server" Width="120px"  >
                                    </asp:DropDownList>
 
            </td>
      </tr>
</table>

1 Answer, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 04 Jan 2011, 05:01 PM
Hello SANNIDHI,

Let me suggest you make a small change in your code:
<table>
    <tr>
        <td>
            <telerik:RadComboBoxid="RadComboBox2"
                runat="server"width="120px"skin="WebBlue"
                emptymessage="Select Partner Name"
                AllowCustomText="true"></telerik:RadComboBox>
        </td>
        <td>
            <asp:DropDownListID="DropDownList2"
            runat="server"Width="120px">
            </asp:DropDownList>
        </td>
    </tr>
</table>
// protected DropDownList DropDownList1;
//  protected RadComboBox RadComboBox1;
    
protected void Page_Load(object sender, EventArgs e)
{
    
    if (!Page.IsPostBack)
    {
        this.DropDownList1.Items.Add("Item1");
        RadComboBoxItem oradComboBoxItem = new RadComboBoxItem("Item1");
        this.RadComboBox1.Items.Add(oradComboBoxItem);
    }
}

(Please note that in order to display the EmptyMessage in RadComboBox input you need to set the AllowCustomText property of the control to "true".)

I created a sample SharePoint2010 WebPart with the above code - please find it attached.

Best wishes,
Kalina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Sharepoint Integration
Asked by
SANNIDHI
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Share this question
or