Below is the HTML code of RadGrid:
<telerik:RadGrid ID="RGGSTAcCode" runat="server" AutoGenerateColumns="false"
ShowFooter="True" GroupingEnabled="False" ShowStatusBar="true"
AllowAutomaticInserts="False" AllowAutomaticUpdates="False" AllowAutomaticDeletes="true"
OnNeedDataSource= "rggstAcCode_NeedDataSource" OnItemDataBound="rggstAcCode_ItemDataBound"
OnInsertCommand="rggstAcCode_InsertCommand" OnDeleteCommand="rggstAcCode_DeleteCommand"
OnUpdateCommand="rggstAcCode_UpdateCommand" OnItemCommand="RGGSTAcCode_ItemCommand"
EnableEmbeddedSkins="true" Skin="Outlook">
<mastertableview commanditemdisplay="Top" autogeneratecolumns="false" datakeynames="AccountCodeID"
insertitempageindexaction="ShowItemOnCurrentPage" ShowFooter="True" ShowHeadersWhenNoRecords="true">
<CommandItemSettings AddNewRecordText="New" />
<Columns>
<telerik:GridEditCommandColumn UniqueName="imagebutton1" ButtonType="ImageButton"></telerik:GridEditCommandColumn>
<telerik:GridTemplateColumn DataField="in_line" HeaderText="Line Number">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text="<%# Container.DataSetIndex+1 %>"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="AccountCode" HeaderText="Account Code">
<ItemTemplate>
<asp:Label ID="lblAcCode" Text='<%# Eval("AccountCode") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblAcCode2" runat="server" Text='<%# Eval("AccountCode") + " - " + Eval("AccountDescription")%>' Visible="false"></asp:Label>
<telerik:RadComboBox ID="ddlAccountCode" runat="server" Height="200" Width="250" DropDownWidth="350"
HighlightTemplatedItems="true" Filter="Contains" AppendDataBoundItems="true" DataTextField="AccountDescription" DataValueField="AccountCodeID"
OnItemsRequested="ddlAccountCode_ItemsRequested" ItemsPerRequest="50" EnableItemCaching="true"
AutoPostBack="true" OnSelectedIndexChanged="ddlAccountCode_SelectedIndexChanged"
EnableLoadOnDemand="True" ShowMoreResultsBox="true" EnableVirtualScrolling="true">
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="AccountDescription" HeaderText="Description"
UniqueName="AccountDescription" SortExpression="AccountDescription" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn aggregate="SUM" DataFormatString="{0:n}" DataField="Amount" HeaderText="Amount" FooterAggregateFormatString="Total : {0:###,##0.00}"
UniqueName="Amount" SortExpression="Amount" FooterStyle-BackColor="#ffc04c">
<ItemStyle HorizontalAlign="Left" />
<FooterStyle HorizontalAlign="Left" />
<ColumnValidationSettings EnableRequiredFieldValidation="true">
<RequiredFieldValidator ForeColor="Red" Text="*This field is required">
</RequiredFieldValidator>
</ColumnValidationSettings>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Remark" HeaderText="IFCA Description"
UniqueName="Remark" SortExpression="Remark">
<ItemStyle HorizontalAlign="Left" />
<FooterStyle HorizontalAlign="Left" />
</telerik:GridBoundColumn>
<telerik:GridButtonColumn ConfirmTextFormatString="Are you sure you want to Delete Selected Account Code(s)?" ConfirmTextFields="AccountCodeID"
ConfirmDialogType="RadWindow" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" ButtonType="ImageButton"></telerik:GridButtonColumn>
</Columns>
<EditFormSettings>
<EditColumn ButtonType="ImageButton" />
</EditFormSettings>
<PagerStyle AlwaysVisible="True" PageSizeControlType="RadComboBox" />
</mastertableview>
</telerik:RadGrid>
Stored Procedure to display data in RadGrid:
ALTER PROCEDURE [Invoice].[usp_tbl_AccountCode_Select_Transaction]
@RequestID nvarchar(50)
AS
BEGIN
SET NOCOUNT ON;
Select
AccountCodeID,
RequestID,
AccountCode,
AccountDescription,
Amount,
Remark
From [Invoice].[tbl_AccountCodeTransaction] (NOLOCK)
Where RequestID = @RequestID
What I observed here is, If user enters following rows with following amount:
1) 0.00 (when 1st time insert, this will come as 1st row)
2) 2,000.00 (when 2nd time insert, this will come as 2nd row)
3) 6,767.00 (when 3rd time insert, this will come as 1st row (in place of becoming 3rd row)
and previous 1st row will become 2nd row & previous 2nd row will become
as 3rd row)
4) 56,565.00 (when 4th time insert, this will come as 3rd row (in place of becoming 4th row)
& 2,000.00 will become as 4th row, & 0.00 will become as 2nd row, &
6,767.00 will remain as 1st row.
Below is the snapshot of above defined issue:
I want that the data should display in sequence, when I insert the
rows in RadGrid. i.e., whatever I insert 1st should display first,
2nd as 2nd , 3rd as 3rd and so on. not in random order.
I tried to put the "Auto generate Line numbers" but with that also
its not working as expected.
Please let me know why it is not displaying data in sequence ?
Please reply