I'm using RadDropDownList inside a RadGrid. The RadDropDownList has its own sqlsource because it binds to a lookup table. It works somewhat fine and returns data, but whenever the ID value is 0 (a common case), the RadDropDownList does not display until I click on the space where it should be--then it appears. This seems like strange default behavior. Figuring the control was getting confused because of the cases of "0" IDs, I changed my query to the lookup table so that it would see 0 as a real value with the corresponding text "** Main Contract **". Even when I click the space where the ddl should be, and the ddl then appears, it still doesn't have "** Main Contract **" selected -- it is in the list though.
How can I fix this so that (1) the RadDropDownList appears even when the value is 0; and (2) the "** Main Contract **" line item is selected when the value is 0.
It seems like when the value for that ddl field is 0, rad wants to hide it. I attached 2 screenshots and my declarative code.
How can I fix this so that (1) the RadDropDownList appears even when the value is 0; and (2) the "** Main Contract **" line item is selected when the value is 0.
It seems like when the value for that ddl field is 0, rad wants to hide it. I attached 2 screenshots and my declarative code.
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1"> <telerik:RadListBox runat="server" ID="SavedChangesList" Width="600px" Height="200px" Visible="false"></telerik:RadListBox> <telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" PageSize="10" Skin="Default" OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" OnItemUpdated="RadGrid1_ItemUpdated" OnPreRender="RadGrid1_PreRender" AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" Width="950px" OnBatchEditCommand="RadGrid1_BatchEditCommand" DataSourceID="sqlContractMatrix"> <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ID" DataSourceID="sqlContractMatrix" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False"> <BatchEditingSettings EditType="Cell" /> <SortExpressions> <telerik:GridSortExpression FieldName="SiteID,ProductID" SortOrder="Descending" /> </SortExpressions> <Columns> <telerik:GridTemplateColumn HeaderText="Site" HeaderStyle-Width="150px" UniqueName="SiteID" DataField="SiteID"> <ItemTemplate> <%# Eval("SiteName") %> </ItemTemplate> <EditItemTemplate> <telerik:RadDropDownList runat="server" ID="ddlSites" AppendDataBoundItems="true" DataValueField="SiteID" DataTextField="SiteName" DataSourceID="sqlSites"> </telerik:RadDropDownList> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Product" HeaderStyle-Width="150px" UniqueName="ProductID" DataField="ProductID"> <ItemTemplate> <%# Eval("ProductName") %> </ItemTemplate> <EditItemTemplate> <telerik:RadDropDownList runat="server" ID="ddlProducts" DropDownWidth="250" DropDownHeight="400" DefaultMessage="Product" AppendDataBoundItems="true" DataValueField="ProductID" DataTextField="ProductName" DataSourceID="sqlProducts"> </telerik:RadDropDownList> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="TemplateFile" HeaderStyle-Width="200px" HeaderText="Template" SortExpression="TemplateFile" UniqueName="TemplateFile"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="PDFName" HeaderStyle-Width="200px" HeaderText="PDFName" SortExpression="PDFName" UniqueName="PDFName"> </telerik:GridBoundColumn> <telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> </telerik:GridButtonColumn> </Columns> </MasterTableView> </telerik:RadGrid> </telerik:RadAjaxPanel> <asp:SqlDataSource ID="sqlContractMatrix" runat="server" ConnectionString="<%$ ConnectionStrings:FitTrack %>" DeleteCommand="DELETE FROM ContractMatrix WHERE ID = @ID" InsertCommand="INSERT INTO ContractMatrix (SiteID, ProductID, TemplateFile, PDFName, LastModifiedDate, LastModifiedByID) VALUES (@SiteID, @ProductID, @TemplateFile, @PDFName, @LastModifiedDate, @LastModifiedByID)" UpdateCommand="UPDATE ContractMatrix SET SiteID = @SiteID, ProductID = @ProductID, TemplateFile = @TemplateFile, PDFName = @PDFName, LastModifiedDate = GETDATE(), LastModifiedByID = @LastModifiedByID WHERE ID = @ID"> <DeleteParameters> <asp:Parameter Name="ID" Type="Int32"></asp:Parameter> </DeleteParameters> <InsertParameters> <asp:Parameter Name="SiteID" Type="Int32"></asp:Parameter> <asp:Parameter Name="ProductID" Type="Int32"></asp:Parameter> <asp:Parameter Name="TemplateFile" Type="String"></asp:Parameter> <asp:Parameter Name="PDFName" Type="String"></asp:Parameter> <asp:Parameter Name="LastModifiedDate" Type="DateTime"></asp:Parameter> <asp:Parameter Name="LastModifiedByID" Type="DateTime"></asp:Parameter> </InsertParameters> <UpdateParameters> <asp:Parameter Name="SiteID" Type="Int32"></asp:Parameter> <asp:Parameter Name="ProductID" Type="Int32"></asp:Parameter> <asp:Parameter Name="TemplateFile" Type="String"></asp:Parameter> <asp:Parameter Name="PDFName" Type="String"></asp:Parameter> <asp:Parameter Name="LastModifiedDate" Type="DateTime"></asp:Parameter> <asp:Parameter Name="LastModifiedByID" Type="DateTime"></asp:Parameter> <asp:Parameter Name="ID" Type="Int32"></asp:Parameter> </UpdateParameters> </asp:SqlDataSource> <!-- SQL data sources for various lookup tables --> <asp:SqlDataSource ID="sqlSites" runat="server" ConnectionString="<%$ ConnectionStrings:FitTrack %>" ProviderName="System.Data.SqlClient" SelectCommand="..."></asp:SqlDataSource> <asp:SqlDataSource ID="sqlProducts" runat="server" ConnectionString="<%$ ConnectionStrings:FitTrack %>" ProviderName="System.Data.SqlClient"></asp:SqlDataSource>