Hi
I am using griddropdowncolumn to display/edit & inserting records in a Telerik grid.
Everything works fine but I also want to use the griddropdowncolumn as a combobox also. I have changed the property
of DropDownControlType="RadComboBox" but till then I am unable to accept text in the combo box.
My intention is use the griddropdowncolumn as a combo box so that the users can do the following at the time of Insert / Edit
1) Can choose the value form the dropdown OR 2) If the value is not available in the dropdown he can type the same so that I can save
it to database.
Given bellow is by ASPX File: (Please have a look in the code with Bold Formatting)
<asp:SqlDataSource ID="SqlDtLedger" runat="server"
ConnectionString="<%$ ConnectionStrings:ConStr %>"
SelectCommand="Select * from Master_Accounting_Sub_Ledger where [Is_Visiable] ='Y'"
UpdateCommand="UPDATE Master_Accounting_Sub_Ledger SET [Ledger_ID] = @Ledger_ID, Sub_Ledger_Name = @Sub_Ledger_Name WHERE Sub_Ledger_ID = @Original_Sub_Ledger_ID"
InsertCommand="INSERT INTO [Master_Accounting_Sub_Ledger] ([Ledger_ID],[Sub_Ledger_Name],[Entry_Type]) VALUES ( @Ledger_ID, @Sub_Ledger_Name, 'C')"
DeleteCommand="UPDATE Master_Accounting_Sub_Ledger SET [Is_Visiable] ='N' WHERE Sub_Ledger_ID = @Original_Sub_Ledger_ID and Entry_Type <>'S'"
OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
<UpdateParameters>
<asp:Parameter Name="Original_Sub_Ledger_ID" Type="Int32" />
<asp:Parameter Name="Ledger_ID" Type="Int32" />
<asp:Parameter Name="Sub_Ledger_Name" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Ledger_ID" Type="Int32" />
<asp:Parameter Name="Sub_Ledger_Name" Type="String" />
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="Original_Sub_Ledger_ID" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="Data_Accounting_Ledger_Name" runat="server"
ConnectionString="<%$ ConnectionStrings:ConStr %>"
SelectCommand="Select * from Master_Accounting_Ledger WHERE Sub_Ledger=1" >
</asp:SqlDataSource>
<asp:SqlDataSource ID="Data_Accounting_District" runat="server"
ConnectionString="<%$ ConnectionStrings:ConStr %>"
SelectCommand="Select District from Master_Accounting_Sub_Ledger GROUP By District" >
</asp:SqlDataSource>
<%------------grid--------------------%>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
DataSourceID="SqlDtLedger" GridLines="None"
AutoGenerateColumns="False" Width="800" Skin="Outlook">
<ExportSettings IgnorePaging="true" OpenInNewWindow="true" FileName="Accural_Primary_Group">
<Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Primary Acounts Group" />
<Excel Format="Html" FileExtension="xls" />
<Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" FileExtension="CSV" />
</ExportSettings>
<MasterTableView DataSourceID="SqlDtLedger" CommandItemDisplay="TopAndBottom"
AutoGenerateColumns="False" DataKeyNames="Sub_Ledger_ID">
<EditFormSettings>
<EditColumn CancelImageUrl="../image/RadControls/Grid/Skins/Default/Cancel.gif" EditImageUrl="../image/RadControls/Grid/Skins/Default/Edit.gif"
InsertImageUrl="../image/RadControls/Grid/Skins/Default/Insert.gif" UniqueName="EditCommandColumn"
UpdateImageUrl="../image/RadControls/Grid/Skins/Default/Update.gif">
</EditColumn>
</EditFormSettings>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="Sub_Ledger_ID" DataType="System.Int32" ReadOnly="True" UniqueName="Sub_Ledger_ID" Visible="false" ></telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataSourceID="Data_Accounting_Ledger_Name" SortExpression="Ledger_ID" ListTextField="Ledger_Name" ListValueField="Ledger_ID" UniqueName="Ledger_ID" DataField="Ledger_ID" DropDownControlType="DropDownList" HeaderText="Ledger"></telerik:GridDropDownColumn>
<telerik:GridBoundColumn DataField="Sub_Ledger_Name" HeaderText="Sub Ledger Name" UniqueName="Sub_Ledger_Name"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Mailing_Name" HeaderText="Mailing Name" UniqueName="Mailing_Name"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Mailing_Address_1" HeaderText="Mailing Address 1" UniqueName="Mailing_Address_1"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Mailing_Address_2" HeaderText="Mailing Address 2" UniqueName="Mailing_Address_2"></telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataSourceID="Data_Accounting_District" SortExpression="District" ListTextField="District" ListValueField="District" UniqueName="District" DataField="District" HeaderText="District" DropDownControlType="RadComboBox"></telerik:GridDropDownColumn>
<telerik:GridBoundColumn DataField="Pin" HeaderText="Pin / Zip" UniqueName="Pin"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" UniqueName="Phone"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Email" HeaderText="Email" UniqueName="Email"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CR_Days" HeaderText="Credit Days" UniqueName="CR_Days"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CR_Limit" HeaderText="Credit Limit" UniqueName="CR_Limit"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Entry_Type" DataType="System.String" ReadOnly="True" UniqueName="Entry_Type" Visible="false" ></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Is_Visiable" DataType="System.String" ReadOnly="True" UniqueName="Is_Visiable" Visible="false" ></telerik:GridBoundColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Delete"
UniqueName="DeleteColumn" ImageUrl="../image/RadControls/Grid/Skins/Default/Delete.gif"></telerik:GridButtonColumn>
</Columns>
<EditFormSettings ColumnNumber="4" CaptionDataField="Sub_Ledger_Name" CaptionFormatString="Edit <h6> {0} </h6>">
<FormTableItemStyle Wrap="False"></FormTableItemStyle>
<FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" />
<FormTableStyle CellSpacing="0" CellPadding="2" Height="80px" BackColor="White" />
<FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
<EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update record"
UniqueName="EditCommandColumn1" CancelText="Cancel edit">
</EditColumn>
<FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle>
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<ClientEvents OnRowDblClick="RowDblClick" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
I am using griddropdowncolumn to display/edit & inserting records in a Telerik grid.
Everything works fine but I also want to use the griddropdowncolumn as a combobox also. I have changed the property
of DropDownControlType="RadComboBox" but till then I am unable to accept text in the combo box.
My intention is use the griddropdowncolumn as a combo box so that the users can do the following at the time of Insert / Edit
1) Can choose the value form the dropdown OR 2) If the value is not available in the dropdown he can type the same so that I can save
it to database.
Given bellow is by ASPX File: (Please have a look in the code with Bold Formatting)
<asp:SqlDataSource ID="SqlDtLedger" runat="server"
ConnectionString="<%$ ConnectionStrings:ConStr %>"
SelectCommand="Select * from Master_Accounting_Sub_Ledger where [Is_Visiable] ='Y'"
UpdateCommand="UPDATE Master_Accounting_Sub_Ledger SET [Ledger_ID] = @Ledger_ID, Sub_Ledger_Name = @Sub_Ledger_Name WHERE Sub_Ledger_ID = @Original_Sub_Ledger_ID"
InsertCommand="INSERT INTO [Master_Accounting_Sub_Ledger] ([Ledger_ID],[Sub_Ledger_Name],[Entry_Type]) VALUES ( @Ledger_ID, @Sub_Ledger_Name, 'C')"
DeleteCommand="UPDATE Master_Accounting_Sub_Ledger SET [Is_Visiable] ='N' WHERE Sub_Ledger_ID = @Original_Sub_Ledger_ID and Entry_Type <>'S'"
OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
<UpdateParameters>
<asp:Parameter Name="Original_Sub_Ledger_ID" Type="Int32" />
<asp:Parameter Name="Ledger_ID" Type="Int32" />
<asp:Parameter Name="Sub_Ledger_Name" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Ledger_ID" Type="Int32" />
<asp:Parameter Name="Sub_Ledger_Name" Type="String" />
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="Original_Sub_Ledger_ID" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="Data_Accounting_Ledger_Name" runat="server"
ConnectionString="<%$ ConnectionStrings:ConStr %>"
SelectCommand="Select * from Master_Accounting_Ledger WHERE Sub_Ledger=1" >
</asp:SqlDataSource>
<asp:SqlDataSource ID="Data_Accounting_District" runat="server"
ConnectionString="<%$ ConnectionStrings:ConStr %>"
SelectCommand="Select District from Master_Accounting_Sub_Ledger GROUP By District" >
</asp:SqlDataSource>
<%------------grid--------------------%>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
DataSourceID="SqlDtLedger" GridLines="None"
AutoGenerateColumns="False" Width="800" Skin="Outlook">
<ExportSettings IgnorePaging="true" OpenInNewWindow="true" FileName="Accural_Primary_Group">
<Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Primary Acounts Group" />
<Excel Format="Html" FileExtension="xls" />
<Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" FileExtension="CSV" />
</ExportSettings>
<MasterTableView DataSourceID="SqlDtLedger" CommandItemDisplay="TopAndBottom"
AutoGenerateColumns="False" DataKeyNames="Sub_Ledger_ID">
<EditFormSettings>
<EditColumn CancelImageUrl="../image/RadControls/Grid/Skins/Default/Cancel.gif" EditImageUrl="../image/RadControls/Grid/Skins/Default/Edit.gif"
InsertImageUrl="../image/RadControls/Grid/Skins/Default/Insert.gif" UniqueName="EditCommandColumn"
UpdateImageUrl="../image/RadControls/Grid/Skins/Default/Update.gif">
</EditColumn>
</EditFormSettings>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="Sub_Ledger_ID" DataType="System.Int32" ReadOnly="True" UniqueName="Sub_Ledger_ID" Visible="false" ></telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataSourceID="Data_Accounting_Ledger_Name" SortExpression="Ledger_ID" ListTextField="Ledger_Name" ListValueField="Ledger_ID" UniqueName="Ledger_ID" DataField="Ledger_ID" DropDownControlType="DropDownList" HeaderText="Ledger"></telerik:GridDropDownColumn>
<telerik:GridBoundColumn DataField="Sub_Ledger_Name" HeaderText="Sub Ledger Name" UniqueName="Sub_Ledger_Name"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Mailing_Name" HeaderText="Mailing Name" UniqueName="Mailing_Name"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Mailing_Address_1" HeaderText="Mailing Address 1" UniqueName="Mailing_Address_1"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Mailing_Address_2" HeaderText="Mailing Address 2" UniqueName="Mailing_Address_2"></telerik:GridBoundColumn>
<telerik:GridDropDownColumn DataSourceID="Data_Accounting_District" SortExpression="District" ListTextField="District" ListValueField="District" UniqueName="District" DataField="District" HeaderText="District" DropDownControlType="RadComboBox"></telerik:GridDropDownColumn>
<telerik:GridBoundColumn DataField="Pin" HeaderText="Pin / Zip" UniqueName="Pin"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" UniqueName="Phone"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Email" HeaderText="Email" UniqueName="Email"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CR_Days" HeaderText="Credit Days" UniqueName="CR_Days"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CR_Limit" HeaderText="Credit Limit" UniqueName="CR_Limit"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Entry_Type" DataType="System.String" ReadOnly="True" UniqueName="Entry_Type" Visible="false" ></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Is_Visiable" DataType="System.String" ReadOnly="True" UniqueName="Is_Visiable" Visible="false" ></telerik:GridBoundColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Delete"
UniqueName="DeleteColumn" ImageUrl="../image/RadControls/Grid/Skins/Default/Delete.gif"></telerik:GridButtonColumn>
</Columns>
<EditFormSettings ColumnNumber="4" CaptionDataField="Sub_Ledger_Name" CaptionFormatString="Edit <h6> {0} </h6>">
<FormTableItemStyle Wrap="False"></FormTableItemStyle>
<FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" />
<FormTableStyle CellSpacing="0" CellPadding="2" Height="80px" BackColor="White" />
<FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
<EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update record"
UniqueName="EditCommandColumn1" CancelText="Cancel edit">
</EditColumn>
<FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle>
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<ClientEvents OnRowDblClick="RowDblClick" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>