Hello,
I have a radgrid with batch edit mode, that has AllowFilteringByColumn enabled. One of the grid column's is populated from a RadDropdownlist using a lookup table (via a foreign key). The filter in this case, only works on the foreign key value.
I am loading Dropdownlist in "PreRender". How can i configure filter for RadDropdownlist ?
ASPX Code:
<%--Product Names--%>
<telerik:GridTemplateColumn DataField="Product_Names" GroupByExpression="Product_Names Group by Product_Names"
UniqueName="Product_Names" InitializeTemplatesFirst="false" HeaderStyle-Width="10%"
HeaderText="Product Names" HeaderStyle-Font-Size="12px">
<HeaderTemplate>
<table>
<tr>
<td>
<asp:LinkButton ID="lnkSortProduct_Names" runat="server" CommandArgument="Product_Names" CommandName="Sort"
Text="Product Names"></asp:LinkButton>
</td>
<td>
<img src="Images/Context_new_menu.jpg" style="margin-top: 5px; margin-left: 5px;
cursor: pointer" onclick='ShowColumnHeaderMenu(event,"Product_Names")' alt="Show context menu" />
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblProduct_Names" runat="server" Text='<%#Eval("Product_Names")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<EditItemTemplate>
<telerik:RadDropDownList ID="ddlProductNames" runat="server" Width="65px" ToolTip="Choose Product Name" DropDownHeight="150px" DropDownWidth="100px">
</telerik:RadDropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
C# Code:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
DataSet ds = new DataSet();
try
{
// Filling Product Names data in Dropdowns
RadDropDownList ddlProductNames = RadGrid1.FindControl(RadGrid1.MasterTableView.ClientID + "_Product_Names").FindControl("ddlProductNames") as RadDropDownList;
ds = objFilingAssignments.GetAllddlProductNames();
if (ds.Tables[0].Rows.Count > 0)
{
ddlPreparer.Items.Clear();
ddlPreparer.DataSource = ds;
ddlPreparer.DataValueField = "User_Initials";
ddlPreparer.DataTextField = "User_Initials";
ddlPreparer.DataBind();
}
ddlProductNames.DataSource = null;
ddlProductNames.Dispose();
}
catch (SqlException ex)
{
throw ex;
}
catch (Exception ex)
{
throw ex;
}
}
How can i configure filter for RadDropdownlist ?
Thanks,
Sanath Rohilla.
I have a radgrid with batch edit mode, that has AllowFilteringByColumn enabled. One of the grid column's is populated from a RadDropdownlist using a lookup table (via a foreign key). The filter in this case, only works on the foreign key value.
I am loading Dropdownlist in "PreRender". How can i configure filter for RadDropdownlist ?
ASPX Code:
<%--Product Names--%>
<telerik:GridTemplateColumn DataField="Product_Names" GroupByExpression="Product_Names Group by Product_Names"
UniqueName="Product_Names" InitializeTemplatesFirst="false" HeaderStyle-Width="10%"
HeaderText="Product Names" HeaderStyle-Font-Size="12px">
<HeaderTemplate>
<table>
<tr>
<td>
<asp:LinkButton ID="lnkSortProduct_Names" runat="server" CommandArgument="Product_Names" CommandName="Sort"
Text="Product Names"></asp:LinkButton>
</td>
<td>
<img src="Images/Context_new_menu.jpg" style="margin-top: 5px; margin-left: 5px;
cursor: pointer" onclick='ShowColumnHeaderMenu(event,"Product_Names")' alt="Show context menu" />
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblProduct_Names" runat="server" Text='<%#Eval("Product_Names")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<EditItemTemplate>
<telerik:RadDropDownList ID="ddlProductNames" runat="server" Width="65px" ToolTip="Choose Product Name" DropDownHeight="150px" DropDownWidth="100px">
</telerik:RadDropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
C# Code:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
DataSet ds = new DataSet();
try
{
// Filling Product Names data in Dropdowns
RadDropDownList ddlProductNames = RadGrid1.FindControl(RadGrid1.MasterTableView.ClientID + "_Product_Names").FindControl("ddlProductNames") as RadDropDownList;
ds = objFilingAssignments.GetAllddlProductNames();
if (ds.Tables[0].Rows.Count > 0)
{
ddlPreparer.Items.Clear();
ddlPreparer.DataSource = ds;
ddlPreparer.DataValueField = "User_Initials";
ddlPreparer.DataTextField = "User_Initials";
ddlPreparer.DataBind();
}
ddlProductNames.DataSource = null;
ddlProductNames.Dispose();
}
catch (SqlException ex)
{
throw ex;
}
catch (Exception ex)
{
throw ex;
}
}
How can i configure filter for RadDropdownlist ?
Thanks,
Sanath Rohilla.