I have a Stored Procedure in SQL Database as below:
ALTERPROCEDURE[General].[usp_tbl_AccountCode_Query_Search] @CompanyCode nvarchar (255) = Null, @AccountCode nvarchar(50) = Null, @Description nvarchar(1000) = NullASBEGIN SETNOCOUNT ON; If (LTRIM(@CompanyCode) = '') Set@CompanyCode = Null If (LTRIM(@AccountCode) = '') Set@AccountCode = Null If (LTRIM(@Description) = '') Set@Description = Null DECLARE@GroupId asnvarchar(50)=null Select@GroupId = GroupID FROM[General].[tbl_Buyer] wherecode = @CompanyCode IF (@GroupId='8000') BEGIN SelectDistinct AccountCodeID, CompanyCode, AccountCode, AccountDescription FromGeneral.tbl_AccountCode (NOLOCK) WhereIsNull(AccountCode, '') Like'%'+ Coalesce(@AccountCode, AccountCode, '') + '%' AndIsNull(AccountDescription, '') Like'%'+ '['+ Coalesce(@Description, AccountDescription, '') + ']'+ + '%' AndIsNull(AccountDescription, '') Like'%'+ Coalesce(@Description, AccountDescription, '') + '%' --And CompanyCode in (Select Code FROM [Sunway_AP].[General].[tbl_Buyer] where GroupID = '8000') AndCompanyCode = '8000' OrderByAccountCode END ELSEIF (@GroupId='9000') BEGIN SelectDistinct AccountCodeID, CompanyCode, AccountCode, AccountDescription FromGeneral.tbl_AccountCode (NOLOCK) WhereIsNull(AccountCode, '') Like'%'+ Coalesce(@AccountCode, AccountCode, '') + '%' AndIsNull(AccountDescription, '') Like'%'+ '['+ Coalesce(@Description, AccountDescription, '') + ']'+ + '%' AndIsNull(AccountDescription, '') Like'%'+ Coalesce(@Description, AccountDescription, '') + '%' --And CompanyCode in (Select Code FROM [Sunway_AP].[General].[tbl_Buyer] where GroupID = '9000') AndCompanyCode = '9000' OrderByAccountCode END else BEgin SelectDistinct AccountCodeID, CompanyCode, AccountCode, AccountDescription FromGeneral.tbl_AccountCode (NOLOCK) WhereIsNull(AccountCode, '') Like'%'+ Coalesce(@AccountCode, AccountCode, '') + '%' AndIsNull(AccountDescription, '') Like'%'+ '['+ Coalesce(@Description, AccountDescription, '') + ']'+ + '%' AndIsNull(AccountDescription, '') Like'%'+ Coalesce(@Description, AccountDescription, '') + '%' AndCompanyCode = ISNULL(@CompanyCode, CompanyCode) OrderByAccountCode ENDMy requirement is as below:
I have a "Company Dropdown" and a "RadGrid" on Web page with 4 columns inside it:
1) Account Code
2) Description
3) Amount
4) Remark
I want to show only "Account Code(as Dropdown) , Amount(as Textbox), Remark(as Textbox)" column while doing "Edit" and "Add" not "Description" column.
Also, I want that inside "Account Code Dropdown" (which will appear while "edit" and "add") Data for 2 columns: "Account Code" & "Description" should bind together using above Stored Procedure.
and after "adding" records (using Dropdown and textboxes) data should save in DB and visible in RadGrid. Since I want to bind "Account Code Dropdown" together with 2 different DB columns but after "adding" and "editing" records I want to show them in their specific RadGrid columns defined as above.
Also, the binding of "Account Code Dropdown" should be based on Company Dropdown which is outside of RadGrid. i.e., Whatever Company user select from dropdown, data inside "Account Code Dropdown" should be visible based on that particular company.
Data inside Company dropdown is from: 1000 to 9000
RadGrid aspx code is:
<telerik:RadMultiPageID="RadMultiPage6"runat="server"SelectedIndex="0"Width="100%"> <telerik:RadPageViewID="RadPageView5"runat="server"Width="100%"> <telerik:RadAjaxPanelID="RadAjaxPanel5"runat="server"> <telerik:RadGridID="RGGSTAcCode"runat="server" ShowFooter="True"GroupingEnabled="False"ShowStatusBar="true" AllowAutomaticInserts="True"AllowAutomaticUpdates="true"AllowAutomaticDeletes="true" OnNeedDataSource="RGGSTAcCode_NeedDataSource"OnItemDataBound="RGGSTAcCode_ItemDataBound"> <PagerStyleMode="NextPrevAndNumeric"></PagerStyle> <mastertableviewShowHeadersWhenNoRecords="true"commanditemdisplay="Top"autogeneratecolumns="false"datakeynames="RequestID"InsertItemDisplay="Top" insertitempageindexaction="ShowItemOnCurrentPage"ShowFooter="True"> <Columns> <telerik:GridBoundColumnDataField="AccountCodeID"HeaderText="AccountCode ID"UniqueName="AccountCodeID"SortExpression="AccountCodeID"></telerik:GridBoundColumn> <telerik:GridBoundColumnDataField="RequestID"HeaderText="Request ID"UniqueName="RequestID"SortExpression="RequestID"></telerik:GridBoundColumn> <telerik:GridTemplateColumnUniqueName="AccountCode"HeaderText="Account Code"> <ItemTemplate> <asp:LabelID="lblAcCode"Text='<%# Eval("AccountCode") %>' runat="server"></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownListID="ddlAcCode"runat="server"/> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumnDataField="AccountDescription"HeaderText="Description" UniqueName="AccountDescription"SortExpression="AccountDescription" InsertVisiblityMode="AlwaysHidden"> </telerik:GridBoundColumn> <telerik:GridBoundColumnaggregate="SUM"DataField="Amount"HeaderText="Amount"FooterText="Total : " UniqueName="Amount"SortExpression="Amount"> <ItemStyleHorizontalAlign="Right"/> <FooterStyleHorizontalAlign="Right"/> </telerik:GridBoundColumn> <telerik:GridBoundColumnDataField="Remark"HeaderText="IFCA Remark" UniqueName="Remark"SortExpression="Remark"> </telerik:GridBoundColumn> </Columns> <EditFormSettings> <EditColumnButtonType="ImageButton"/> </EditFormSettings> <CommandItemSettingsAddNewRecordText="Add new record"RefreshText="Refresh"></CommandItemSettings> </mastertableview> </telerik:RadGrid> </telerik:RadAjaxPanel> </telerik:RadPageView> </telerik:RadMultiPage>Please reply how to achieve it. If Possible guide the solution or create a sample code for my requirement.
I am very new in Telerik please forgive if something is very basic in my defined requirement.
////