radcombobox getting populated two times with same records
I am Using radcombobox in asp.net gridview. I have used ItemTemplate tag
of radcombobox for putting a checkbox in it for multiple selection of
records my mark up is
<telerik:RadComboBox TabIndex="2" ID="rcbDept" runat="server"
EmptyMessage="--Select Department--"
AllowCustomText="true"
EnableScreenBoundaryDetection="false"
Width="100px"
EnableTextSelection="false"
Filter="Contains"
Height="200"
OnClientDropDownClosed="DropDownClosed"
OnClientFocus="ClientFocus">
<ItemTemplate>
<asp:CheckBox
runat="server"
ID="chk1"
onclick="onCheckBoxClick(this)"
Text='<%#
DataBinder.Eval(Container.DataItem,
"dept_name")
%>' />
</ItemTemplate>
</telerik:RadComboBox>
i have used this in EmptyDataTemplate EditTemplate & FooterTemplate of
Gridview.
i am populating the Combobox in RowCreated Event
protected void gv1_RowCreated(object sender, GridViewRowEventArgs e)
{
int a = 0;
RadComboBox rcbDept1 = (RadComboBox)e.Row.FindControl("rcbDept");
if (rcbDept1 != null)
{
if (rcbDept1.Items.Count == 0)
{
rcbDept1.DataSource = obj.FillRcbDepartment(a);
rcbDept1.DataTextField = "dept_name";
rcbDept1.DataValueField = "dept_cd";
rcbDept1.DataBind();
}
}
}
my problem is that if there are 5 record in department the it gets
duplicated and combobox fills with 10 records.Where am i going wrong plz
suggest. Thanks in advance
No comments:
Post a Comment